reset name of new folder and prevent the form from being submitted twice
Signed-off-by: Florian Schunk <florian.schunk@rwth-aachen.de>
This commit is contained in:
parent
b61df4e290
commit
ff1e0e2302
|
@ -262,6 +262,8 @@ var OCdialogs = {
|
||||||
OC.registerMenu(newButton,self.$filePicker.find('.menu'),function () {
|
OC.registerMenu(newButton,self.$filePicker.find('.menu'),function () {
|
||||||
$input.focus();
|
$input.focus();
|
||||||
self.$filePicker.ocdialog('setEnterCallback', function() {
|
self.$filePicker.ocdialog('setEnterCallback', function() {
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
event.preventDefault();
|
||||||
self.$form.submit();
|
self.$form.submit();
|
||||||
});
|
});
|
||||||
var newName = $input.val();
|
var newName = $input.val();
|
||||||
|
@ -275,7 +277,7 @@ var OCdialogs = {
|
||||||
var $input = $form.find('input[type=\'text\']');
|
var $input = $form.find('input[type=\'text\']');
|
||||||
var $submit = $form.find('input[type=\'submit\']');
|
var $submit = $form.find('input[type=\'submit\']');
|
||||||
$submit.on('click',function(event) {
|
$submit.on('click',function(event) {
|
||||||
event.stopPropagation();
|
event.stopImmediatePropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$form.submit();
|
$form.submit();
|
||||||
});
|
});
|
||||||
|
@ -314,10 +316,13 @@ var OCdialogs = {
|
||||||
OC.hideMenus();
|
OC.hideMenus();
|
||||||
self.$filePicker.ocdialog('unsetEnterCallback');
|
self.$filePicker.ocdialog('unsetEnterCallback');
|
||||||
self.$filePicker.click();
|
self.$filePicker.click();
|
||||||
|
$input.val(newText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$input.keypress(function(event) {
|
$input.keypress(function(event) {
|
||||||
if (event.keyCode == 13 || event.which == 13) {
|
if (event.keyCode == 13 || event.which == 13) {
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
event.preventDefault();
|
||||||
$form.submit();
|
$form.submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue