summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2015-08-11 15:13:59 +0200
committerJan-Christoph Borchardt <hey@jancborchardt.net>2015-08-11 15:13:59 +0200
commitd04a6bce6f81df4ee4351a311a630b14e8ecd8a3 (patch)
treeaa37e75da3021abf7e9fff06c419e8cd1461970b /core/js
parentcd0a2874de1f52827bca8d747128909099229cf4 (diff)
parent984ae8140d986e93a2fcea5951436e95c8e2c603 (diff)
downloadnextcloud-server-d04a6bce6f81df4ee4351a311a630b14e8ecd8a3.tar.gz
nextcloud-server-d04a6bce6f81df4ee4351a311a630b14e8ecd8a3.zip
Merge pull request #17709 from owncloud/fileactions-dropdown
Move file actions to dropdown
Diffstat (limited to 'core/js')
-rw-r--r--core/js/core.json4
-rw-r--r--core/js/js.js61
-rw-r--r--core/js/share.js4
3 files changed, 53 insertions, 16 deletions
diff --git a/core/js/core.json b/core/js/core.json
index 1053debaa99..a67491c4a35 100644
--- a/core/js/core.json
+++ b/core/js/core.json
@@ -7,7 +7,8 @@
"moment/min/moment-with-locales.js",
"handlebars/handlebars.js",
"blueimp-md5/js/md5.js",
- "bootstrap/js/tooltip.js"
+ "bootstrap/js/tooltip.js",
+ "backbone/backbone.js"
],
"libraries": [
"jquery-showpassword.js",
@@ -19,6 +20,7 @@
"jquery.ocdialog.js",
"oc-dialogs.js",
"js.js",
+ "oc-backbone.js",
"l10n.js",
"apps.js",
"share.js",
diff --git a/core/js/js.js b/core/js/js.js
index 72d4edd28dd..89bb9a71430 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -571,21 +571,20 @@ var OC={
* @todo Write documentation
*/
registerMenu: function($toggle, $menuEl) {
+ var self = this;
$menuEl.addClass('menu');
$toggle.on('click.menu', function(event) {
// prevent the link event (append anchor to URL)
event.preventDefault();
if ($menuEl.is(OC._currentMenu)) {
- $menuEl.slideUp(OC.menuSpeed);
- OC._currentMenu = null;
- OC._currentMenuToggle = null;
+ self.hideMenus();
return;
}
// another menu was open?
else if (OC._currentMenu) {
// close it
- OC._currentMenu.hide();
+ self.hideMenus();
}
$menuEl.slideToggle(OC.menuSpeed);
OC._currentMenu = $menuEl;
@@ -599,15 +598,56 @@ var OC={
unregisterMenu: function($toggle, $menuEl) {
// close menu if opened
if ($menuEl.is(OC._currentMenu)) {
- $menuEl.slideUp(OC.menuSpeed);
- OC._currentMenu = null;
- OC._currentMenuToggle = null;
+ this.hideMenus();
}
$toggle.off('click.menu').removeClass('menutoggle');
$menuEl.removeClass('menu');
},
/**
+ * Hides any open menus
+ *
+ * @param {Function} complete callback when the hiding animation is done
+ */
+ hideMenus: function(complete) {
+ if (OC._currentMenu) {
+ var lastMenu = OC._currentMenu;
+ OC._currentMenu.trigger(new $.Event('beforeHide'));
+ OC._currentMenu.slideUp(OC.menuSpeed, function() {
+ lastMenu.trigger(new $.Event('afterHide'));
+ if (complete) {
+ complete.apply(this, arguments);
+ }
+ });
+ }
+ OC._currentMenu = null;
+ OC._currentMenuToggle = null;
+ },
+
+ /**
+ * Shows a given element as menu
+ *
+ * @param {Object} [$toggle=null] menu toggle
+ * @param {Object} $menuEl menu element
+ * @param {Function} complete callback when the showing animation is done
+ */
+ showMenu: function($toggle, $menuEl, complete) {
+ if ($menuEl.is(OC._currentMenu)) {
+ return;
+ }
+ this.hideMenus();
+ OC._currentMenu = $menuEl;
+ OC._currentMenuToggle = $toggle;
+ $menuEl.trigger(new $.Event('beforeShow'));
+ $menuEl.show();
+ $menuEl.trigger(new $.Event('afterShow'));
+ // no animation
+ if (_.isFunction()) {
+ complete();
+ }
+ },
+
+ /**
* Wrapper for matchMedia
*
* This is makes it possible for unit tests to
@@ -1256,11 +1296,8 @@ function initCore() {
// don't close when clicking on the menu directly or a menu toggle
return false;
}
- if (OC._currentMenu) {
- OC._currentMenu.slideUp(OC.menuSpeed);
- }
- OC._currentMenu = null;
- OC._currentMenuToggle = null;
+
+ OC.hideMenus();
});
diff --git a/core/js/share.js b/core/js/share.js
index 99fd08c6411..57dd0dd6553 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -266,7 +266,6 @@ OC.Share={
if (hasShares || owner) {
recipients = $tr.attr('data-share-recipients');
- action.addClass('permanent');
message = t('core', 'Shared');
// even if reshared, only show "Shared by"
if (owner) {
@@ -281,8 +280,7 @@ OC.Share={
}
}
else {
- action.removeClass('permanent');
- action.html(' <span>'+ escapeHTML(t('core', 'Share'))+'</span>').prepend(img);
+ action.html('<span></span>').prepend(img);
}
if (hasLink) {
image = OC.imagePath('core', 'actions/public');