[toolbars] [design] commonified into common toolbar

This commit is contained in:
Rushabh Mehta 2013-04-19 13:01:32 +05:30
parent d6c8235fb5
commit cc32b65b66
15 changed files with 24 additions and 73 deletions

View File

@ -23,7 +23,7 @@
pscript['onload_Accounts Browser'] = function(wrapper){
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Accounts")
wrapper.appframe.add_module_icon("Accounts")
if (wn.boot.profile.can_create.indexOf("Company") !== -1) {
wrapper.appframe.add_button('New Company', function() { newdoc('Company'); },

View File

@ -25,7 +25,7 @@ wn.pages['financial-analytics'].onload = function(wrapper) {
erpnext.trial_balance = new erpnext.FinancialAnalytics(wrapper, 'Financial Analytics');
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Accounts")
wrapper.appframe.add_module_icon("Accounts")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -24,7 +24,7 @@ wn.pages['general-ledger'].onload = function(wrapper) {
erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Accounts")
wrapper.appframe.add_module_icon("Accounts")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -59,6 +59,6 @@ wn.pages['trial-balance'].onload = function(wrapper) {
erpnext.trial_balance = new TrialBalance(wrapper, 'Trial Balance');
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Accounts")
wrapper.appframe.add_module_icon("Accounts")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -24,7 +24,7 @@ wn.pages['purchase-analytics'].onload = function(wrapper) {
new erpnext.PurchaseAnalytics(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Buying")
wrapper.appframe.add_module_icon("Buying")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -18,75 +18,26 @@
wn.provide('erpnext.toolbar');
erpnext.toolbar.setup = function() {
// modules
erpnext.toolbar.add_modules();
// profile
$('#toolbar-user').append('<li><a href="#Form/Profile/'+user+'">'
var $user = $('#toolbar-user');
$user.append('<li><a href="#Form/Profile/'+user+'">'
+wn._("My Settings")+'...</a></li>');
$user.append('<li class="divider"></li>');
$user.append('<li><a href="https://erpnext.com/manual" target="_blank">'
+wn._('Documentation')+'</a></li>')
$user.append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">'
+wn._('Forum')+'</a></li>')
$user.append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
'+wn._('Live Chat')+'</a></li>')
$('.navbar .pull-right').append('\
<li><a href="#!messages" title="'+wn._('Unread Messages')
+'"><span class="navbar-new-comments"></span></a></li>');
// help
$('.navbar .pull-right').prepend('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
onclick="return false;">'+wn._('Help')+'<b class="caret"></b></a>\
<ul class="dropdown-menu" id="toolbar-help">\
</ul></li>')
$('#toolbar-help').append('<li><a href="https://erpnext.com/manual" target="_blank">'
+wn._('Documentation')+'</a></li>')
$('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">'
+wn._('Forum')+'</a></li>')
$('#toolbar-help').append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
'+wn._('Live Chat')+'</a></li>')
erpnext.toolbar.set_new_comments();
}
erpnext.toolbar.add_modules = function() {
$('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#"\
title="'+wn._("Modules")+'"\
onclick="return false;"><i class="icon-th"></i></a>\
<ul class="dropdown-menu modules">\
</ul>\
</li>').prependTo('.navbar .nav:first');
var modules_list = wn.user.get_desktop_items().sort();
var _get_list_item = function(m) {
args = {
module: m,
module_page: wn.modules[m].link,
module_label: wn._(wn.modules[m].label || m),
icon: wn.modules[m].icon
}
return repl('<li><a href="#!%(module_page)s" \
data-module="%(module)s"><i class="%(icon)s" style="display: inline-block; \
width: 21px; margin-top: -2px; margin-left: -7px;"></i>\
%(module_label)s</a></li>', args);
}
// add to dropdown
$.each(modules_list,function(i, m) {
if(m!='Setup') {
$('.navbar .modules').append(_get_list_item(m));
}
})
// setup for system manager
if(user_roles.indexOf("System Manager")!=-1) {
$('.navbar .modules').append('<li class="divider">' + _get_list_item("Setup"));
}
}
erpnext.toolbar.set_new_comments = function(new_comments) {
var navbar_nc = $('.navbar-new-comments');
if(cint(new_comments)) {

View File

@ -23,7 +23,7 @@ wn.pages['sales-analytics'].onload = function(wrapper) {
new erpnext.SalesAnalytics(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Selling")
wrapper.appframe.add_module_icon("Selling")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -17,7 +17,7 @@
pscript['onload_Sales Browser'] = function(wrapper){
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Selling")
wrapper.appframe.add_module_icon("Selling")
wrapper.appframe.add_button('Refresh', function() {
wrapper.make_tree();

View File

@ -25,7 +25,7 @@ wn.pages['stock-ageing'].onload = function(wrapper) {
new erpnext.StockAgeing(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Stock")
wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -25,7 +25,7 @@ wn.pages['stock-analytics'].onload = function(wrapper) {
new erpnext.StockAnalytics(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Stock")
wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -26,7 +26,7 @@ wn.pages['stock-balance'].onload = function(wrapper) {
new erpnext.StockBalance(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Stock")
wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -24,7 +24,7 @@ wn.pages['stock-ledger'].onload = function(wrapper) {
new erpnext.StockLedger(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Stock")
wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -24,7 +24,7 @@ wn.pages['stock-level'].onload = function(wrapper) {
new erpnext.StockLevel(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Stock")
wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart");
}

View File

@ -8,7 +8,7 @@ wn.pages['support-analytics'].onload = function(wrapper) {
new erpnext.SupportAnalytics(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_breadcrumb("Support")
wrapper.appframe.add_module_icon("Support")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}

View File

@ -18,7 +18,7 @@ pscript['onload_question-view'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
wrapper.appframe.title('Question');
wrapper.appframe.add_home_breadcrumb();
wrapper.appframe.add_module_breadcrumb("Knowledge Base");
wrapper.appframe.add_module_icon("Knowledge Base");
wrapper.appframe.add_breadcrumb("icon-file");
wrapper.add_answer_area = $('.add-answer-area').get(0);