Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ a.action > img {
opacity: .3;
&.action-share {
padding: 17px 14px;
> span:not(.icon) {
display: none;
}
.avatar {
display: inline-block;
vertical-align: middle;
Expand Down Expand Up @@ -936,6 +939,18 @@ table.dragshadow td.size {
}
}

.fileActionsMenu {
// force show the sharing entry in the dropdown menu
.action-share-container.hidden {
display: block !important;
// avatar in shared by user dropdown menu
.action-share img {
padding: 6px;
border-radius: 50%;
}
}
}

form {
padding: 3px 14px;
border-radius: var(--border-radius);
Expand Down
12 changes: 8 additions & 4 deletions apps/files/js/fileactionsmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@
);

var items = _.filter(actions, function(actionSpec) {
return (
actionSpec.type === OCA.Files.FileActions.TYPE_DROPDOWN &&
(!defaultAction || actionSpec.name !== defaultAction.name)
);
return !defaultAction || actionSpec.name !== defaultAction.name;
});
items = _.map(items, function(item) {
if (_.isFunction(item.displayName)) {
Expand All @@ -99,6 +96,12 @@
item = _.extend({}, item);
item.iconClass = item.iconClass(fileName, self._context);
}
if (_.isFunction(item.icon)) {
var fileName = self._context.$file.attr('data-file');
item = _.extend({}, item);
item.icon = item.icon(fileName, self._context);
}
item.inline = item.type === OCA.Files.FileActions.TYPE_INLINE
return item;
});
items = items.sort(function(actionA, actionB) {
Expand All @@ -109,6 +112,7 @@
}
return orderA - orderB;
});

items = _.map(items, function(item) {
item.nameLowerCase = item.name.toLowerCase();
return item;
Expand Down
18 changes: 12 additions & 6 deletions apps/files/js/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,38 @@ templates['file_action_trigger'] = template({"1":function(container,depth0,helpe
templates['fileactionsmenu'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

return " <li>\n <a href=\"#\" class=\"menuitem action action-"
return " <li class=\""
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.inline : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " action-"
+ alias4(((helper = (helper = helpers.nameLowerCase || (depth0 != null ? depth0.nameLowerCase : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"nameLowerCase","hash":{},"data":data}) : helper)))
+ "-container\">\n <a href=\"#\" class=\"menuitem action action-"
+ alias4(((helper = (helper = helpers.nameLowerCase || (depth0 != null ? depth0.nameLowerCase : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"nameLowerCase","hash":{},"data":data}) : helper)))
+ " permanent\" data-action=\""
+ alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
+ "\">\n "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : "")
+ " <span>"
+ alias4(((helper = (helper = helpers.displayName || (depth0 != null ? depth0.displayName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"displayName","hash":{},"data":data}) : helper)))
+ "</span>\n </a>\n </li>\n";
},"2":function(container,depth0,helpers,partials,data) {
return "hidden";
},"4":function(container,depth0,helpers,partials,data) {
var helper;

return "<img class=\"icon\" src=\""
+ container.escapeExpression(((helper = (helper = helpers.icon || (depth0 != null ? depth0.icon : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"icon","hash":{},"data":data}) : helper)))
+ "\"/>\n";
},"4":function(container,depth0,helpers,partials,data) {
},"6":function(container,depth0,helpers,partials,data) {
var stack1;

return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : "");
},"5":function(container,depth0,helpers,partials,data) {
return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : "");
},"7":function(container,depth0,helpers,partials,data) {
var helper;

return " <span class=\"icon "
+ container.escapeExpression(((helper = (helper = helpers.iconClass || (depth0 != null ? depth0.iconClass : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"iconClass","hash":{},"data":data}) : helper)))
+ "\"></span>\n";
},"7":function(container,depth0,helpers,partials,data) {
},"9":function(container,depth0,helpers,partials,data) {
return " <span class=\"no-icon\"></span>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var stack1;
Expand Down
2 changes: 1 addition & 1 deletion apps/files/js/templates/fileactionsmenu.handlebars
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ul>
{{#each items}}
<li>
<li class="{{#if inline}}hidden{{/if}} action-{{nameLowerCase}}-container">
<a href="#" class="menuitem action action-{{nameLowerCase}} permanent" data-action="{{name}}">
{{#if icon}}<img class="icon" src="{{icon}}"/>
{{else}}
Expand Down
7 changes: 5 additions & 2 deletions apps/files/tests/js/fileactionsmenuSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ describe('OCA.Files.FileActionsMenu tests', function() {
it('does not render default actions', function() {
expect(menu.$el.find('a[data-action=Testdefault]').length).toEqual(0);
});
it('does not render inline actions', function() {
expect(menu.$el.find('a[data-action=Testinline]').length).toEqual(0);
it('render inline actions', function() {
expect(menu.$el.find('a[data-action=Testinline]').length).toEqual(1);
});
it('render inline actions but it is hidden', function() {
expect(menu.$el.find('a[data-action=Testinline]').parent().hasClass('hidden')).toEqual(true);
});
it('only renders actions relevant to the mime type', function() {
fileActions.registerAction({
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/additionalScripts.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/additionalScripts.js.map

Large diffs are not rendered by default.

Loading