diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-11 11:35:46 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-08-11 11:35:46 +0200 |
commit | 984ae8140d986e93a2fcea5951436e95c8e2c603 (patch) | |
tree | 3a44d5c7889ac77dd463e296a767517f93888f72 /apps/files/js/fileactions.js | |
parent | a5aa03a1a6c0f659c0528253d28c63f759d1ed50 (diff) | |
download | nextcloud-server-984ae8140d986e93a2fcea5951436e95c8e2c603.tar.gz nextcloud-server-984ae8140d986e93a2fcea5951436e95c8e2c603.zip |
Fixed file actions menu to close when reclicking trigger
FileActionsMenu is now a backbone view.
The trigger and highlight handling is now done in the
FileActions.showMenu() method using events.
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 5ec26d8b334..43f74c5816d 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -49,13 +49,6 @@ _fileActionTriggerTemplate: null, /** - * File actions menu - * - * @type OCA.Files.FileActionsMenu - */ - _menu: null, - - /** * @private */ initialize: function() { @@ -333,8 +326,20 @@ * @param {OCA.Files.FileActionContext} context rendering context */ _showMenu: function(fileName, context) { - this._menu = new OCA.Files.FileActionsMenu(); - this._menu.showAt(context); + var menu; + var $trigger = context.$file.closest('tr').find('.fileactions .action-menu'); + $trigger.addClass('open'); + + menu = new OCA.Files.FileActionsMenu(); + menu.$el.on('afterHide', function() { + context.$file.removeClass('mouseOver'); + $trigger.removeClass('open'); + menu.remove(); + }); + + context.$file.addClass('mouseOver'); + context.$file.find('td.filename').append(menu.$el); + menu.show(context); }, /** @@ -378,14 +383,19 @@ a: null }, function(event) { + event.stopPropagation(); + event.preventDefault(); + + if ($actionEl.hasClass('open')) { + return; + } + var $file = $(event.target).closest('tr'); if ($file.hasClass('busy')) { return; } var currentFile = $file.find('td.filename'); var fileName = $file.attr('data-file'); - event.stopPropagation(); - event.preventDefault(); context.fileActions.currentFile = currentFile; // also set on global object for legacy apps |