浏览代码

[minor] add calendar, gantt views in awesome bar fixes frappe/erpnext#4479

version-14
Rushabh Mehta 8 年前
父节点
当前提交
8176799873
共有 1 个文件被更改,包括 45 次插入7 次删除
  1. +45
    -7
      frappe/public/js/frappe/ui/toolbar/awesome_bar.js

+ 45
- 7
frappe/public/js/frappe/ui/toolbar/awesome_bar.js 查看文件

@@ -167,12 +167,16 @@ frappe.search = {
var option = process(item); var option = process(item);


if(option) { if(option) {
option.match = item;
if($.isPlainObject(option)) {
option = [option];
}

option.forEach(function(o) { o.match = item; });


if(prepend) { if(prepend) {
frappe.search.options = [option].concat(frappe.search.options);
frappe.search.options = option.concat(frappe.search.options);
} else { } else {
frappe.search.options.push(option);
frappe.search.options = frappe.search.options.concat(option);
} }
} }
} }
@@ -237,11 +241,34 @@ frappe.search.verbs = [
route:["Tree", match] route:["Tree", match]
} }
} else { } else {
return {
label: __("{0} List", [__(match).bold()]),
value: __("{0} List", [__(match)]),
route:["List", match]
out = [
{
label: __("{0} List", [__(match).bold()]),
value: __("{0} List", [__(match)]),
route:["List", match]
},
];
if(frappe.model.can_get_report(match)) {
out.push({
label: __("{0} Report", [__(match).bold()]),
value: __("{0} Report", [__(match)]),
route:["Report", match]
});
}
if(frappe.boot.calendars.indexOf(match) !== -1) {
out.push({
label: __("{0} Calendar", [__(match).bold()]),
value: __("{0} Calendar", [__(match)]),
route:["Calendar", match]
});

out.push({
label: __("{0} Gantt", [__(match).bold()]),
value: __("{0} Gantt", [__(match)]),
route:["List", match, "Gantt"]
});
} }
return out;
} }
}); });
}, },
@@ -273,6 +300,17 @@ frappe.search.verbs = [
route: [frappe.search.pages[match].route || frappe.search.pages[match].name] route: [frappe.search.pages[match].route || frappe.search.pages[match].name]
} }
}); });

// calendar
var match = 'Calendar';
if(__('calendar').indexOf(txt.toLowerCase()) === 0) {
frappe.search.options.push({
label: __("Open {0}", [__(match).bold()]),
value: __("Open {0}", [__(match)]),
route: [match, 'Event'],
match: match
});
}
}, },


// modules // modules


正在加载...
取消
保存