Permalink
Browse files

Fix different mimes in a unique table, check action.selectionContext.…

…allowedMimes
  • Loading branch information...
1 parent c3688e9 commit e42bbf20065a2b97632656a7be392f667b188c64 @cdujeu cdujeu committed Jul 20, 2016
Showing with 7 additions and 5 deletions.
  1. +7 −5 core/src/plugins/gui.ajax/res/js/ui/reactjs/jsx/ReactPydioComponents.js
@@ -1127,6 +1127,9 @@
}
if(this.props.node){
additionalClassName += ' listentry' + this.props.node.getPath().replace(/\//g, '_') + ' ' + ' ajxp_node_' + (this.props.node.isLeaf()?'leaf':'collection') + ' ';
+ if(this.props.node.getAjxpMime()){
+ additionalClassName += ' ajxp_mime_' + this.props.node.getAjxpMime() + ' ';
+ }
}
return (
<div onClick={this.onClick} className={additionalClassName + "material-list-entry material-list-entry-" + (this.props.thirdLine?3:this.props.secondLine?2:1) + "-lines"+ (this.props.selected? " selected":"")}>
@@ -1567,18 +1570,18 @@
},
getActionsForNode: function(dm, node){
- var cacheKey = node.isLeaf() ? 'file':'dir';
-
+ var cacheKey = node.isLeaf() ? 'file-' + node.getAjxpMime() :'folder';
+ var selectionType = node.isLeaf() ? 'file' : 'dir';
var nodeActions = [];
if(this.actionsCache[cacheKey]) {
nodeActions = this.actionsCache[cacheKey];
}else{
dm.setSelectedNodes([node]);
global.pydio.Controller.actions.forEach(function(a){
a.fireContextChange(dm, true, global.pydio.user);
- //a.fireSelectionChange(dm);
- if(a.context.selection && a.context.actionBar && a.selectionContext[cacheKey] && !a.deny && a.options.icon_class
+ if(a.context.selection && a.context.actionBar && a.selectionContext[selectionType] && !a.deny && a.options.icon_class
&& (!this.props.actionBarGroups || this.props.actionBarGroups.indexOf(a.context.actionBarGroup) !== -1)
+ && (!a.selectionContext.allowedMimes.length || a.selectionContext.allowedMimes.indexOf(node.getAjxpMime()) !== -1)
) {
nodeActions.push(a);
if(node.isLeaf() && a.selectionContext.unique === false) {
@@ -1588,7 +1591,6 @@
}.bind(this));
this.actionsCache[cacheKey] = nodeActions;
}
-
return nodeActions;
},

0 comments on commit e42bbf2

Please sign in to comment.