Fix Firefox import project bug (#2484)
Firefox is particular about how a form element can submit. It requires the form to have a button and to be added to the body of the document. Fixes #1773hotfix-virtualenv-no-downlaod
parent
864739c305
commit
65a522d8e8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -95,7 +95,8 @@ function Project (instance, view) {
|
|||
|
||||
form
|
||||
.attr('action', view.urls.projects_import)
|
||||
.attr('method', 'POST');
|
||||
.attr('method', 'POST')
|
||||
.hide();
|
||||
|
||||
Object.keys(data).map(function (attr) {
|
||||
var field = $('<input>')
|
||||
|
@ -105,13 +106,18 @@ function Project (instance, view) {
|
|||
form.append(field);
|
||||
});
|
||||
|
||||
|
||||
csrf_field = $('<input>')
|
||||
var csrf_field = $('<input>')
|
||||
.attr('type', 'hidden')
|
||||
.attr('name', 'csrfmiddlewaretoken')
|
||||
.attr('value', view.csrf_token);
|
||||
form.append(csrf_field);
|
||||
|
||||
// Add a button and add the form to body to satisfy Firefox
|
||||
var button = $('<input>')
|
||||
.attr('type', 'submit');
|
||||
form.append(button);
|
||||
$('body').append(form);
|
||||
|
||||
form.submit();
|
||||
};
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue