summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-02-25 15:41:03 +0100
committerArthur Schiwon <blizzz@owncloud.com>2014-06-02 12:53:54 +0200
commit853ced644d6984ffa7260015851646717855a6c6 (patch)
tree798e68f4fe488dc37f68977a619b63bde4616c13 /settings
parenta4cfa9554548c53a3d0aa267495427729deb9352 (diff)
downloadnextcloud-server-853ced644d6984ffa7260015851646717855a6c6.tar.gz
nextcloud-server-853ced644d6984ffa7260015851646717855a6c6.zip
hide Add Group when clicking away or pressing ESC
Diffstat (limited to 'settings')
-rw-r--r--settings/js/users/groups.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js
index 7c8b6608f11..9f8225294b9 100644
--- a/settings/js/users/groups.js
+++ b/settings/js/users/groups.js
@@ -74,6 +74,11 @@
OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(gid) + '<span class="undo">' + t('settings', 'undo') + '</span>');
},
+ elementBelongsToAddGroup: function(el) {
+ return !(el !== $('#newgroup-form').get(0)
+ && $('#newgroup-form').find($(el)).length === 0);
+ },
+
showGroup: function (gid) {
UserList.empty();
UserList.update(gid);
@@ -84,8 +89,12 @@
}
},
+ isAddGroupButtonVisible: function() {
+ return $('#newgroup-init').is(":visible");
+ },
+
toggleAddGroup: function(event) {
- if($('#newgroup-init').is(":visible")) {
+ if(GroupList.isAddGroupButtonVisible()) {
event.stopPropagation();
$('#newgroup-form').show();
$('#newgroup-init').hide();
@@ -149,6 +158,18 @@ $(document).ready( function () {
GroupList.toggleAddGroup(e);
});
+ $(document).on('click keydown keyup', function(event) {
+ if(!GroupList.isAddGroupButtonVisible()
+ && !GroupList.elementBelongsToAddGroup(event.target)) {
+ GroupList.toggleAddGroup();
+ }
+ // Escape
+ if(!GroupList.isAddGroupButtonVisible() && event.keyCode && event.keyCode === 27) {
+ GroupList.toggleAddGroup();
+ }
+ });
+
+
// Responsible for Creating Groups.
$('#newgroup-form form').submit(function (event) {
event.preventDefault();