]> source.dussan.org Git - nextcloud-server.git/commitdiff
Enhancement: Implements Grouplist Toggle, Courtesy Calendar App Settings.
authorraghunayyar <me@iraghu.com>
Thu, 6 Mar 2014 07:14:42 +0000 (12:44 +0530)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 2 Jun 2014 10:53:55 +0000 (12:53 +0200)
settings/js/users/groups.js

index 13090b991620d721e6da9b11cef3a19a48238c50..b666ad5e74b97288f3c4fb6ac0b0dcdcf09ef729 100644 (file)
@@ -220,16 +220,26 @@ $(document).ready( function () {
        });
 
        // Implements Quota Settings Toggle.
-       $('#app-navigation').find('.settings-button').on('click', function (e) {
-               $('.settings-button').addClass('opened');
-               var settings = $('#app-settings');
-               e.stopPropagation();
-               settings.animate({height: "100px"});
-               $('#app-settings-content').css('display', 'block');
-               $(document).click(function (e) {
-                       if (!settings.is(e.target) && settings.has(e.target).length === 0) {
-                               settings.animate({height: "45px"});
+       $('#app-settings-header').on('click keydown',function(event) {
+               if(wrongKey(event)) {
+                       return;
+               }
+               var bodyListener = function(e) {
+                       if($('#app-settings').find($(e.target)).length === 0) {
+                               $('#app-settings').switchClass('open', '');
                        }
-               });
+               };
+               if($('#app-settings').hasClass('open')) {
+                       $('#app-settings').switchClass('open', '');
+                       $('body').unbind('click', bodyListener);
+               } else {
+                       $('#app-settings').switchClass('', 'open');
+                       $('body').bind('click', bodyListener);
+               }
        });
-});
\ No newline at end of file
+});
+
+var wrongKey = function(event) {
+       return ((event.type === 'keydown' || event.type === 'keypress') 
+               && (event.keyCode !== 32 && event.keyCode !== 13));
+};
\ No newline at end of file