diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-08-18 18:50:43 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-08-18 18:50:43 +0200 |
commit | a820df71ee5832c5090a20589b2365904402a037 (patch) | |
tree | 3ff68a50b630119c9f5955a74f064ac78237f48d /core | |
parent | 5f389bb3348fbe37c5fe621963df6e3eed95b955 (diff) | |
parent | 3c7fbbef22035a228293a3baf79b0d185a8f2393 (diff) | |
download | nextcloud-server-a820df71ee5832c5090a20589b2365904402a037.tar.gz nextcloud-server-a820df71ee5832c5090a20589b2365904402a037.zip |
Merge pull request #10339 from owncloud/users-defaultquotafix
Fixed default quota field on user management page
Diffstat (limited to 'core')
-rw-r--r-- | core/js/apps.js | 139 | ||||
-rw-r--r-- | core/js/singleselect.js | 10 |
2 files changed, 84 insertions, 65 deletions
diff --git a/core/js/apps.js b/core/js/apps.js index 5f221bb9826..21fae58985e 100644 --- a/core/js/apps.js +++ b/core/js/apps.js @@ -10,67 +10,78 @@ (function (document, $, exports) { - 'use strict'; - - var dynamicSlideToggleEnabled = false; - - exports.Apps = { - enableDynamicSlideToggle: function () { - dynamicSlideToggleEnabled = true; - } - }; - - /** - * Provides a way to slide down a target area through a button and slide it - * up if the user clicks somewhere else. Used for the news app settings and - * add new field. - * - * Usage: - * <button data-apps-slide-toggle=".slide-area">slide</button> - * <div class=".slide-area" class="hidden">I'm sliding up</div> - */ - var registerAppsSlideToggle = function () { - var buttons = $('[data-apps-slide-toggle]'); - - $(document).click(function (event) { - - if (dynamicSlideToggleEnabled) { - buttons = $('[data-apps-slide-toggle]'); - } - - buttons.each(function (index, button) { - - var areaSelector = $(button).data('apps-slide-toggle'); - var area = $(areaSelector); - - // do nothing if the area is animated - if (!area.is(':animated')) { - - // button toggles the area - if (button === event.target) { - if (area.is(':visible')) { - area.slideUp(); - } else { - area.slideDown(); - } - - // all other areas that have not been clicked but are open - // should be slid up - } else { - var closest = $(event.target).closest(areaSelector); - if (area.is(':visible') && closest[0] !== area[0]) { - area.slideUp(); - } - } - } - }); - - }); - }; - - - $(document).ready(function () { - registerAppsSlideToggle(); - }); - -}(document, jQuery, OC));
\ No newline at end of file + 'use strict'; + + var dynamicSlideToggleEnabled = false; + + exports.Apps = { + enableDynamicSlideToggle: function () { + dynamicSlideToggleEnabled = true; + } + }; + + /** + * Provides a way to slide down a target area through a button and slide it + * up if the user clicks somewhere else. Used for the news app settings and + * add new field. + * + * Usage: + * <button data-apps-slide-toggle=".slide-area">slide</button> + * <div class=".slide-area" class="hidden">I'm sliding up</div> + */ + var registerAppsSlideToggle = function () { + var buttons = $('[data-apps-slide-toggle]'); + + $(document).click(function (event) { + + if (dynamicSlideToggleEnabled) { + buttons = $('[data-apps-slide-toggle]'); + } + + buttons.each(function (index, button) { + + var areaSelector = $(button).data('apps-slide-toggle'); + var area = $(areaSelector); + + function hideArea() { + area.slideUp(function() { + area.trigger(new $.Event('hide')); + }); + } + function showArea() { + area.slideDown(function() { + area.trigger(new $.Event('show')); + }); + } + + // do nothing if the area is animated + if (!area.is(':animated')) { + + // button toggles the area + if (button === event.target) { + if (area.is(':visible')) { + hideArea(); + } else { + showArea(); + } + + // all other areas that have not been clicked but are open + // should be slid up + } else { + var closest = $(event.target).closest(areaSelector); + if (area.is(':visible') && closest[0] !== area[0]) { + hideArea(); + } + } + } + }); + + }); + }; + + + $(document).ready(function () { + registerAppsSlideToggle(); + }); + +}(document, jQuery, OC)); diff --git a/core/js/singleselect.js b/core/js/singleselect.js index c22b5232207..1b2016aabb9 100644 --- a/core/js/singleselect.js +++ b/core/js/singleselect.js @@ -2,10 +2,14 @@ $.fn.singleSelect = function () { return this.each(function (i, select) { var input = $('<input/>'), + gravity = $(select).attr('data-tipsy-gravity'), inputTooltip = $(select).attr('data-inputtitle'); if (inputTooltip){ input.attr('title', inputTooltip); } + if (typeof gravity === 'undefined') { + gravity = 'n' + } select = $(select); input.css('position', 'absolute'); input.css({ @@ -35,7 +39,7 @@ input.css(select.offset()); input.show(); if ($.fn.tipsy){ - input.tipsy({gravity: 'n', trigger: 'manual'}); + input.tipsy({gravity: gravity, trigger: 'manual'}); input.tipsy('show'); } select.css('background-color', 'white'); @@ -83,6 +87,10 @@ $(this).tipsy('hide'); } }); + input.click(function(ev) { + // prevent clicks to close any container + ev.stopPropagation(); + }); }); }; })(jQuery); |