Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
photos
Commits
4d6c2b2c
Commit
4d6c2b2c
authored
Aug 16, 2014
by
Tobias Reich
Browse files
Don't close upload when an error occurred #203
parent
5d1b6261
Changes
1
Hide whitespace changes
Inline
Side-by-side
assets/js/upload.js
View file @
4d6c2b2c
...
...
@@ -36,16 +36,18 @@ upload = {
},
notify
:
function
(
title
)
{
notify
:
function
(
title
,
text
)
{
var
popup
;
if
(
!
text
||
text
===
""
)
text
=
"
You can now manage your new photo(s).
"
;
if
(
!
window
.
webkitNotifications
)
return
false
;
if
(
window
.
webkitNotifications
.
checkPermission
()
!==
0
)
window
.
webkitNotifications
.
requestPermission
();
if
(
window
.
webkitNotifications
.
checkPermission
()
===
0
&&
title
)
{
popup
=
window
.
webkitNotifications
.
createNotification
(
""
,
title
,
"
You can now manage your new photo(s).
"
);
popup
=
window
.
webkitNotifications
.
createNotification
(
""
,
title
,
text
);
popup
.
show
();
}
...
...
@@ -56,6 +58,7 @@ upload = {
local
:
function
(
files
)
{
var
albumID
=
album
.
getID
(),
error
=
false
,
process
=
function
(
files
,
file
)
{
var
formData
=
new
FormData
(),
...
...
@@ -68,8 +71,19 @@ upload = {
$
(
"
#upload_files
"
).
val
(
""
);
upload
.
close
();
upload
.
notify
(
"
Upload complete
"
);
if
(
error
===
false
)
{
// Success
upload
.
close
();
upload
.
notify
(
"
Upload complete
"
);
}
else
{
// Error
$
(
"
.upload_message a.close
"
).
show
();
upload
.
notify
(
"
Upload complete
"
,
"
Failed to upload one or more photos.
"
);
}
if
(
album
.
getID
()
===
false
)
lychee
.
goto
(
"
0
"
);
else
album
.
load
(
albumID
);
...
...
@@ -135,6 +149,9 @@ upload = {
.
html
(
"
Server returned the status code
"
+
xhr
.
status
)
.
show
();
// Set global error
error
=
true
;
// Throw error
lychee
.
error
(
"
Upload failed. Server returned the status code
"
+
xhr
.
status
+
"
!
"
,
xhr
,
xhr
.
responseText
);
...
...
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