Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
Backend Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Backend Server
Commits
32969599
Commit
32969599
authored
Apr 14, 2020
by
Andreas Heimann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added graceful errors for uploading
parent
00acfe2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
7 deletions
+48
-7
public/assets/css/upload.css
public/assets/css/upload.css
+16
-0
public/assets/css/upload.less
public/assets/css/upload.less
+17
-0
src/Controller/UploadController.php
src/Controller/UploadController.php
+6
-6
templates/upload/index.html.twig
templates/upload/index.html.twig
+9
-1
No files found.
public/assets/css/upload.css
View file @
32969599
...
@@ -184,3 +184,19 @@
...
@@ -184,3 +184,19 @@
display
:
flex
;
display
:
flex
;
justify-content
:
flex-end
;
justify-content
:
flex-end
;
}
}
.flashbang
{
padding
:
20px
;
margin-bottom
:
25px
;
border
:
2px
solid
#fff
;
border-radius
:
6px
;
}
.flashbang.flashbang-success
{
background
:
rgba
(
121
,
223
,
90
,
0.1
);
border-color
:
#79df5a
;
color
:
#79df5a
;
}
.flashbang.flashbang-error
{
background
:
rgba
(
197
,
65
,
76
,
0.1
);
border-color
:
#c5414c
;
color
:
#c5414c
;
}
public/assets/css/upload.less
View file @
32969599
...
@@ -157,4 +157,21 @@
...
@@ -157,4 +157,21 @@
display: flex;
display: flex;
justify-content: flex-end;
justify-content: flex-end;
}
}
}
.flashbang {
padding: 20px;
margin-bottom: 25px;
border: 2px solid #fff;
border-radius: 6px;
&.flashbang-success {
background: rgba(121, 223, 90, 0.1);
border-color: #79df5a;
color: #79df5a;
}
&.flashbang-error {
background: rgba(197, 65, 76, 0.1);
border-color: #c5414c;
color: #c5414c;
}
}
}
\ No newline at end of file
src/Controller/UploadController.php
View file @
32969599
...
@@ -112,7 +112,7 @@ class UploadController extends AbstractController
...
@@ -112,7 +112,7 @@ class UploadController extends AbstractController
}
}
}
}
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
var_dump
(
$e
);
$this
->
addFlash
(
'error'
,
'Uploading failed. Please report back to our development team!'
);
// clean up temp files
// clean up temp files
$hf
=
new
HelperFunctions
();
$hf
=
new
HelperFunctions
();
...
@@ -131,7 +131,7 @@ class UploadController extends AbstractController
...
@@ -131,7 +131,7 @@ class UploadController extends AbstractController
}
}
}
}
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
var_dump
(
$e
);
$this
->
addFlash
(
'error'
,
'Uploading failed. Please report back to our development team!'
);
// clean up temp files
// clean up temp files
$hf
=
new
HelperFunctions
();
$hf
=
new
HelperFunctions
();
...
@@ -150,7 +150,7 @@ class UploadController extends AbstractController
...
@@ -150,7 +150,7 @@ class UploadController extends AbstractController
}
}
}
}
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
var_dump
(
$e
);
$this
->
addFlash
(
'error'
,
'Uploading failed. Please report back to our development team!'
);
// clean up temp files
// clean up temp files
$hf
=
new
HelperFunctions
();
$hf
=
new
HelperFunctions
();
...
@@ -186,13 +186,13 @@ class UploadController extends AbstractController
...
@@ -186,13 +186,13 @@ class UploadController extends AbstractController
return
$this
->
redirectToRoute
(
'song.detail'
,
[
'songId'
=>
$song
->
getId
()]);
return
$this
->
redirectToRoute
(
'song.detail'
,
[
'songId'
=>
$song
->
getId
()]);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
throw
$e
;
$this
->
addFlash
(
'error'
,
'Uploading failed. Please report back to our development team!'
)
;
}
}
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
throw
$e
;
$this
->
addFlash
(
'error'
,
'Uploading failed. Please report back to our development team!'
)
;
}
}
}
else
{
}
else
{
throw
new
\Exception
(
"Error when extracting ZIP file"
);
$this
->
addFlash
(
'error'
,
'Uploading failed. Please report back to our development team!'
);
}
}
}
}
...
...
templates/upload/index.html.twig
View file @
32969599
...
@@ -4,7 +4,15 @@
...
@@ -4,7 +4,15 @@
{%
block
content
%}
{%
block
content
%}
<section
class=
"section-upload"
>
<section
class=
"section-upload"
>
{{
form_start
(
uploadForm
)
}}
{{
form_start
(
uploadForm
)
}}
{%
for
label
,
messages
in
app.flashes
%}
{%
for
message
in
messages
%}
<div
class=
"flashbang flashbang-
{{
label
}}
"
>
{{
message
}}
</div>
{%
endfor
%}
{%
endfor
%}
<div
class=
"box"
>
<div
class=
"box"
>
<div
class=
"title"
>
Upload
</div>
<div
class=
"title"
>
Upload
</div>
<div
class=
"upload-input"
>
<div
class=
"upload-input"
>
...
...
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