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 #1773
hotfix-virtualenv-no-downlaod
Anthony 2016-11-01 11:44:33 -07:00 committed by Eric Holscher
parent 864739c305
commit 65a522d8e8
4 changed files with 12 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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