Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e33cc619
authored
Feb 05, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: ajax upload GUI improved
parent
20fcdf2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
one/static/cloud.js
+31
-0
one/templates/box-filelist.html
+1
-0
No files found.
one/static/cloud.js
View file @
e33cc619
...
...
@@ -249,15 +249,46 @@ $(function() {
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'POST'
,
self
.
uploadURL
());
xhr
.
onload
=
function
()
{
$
(
'.file-upload'
).
removeClass
(
'opened'
);
$
(
'.file-upload .details'
).
slideUp
(
700
);
$
(
'#upload-zone'
).
show
();
$
(
'#upload-progress-text'
).
hide
();
self
.
uploadProgress
(
'0%'
);
self
.
uploadURL
(
'/'
);
loadFolder
(
self
.
currentPath
());
};
xhr
.
onerror
=
function
(){
$
(
'.file-upload'
).
removeClass
(
'opened'
);
$
(
'.file-upload .details'
).
slideUp
(
700
);
$
(
'#upload-zone'
).
show
();
$
(
'#upload-progress-text'
).
hide
();
self
.
uploadProgress
(
'0%'
);
self
.
uploadURL
(
'/'
);
}
if
(
tests
.
progress
)
{
$
(
'#upload-zone'
).
hide
();
$
(
'#upload-progress-text'
).
show
();
xhr
.
upload
.
onprogress
=
function
(
event
)
{
if
(
event
.
lengthComputable
)
{
var
complete
=
(
event
.
loaded
/
event
.
total
*
100
|
0
);
//progress.value = progress.innerHTML = complete;
self
.
uploadProgress
(
parseInt
(
complete
)
+
'%'
);
var
suffix
=
'B KB MB GB'
.
split
(
' '
);
var
l
=
event
.
loaded
;
var
t
=
event
.
total
;
for
(
var
i
=
0
;
l
>
1024
;
i
++
){
l
/=
1024
;
}
l
=
l
.
toFixed
(
1
)
+
' '
+
suffix
[
i
];
for
(
var
i
=
0
;
t
>
1024
;
i
++
){
t
/=
1024
;
}
t
=
t
.
toFixed
(
1
)
+
' '
+
suffix
[
i
];
if
(
complete
<
100
)
{
$
(
'#upload-progress-text'
).
html
(
'Feltöltés: '
+
l
+
'/'
+
t
+
' ('
+
(
event
.
loaded
/
event
.
total
*
100
).
toFixed
(
2
)
+
'%)'
);
}
else
{
$
(
'#upload-progress-text'
).
html
(
'Feltöltés: Mindjárt kész...'
);
}
}
}
}
...
...
one/templates/box-filelist.html
View file @
e33cc619
...
...
@@ -85,6 +85,7 @@
A feltöltéshez húzza ide a fájlt.
<a
href=
"#"
id=
"old-upload"
>
Hagyományos fájltfeltöltési felület
</a>
<img
class=
"preview"
/>
</div>
<div
style=
"display: none"
id=
"upload-progress-text"
class=
"upload-zone"
></div>
<div
style=
"display: none"
class=
"upload-zone"
>
<form
action=
"/"
method=
"POST"
data-bind=
"attr: {action: uploadURL}"
enctype=
"multipart/form-data"
>
<input
type=
"file"
name=
"data"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment