diff --git a/frappe/public/js/frappe/ui/page.js b/frappe/public/js/frappe/ui/page.js index 9de99911f6..0439f5b4ae 100644 --- a/frappe/public/js/frappe/ui/page.js +++ b/frappe/public/js/frappe/ui/page.js @@ -19,6 +19,8 @@ frappe.ui.make_app_page = function(opts) { return opts.parent.page; } +frappe.ui.pages = {}; + frappe.ui.Page = Class.extend({ init: function(opts) { $.extend(this, opts); @@ -29,7 +31,7 @@ frappe.ui.Page = Class.extend({ this.views = {}; this.make(); - + frappe.ui.pages[frappe.get_route_str()] = this; }, make: function() { diff --git a/frappe/public/js/frappe/ui/toolbar/awesome_bar.js b/frappe/public/js/frappe/ui/toolbar/awesome_bar.js index 592bb32991..5e729ab504 100644 --- a/frappe/public/js/frappe/ui/toolbar/awesome_bar.js +++ b/frappe/public/js/frappe/ui/toolbar/awesome_bar.js @@ -20,11 +20,25 @@ frappe.search = { frappe.search.options.sort(function(a, b) { return (a.match || "").length - (b.match || "").length; }); - frappe.search.add_recent(""); - + frappe.search.add_recent(txt || ""); frappe.search.add_help(); - response(frappe.search.options); + // de-duplicate + var out = [], routes = []; + frappe.search.options.forEach(function(option) { + if(option.route) { + var str_route = (typeof option.route==='string') ? + option.route : option.route.join('/'); + if(routes.indexOf(str_route)===-1) { + out.push(option); + routes.push(str_route); + } + } else { + out.push(option); + } + }); + + response(out); }, open: function(event, ui) { frappe.search.autocomplete_open = event.target; @@ -110,7 +124,7 @@ frappe.search = { if(doctype[0]!==":" && !frappe.model.is_table(doctype) && !in_list(frappe.boot.single_types, doctype) && !in_list(["DocType", "DocField", "DocPerm", "Page", "Country", - "Currency", "Page Role", "Print Format"], doctype)) { + "Currency", "Page Role", "Print Format", "Report"], doctype)) { var values = frappe.utils.remove_nulls(frappe.utils.unique( keys(locals[doctype]).concat(frappe.search.recent[doctype] || []) @@ -122,7 +136,7 @@ frappe.search = { value: __(doctype) + " " + match, route: ["Form", doctype, match] } - }); + }, true); } } }, @@ -146,13 +160,18 @@ frappe.search = { frappe.search.recent[d[0]].push(d[1]); } }, - find: function(list, txt, process) { + find: function(list, txt, process, prepend) { $.each(list, function(i, item) { _item = __(item).toLowerCase().replace(/-/g, " "); if(txt===_item || _item.indexOf(txt) !== -1) { var option = process(item); option.match = item; - frappe.search.options.push(option); + + if(prepend) { + frappe.search.options = [option].concat(frappe.search.options); + } else { + frappe.search.options.push(option); + } } }); } diff --git a/frappe/public/js/frappe/views/container.js b/frappe/public/js/frappe/views/container.js index 5c1939caf1..d21ebbee9c 100644 --- a/frappe/public/js/frappe/views/container.js +++ b/frappe/public/js/frappe/views/container.js @@ -19,7 +19,13 @@ frappe.views.Container = Class.extend({ $(document).on("page-change", function() { // set data-route in body - $("body").attr("data-route", frappe.get_route_str()); + var route_str = frappe.get_route_str(); + $("body").attr("data-route", route_str); + var has_sidebar = false; + if(frappe.ui.pages[route_str] && !frappe.ui.pages[route_str].single_column) { + has_sidebar = true; + } + $("body").attr("data-sidebar", has_sidebar ? 1 : 0); }); $(document).bind('rename', function(event, dt, old_name, new_name) { diff --git a/frappe/templates/autodoc/base_template.html b/frappe/templates/autodoc/base_template.html index 0ffc010f0b..9a86c1297a 100644 --- a/frappe/templates/autodoc/base_template.html +++ b/frappe/templates/autodoc/base_template.html @@ -64,7 +64,7 @@ {%- if footer is defined -%}{{ footer }}{%- endif -%}
- +

By {{ app.publisher }}