Commit 10bee47a authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

FileManager: added openWith contextmenu to navbar

parent 87691966
<li
@click="navi"
@contextmenu="openMenu"
:class="{
'dropok': dropok
}"
......
......@@ -117,7 +117,7 @@ define([
var sel = this.selectedItems;
if (sel.length && (!info.data || sel.filter(function (it) {
return it.name == info.data.name;
}).length)) {
}).length) && !info.pathBase) {
ext.items = sel;
} else if(info.data) {
ext.items = [info.data];
......@@ -125,7 +125,7 @@ define([
// add other info
ext.view = this.view;
ext.wsId = ext.view.workspaceId;
ext.pathBase = this.path;
ext.pathBase = info.pathBase || this.path;
// add hook entry point fo us
ext._f2br = this;
return $.extend({}, info, ext);
......
......@@ -109,6 +109,14 @@ define([
dropFilter: function(ev) {
return dropFilter(ev, this.workspaceId, this.fullPath);
},
openMenu: function(ev) {
this.$dispatch("openMenu", {
pathBase: this.fullPath,
menuPP: function(menu) {
return (menu.openWith || {}).items;
},
}, ev);
},
},
events: {
dropped: function(data, ev) {
......
......@@ -24,10 +24,10 @@ define([
var menu = this._filterMenu(this.handlersBase, info);
// need the open with menu?
if (!info.data) { // nothing directly hit (just in a folder)
var n, p = info.pathBase.split("/");
while(!n && p)
n = p.pop();
info.pathBase = p.join("/");
var n = "", p = info.pathBase.split("/");
while((n = p.pop()) == "");
info.pathBase = p.join("/") || "/";
n = n || "/";
info.data = {
root: n,
name: n,
......@@ -46,6 +46,8 @@ define([
// add divider
menu.divider1 = {divider: true, position: 10};
menu.divider2 = {divider: true, position: 100};
if (info.menuPP)
menu = info.menuPP(menu) || {};
return menu;
},
action: function(what, info) {
......@@ -124,7 +126,7 @@ define([
M.clsBib.single = M.clsBib.base._extend({
fullPath: function (info) {
return info.pathBase + "/" + info.data.name;
return (info.pathBase + "/" + info.data.name).replace(/\/+/g, "/");
},
ext: function (info) {
if (!info.data) return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment