1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

[rename] click outside the form to hide the form

This commit is contained in:
llj
2015-09-09 14:23:14 +08:00
parent f986bfa5cd
commit d76b0d7065
2 changed files with 14 additions and 2 deletions

View File

@@ -89,6 +89,16 @@ define([
} }
} }
}); });
// hide 'rename form'
$(document).click(function(e) {
var target = e.target || event.srcElement;
var $form = $('#rename-form');
if ($form.length && !$form.find('*').is(target)) {
$('.cancel', $form).click();
}
});
}, },
showDir: function(category, repo_id, path) { showDir: function(category, repo_id, path) {

View File

@@ -67,13 +67,13 @@ define([
}, },
highlight: function() { highlight: function() {
if (app.globalState.noFileOpPopup) { if (app.globalState.noFileOpPopup && !$('#rename-form').length) {
this.$el.addClass('hl').find('.repo-file-op').removeClass('vh'); this.$el.addClass('hl').find('.repo-file-op').removeClass('vh');
} }
}, },
rmHighlight: function() { rmHighlight: function() {
if (app.globalState.noFileOpPopup) { if (app.globalState.noFileOpPopup && !$('#rename-form').length) {
this.$el.removeClass('hl').find('.repo-file-op').addClass('vh'); this.$el.removeClass('hl').find('.repo-file-op').addClass('vh');
} }
}, },
@@ -236,6 +236,8 @@ define([
$td.attr('colspan', 1).css({ $td.attr('colspan', 1).css({
'width': $name.width() 'width': $name.width()
}); });
_this.$el.removeClass('hl').find('.repo-file-op').addClass('vh');
}; };
$('.cancel', form).click(cancelRename); $('.cancel', form).click(cancelRename);