diff --git a/core/doctype/profile/profile.js b/core/doctype/profile/profile.js index 59bacdb85f..137747f48f 100644 --- a/core/doctype/profile/profile.js +++ b/core/doctype/profile/profile.js @@ -1,5 +1,4 @@ cur_frm.cscript.onload = function(doc) { - cur_frm.frm_head.appframe.remove_tabs(); if(!cur_frm.roles_editor) { var role_area = $('
') .appendTo(cur_frm.fields_dict.roles_html.wrapper); diff --git a/public/css/ui/appframe.css b/public/css/ui/appframe.css index 6a8b0a34d9..0b28842ca8 100644 --- a/public/css/ui/appframe.css +++ b/public/css/ui/appframe.css @@ -3,7 +3,7 @@ div.appframe-titlebar { padding: 6px; padding-left: 13px; background: #dfdfdf; /* Old browsers */ - height: 30px; + height: 28px; color: #555; border-bottom: 1px solid #c2c2c2; vertical-align: middle; @@ -18,6 +18,36 @@ div.appframe-titlebar { width: 60%; } +span.appframe-breadcrumb { + display: inline-block; + margin: 5px 0px 0px 0px; + padding: 0px; + float: left; +} +span.appframe-breadcrumb span { + display: inline-block; + padding: 4px 19px 0px 0px; + margin-right: 13px; + background: url('../lib/images/ui/navbarsep.png') right no-repeat; + margin-top: -4px; + color: #777; + font-size: 20px; +} + +span.appframe-breadcrumb span:last-child { + background: none; +} + +.appframe-breadcrumb span a { + color: #777; + text-decoration: none; +} + +.appframe-breadcrumb span a:hover { + color: #999; +} + + .appframe-title { font-size: 150%; text-overflow: ellipsis; @@ -62,7 +92,7 @@ span.appframe-tab { margin-top: -6px; padding: 12px 11px; height: 18px; - vertical-align: middle; + /*vertical-align: middle;*/ cursor: pointer; } diff --git a/public/images/ui/navbarsep.png b/public/images/ui/navbarsep.png new file mode 100644 index 0000000000..86e54b2b17 Binary files /dev/null and b/public/images/ui/navbarsep.png differ diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index d27b29a5b1..dfba099619 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -982,7 +982,7 @@ _f.Frm.prototype.disable_save = function() { // IMPORTANT: this function should be called in refresh event cur_frm.save_disabled = true; cur_frm.page_layout.footer.hide_save(); - cur_frm.frm_head.appframe.buttons.Save.toggle(false); + cur_frm.frm_head.appframe.buttons.Save.remove(); } _f.get_value = function(dt, dn, fn) { diff --git a/public/js/legacy/widgets/form/form_header.js b/public/js/legacy/widgets/form/form_header.js index ee05e4a2ce..f56006c214 100644 --- a/public/js/legacy/widgets/form/form_header.js +++ b/public/js/legacy/widgets/form/form_header.js @@ -33,12 +33,13 @@ _f.FrmHeader = Class.extend({ this.$w = this.appframe.$w; this.frm = frm; + this.appframe.add_home_breadcrumb(); + this.appframe.add_module_breadcrumb(frm.meta.module) + if(!frm.meta.issingle) { - this.appframe.add_tab(frm.doctype + " List", 0.5, function() { - wn.set_route("List", frm.doctype); - }); + this.appframe.add_list_breadcrumb(frm.meta.name) } - this.appframe.add_module_tab(frm.meta.module); + this.appframe.add_breadcrumb("icon-file"); }, refresh: function() { this.appframe.set_title(this.frm.docname); diff --git a/public/js/wn/misc/utils.js b/public/js/wn/misc/utils.js index dc49440ce9..1e3b479bb1 100644 --- a/public/js/wn/misc/utils.js +++ b/public/js/wn/misc/utils.js @@ -2,7 +2,7 @@ wn.provide('wn.utils'); wn.utils = { get_file_link: function(filename) { - return wn.utils.is_url(filename) || (filename.indexOf("images/")!=-1) + return wn.utils.is_url(filename) || (filename.indexOf("images/")!=-1) || (filename.indexOf("files/")!=-1) ? filename : 'files/' + filename; }, is_url: function(txt) { diff --git a/public/js/wn/ui/appframe.js b/public/js/wn/ui/appframe.js index 5cc5b0bd6c..0a0f4e3dae 100644 --- a/public/js/wn/ui/appframe.js +++ b/public/js/wn/ui/appframe.js @@ -5,7 +5,8 @@ wn.ui.AppFrame = Class.extend({ this.$w = $('
').appendTo(parent); this.$titlebar = $('
\ -
\ + \ + \ \ \ \ @@ -19,6 +20,7 @@ wn.ui.AppFrame = Class.extend({ if(title) this.set_title(title); + }, title: function(txt) { this.set_title(txt); @@ -28,27 +30,36 @@ wn.ui.AppFrame = Class.extend({ document.title = txt; this.$titlebar.find(".appframe-title").html(txt); }, - add_tab: function(tab_name, opacity, click) { - var span = $('') - .html(tab_name).insertAfter(this.$titlebar.find(".close")); - opacity && span.css("opacity", opacity); - click && span.click(click); - return span + clear_breadcrumbs: function() { + this.$w.find(".appframe-breadcrumb").empty(); }, - - remove_tabs: function() { - this.$w.find(".appframe-tab").remove(); + add_breadcrumb: function(icon, link, title) { + if(link) { + $(repl("\ + ", { + icon: icon, + link: link, + title: title + })).appendTo(this.$w.find(".appframe-breadcrumb")); + } else { + $(repl("", { + icon: icon, + })).appendTo(this.$w.find(".appframe-breadcrumb")); + } }, - - add_module_tab: function(module) { - if(!wn.modules[module]) return; - this.add_tab(''+' ' - + wn._(module) + "", 0.7, function() { - wn.set_route(wn.modules[module].link); - }); + add_home_breadcrumb: function() { + this.add_breadcrumb("icon-home", wn.home_page, "Home"); + }, + add_list_breadcrumb: function(doctype) { + this.add_breadcrumb("icon-list", "List/" + encodeURIComponent(doctype), doctype + " List"); + }, + add_module_breadcrumb: function(module) { + var module_info = wn.modules[module]; + if(module_info) { + this.add_breadcrumb(module_info.icon, module_info.link, + module_info.label || module); + } }, - add_button: function(label, click, icon) { this.add_toolbar(); args = { label: label, icon:'' }; diff --git a/public/js/wn/views/doclistview.js b/public/js/wn/views/doclistview.js index 7530b02151..0d9f0ebe39 100644 --- a/public/js/wn/views/doclistview.js +++ b/public/js/wn/views/doclistview.js @@ -82,7 +82,9 @@ wn.views.DocListView = wn.ui.Listing.extend({ var module = locals.DocType[this.doctype].module; this.appframe.set_title(this.doctype + " List"); - this.appframe.add_module_tab(module); + this.appframe.add_home_breadcrumb(); + this.appframe.add_module_breadcrumb(module); + this.appframe.add_breadcrumb("icon-list"); }, setup: function() { diff --git a/public/js/wn/views/reportview.js b/public/js/wn/views/reportview.js index 080f4dc129..5f59dc461d 100644 --- a/public/js/wn/views/reportview.js +++ b/public/js/wn/views/reportview.js @@ -28,7 +28,9 @@ wn.views.ReportViewPage = Class.extend({ make_report_view: function() { var module = locals.DocType[this.doctype].module; this.page.appframe.set_title(this.doctype); - this.page.appframe.add_module_tab(module); + this.page.appframe.add_home_breadcrumb() + this.page.appframe.add_module_breadcrumb(module) + this.page.appframe.add_breadcrumb("icon-table"); this.page.reportview = new wn.views.ReportView({ doctype: this.doctype,