Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
e63882e8
Commit
e63882e8
authored
Jan 26, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted dropzone_input to axios
parent
6a89ce29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+15
-18
No files found.
app/assets/javascripts/dropzone_input.js
View file @
e63882e8
...
...
@@ -2,6 +2,7 @@ import Dropzone from 'dropzone';
import
_
from
'
underscore
'
;
import
'
./preview_markdown
'
;
import
csrf
from
'
./lib/utils/csrf
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
Dropzone
.
autoDiscover
=
false
;
...
...
@@ -235,25 +236,21 @@ export default function dropzoneInput(form) {
uploadFile
=
(
item
,
filename
)
=>
{
const
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
item
,
filename
);
return
$
.
ajax
({
url
:
uploadsPath
,
type
:
'
POST
'
,
data
:
formData
,
dataType
:
'
json
'
,
processData
:
false
,
contentType
:
false
,
headers
:
csrf
.
headers
,
beforeSend
:
()
=>
{
showSpinner
();
return
closeAlertMessage
();
},
success
:
(
e
,
text
,
response
)
=>
{
const
md
=
response
.
responseJSON
.
link
.
markdown
;
showSpinner
();
closeAlertMessage
();
axios
.
post
(
uploadsPath
,
formData
)
.
then
(({
data
})
=>
{
const
md
=
data
.
link
.
markdown
;
insertToTextArea
(
filename
,
md
);
},
error
:
response
=>
showError
(
response
.
responseJSON
.
message
),
complete
:
()
=>
closeSpinner
(),
});
closeSpinner
();
})
.
catch
((
e
)
=>
{
showError
(
e
.
response
.
data
.
message
);
closeSpinner
();
});
};
updateAttachingMessage
=
(
files
,
messageContainer
)
=>
{
...
...
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