summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-05 12:48:42 +0200
committerVincent Petry <pvince81@owncloud.com>2015-08-10 14:12:34 +0200
commit9454e9043a7b18108f14a00d6ab8afa62fb894af (patch)
tree8458931b8d187f1378baf65058679f7993943011 /apps/files/js
parentdd4e0a8253d108e8b9cf9444990164d66b3d75f0 (diff)
downloadnextcloud-server-9454e9043a7b18108f14a00d6ab8afa62fb894af.tar.gz
nextcloud-server-9454e9043a7b18108f14a00d6ab8afa62fb894af.zip
Updated unit tests for file actions and actions menu
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/fileactions.js8
-rw-r--r--apps/files/js/fileactionsmenu.js14
2 files changed, 11 insertions, 11 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 6b95e3ee6cd..0d9161c6eb4 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -332,10 +332,8 @@
* @param {OCA.Files.FileActionContext} context rendering context
*/
_showMenu: function(fileName, context) {
- var $actionEl = context.$file.find('.action-menu');
-
this._menu = new OCA.Files.FileActionsMenu();
- this._menu.showAt($actionEl, context);
+ this._menu.showAt(context);
},
/**
@@ -433,7 +431,7 @@
nameLinks = parent.children('a.name');
nameLinks.find('.fileactions, .nametext .action').remove();
nameLinks.append('<span class="fileactions" />');
- var defaultAction = this.getDefault(
+ var defaultAction = this.getDefaultFileAction(
this.getCurrentMimeType(),
this.getCurrentType(),
this.getCurrentPermissions()
@@ -449,7 +447,7 @@
if (actionSpec.type === FileActions.TYPE_INLINE) {
self._renderInlineAction(
actionSpec,
- actionSpec.action === defaultAction,
+ defaultAction && actionSpec.name === defaultAction.name,
context
);
}
diff --git a/apps/files/js/fileactionsmenu.js b/apps/files/js/fileactionsmenu.js
index dabf530b177..1795fdeab11 100644
--- a/apps/files/js/fileactionsmenu.js
+++ b/apps/files/js/fileactionsmenu.js
@@ -42,7 +42,7 @@
/**
* @private
*/
- initialize: function(fileActions, fileList) {
+ initialize: function() {
this.$el = $('<div class="fileActionsMenu dropdown hidden menu"></div>');
this._template = Handlebars.compile(TEMPLATE_MENU);
@@ -50,6 +50,10 @@
this.$el.on('afterHide', _.bind(this._onHide, this));
},
+ destroy: function() {
+ this.$el.remove();
+ },
+
/**
* Event handler whenever an action has been clicked within the menu
*
@@ -118,17 +122,15 @@
/**
* Displays the menu under the given element
*
- * @param {Object} $el target element
* @param {OCA.Files.FileActionContext} context context
*/
- showAt: function($el, context) {
+ showAt: function(context) {
this._context = context;
this.render();
this.$el.removeClass('hidden');
- $el.closest('td').append(this.$el);
-
+ context.$file.find('td.filename').append(this.$el);
context.$file.addClass('mouseOver');
OC.showMenu(null, this.$el);
@@ -139,7 +141,7 @@
*/
_onHide: function() {
this._context.$file.removeClass('mouseOver');
- this.$el.remove();
+ this.destroy();
}
};