Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
PUBLIC
/
surfer-okd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b094fada
authored
Feb 08, 2017
by
Johannes Zellner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support drag'n'drop upload
1 parent
16ad753a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
frontend/index.html
frontend/js/app.js
frontend/index.html
View file @
b094fad
...
...
@@ -9,7 +9,7 @@
<link
href=
"/_admin/img/logo.png"
rel=
"icon"
type=
"image/png"
>
</head>
<body
id=
"app"
>
<body
id=
"app"
@
drop=
"drop"
@
dragover=
"dragOver"
>
<nav
class=
"navbar navbar-default"
v-cloak
>
<div
class=
"container-fluid"
>
...
...
frontend/js/app.js
View file @
b094fad
...
...
@@ -122,15 +122,12 @@ function up() {
window
.
location
.
hash
=
sanitize
(
app
.
path
.
split
(
'/'
).
slice
(
0
,
-
1
).
filter
(
function
(
p
)
{
return
!!
p
;
}).
join
(
'/'
));
}
function
upload
()
{
$
(
app
.
$els
.
upload
).
on
(
'change'
,
function
()
{
// detach event handler
$
(
app
.
$els
.
upload
).
off
(
'change'
);
function
uploadFiles
(
files
)
{
if
(
!
files
||
!
files
.
length
)
return
;
app
.
uploadStatus
=
{
busy
:
true
,
count
:
app
.
$els
.
upload
.
files
.
length
,
count
:
files
.
length
,
done
:
0
,
percentDone
:
0
};
...
...
@@ -163,8 +160,17 @@ function upload() {
}
for
(
var
i
=
0
;
i
<
app
.
uploadStatus
.
count
;
++
i
)
{
uploadFile
(
app
.
$els
.
upload
.
files
[
i
]);
uploadFile
(
files
[
i
]);
}
}
function
upload
()
{
$
(
app
.
$els
.
upload
).
on
(
'change'
,
function
()
{
// detach event handler
$
(
app
.
$els
.
upload
).
off
(
'change'
);
uploadFiles
(
app
.
$els
.
upload
.
files
||
[]);
});
// reset the form first to make the change handler retrigger even on the same file selected
...
...
@@ -257,6 +263,15 @@ function createDirectory(name) {
});
}
function
dragOver
(
event
)
{
event
.
preventDefault
();
}
function
drop
(
event
)
{
event
.
preventDefault
();
uploadFiles
(
event
.
dataTransfer
.
files
||
[]);
}
Vue
.
filter
(
'prettyDate'
,
function
(
value
)
{
var
d
=
new
Date
(
value
);
return
d
.
toDateString
();
...
...
@@ -304,7 +319,9 @@ var app = new Vue({
renameAsk
:
renameAsk
,
rename
:
rename
,
createDirectoryAsk
:
createDirectoryAsk
,
createDirectory
:
createDirectory
createDirectory
:
createDirectory
,
drop
:
drop
,
dragOver
:
dragOver
}
});
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment