From a38bbe28cef6ef741ac64da57b871062c438badf Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 29 Feb 2012 10:55:43 +0530 Subject: [PATCH] home page fixes --- erpnext/home/page/desktop/desktop.js | 75 ++++++++----------- .../setup/page/modules_setup/modules_setup.js | 4 +- erpnext/startup/startup.js | 18 +++++ erpnext/startup/toolbar.js | 20 ++--- index.cgi | 2 +- js/all-app.js | 11 +-- js/all-web.js | 3 +- version.num | 2 +- 8 files changed, 73 insertions(+), 62 deletions(-) diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js index ebd3da1dda..63a075ceb2 100644 --- a/erpnext/home/page/desktop/desktop.js +++ b/erpnext/home/page/desktop/desktop.js @@ -43,61 +43,50 @@ erpnext.desktop.add_classes = function() { } erpnext.desktop.render = function() { - var icons = [ - { gradient: 'blue', sprite: 'account', label: 'Accounts', link: '#!accounts-home', - is_module: 'Accounts'}, - { gradient: 'green', sprite: 'selling', label: 'Selling', link: '#!selling-home', - is_module: 'Selling'}, - { gradient: 'yellow', sprite: 'stock', label: 'Stock', link: '#!stock-home', - is_module: 'Stock'}, - { gradient: 'red', sprite: 'buying', label: 'Buying', link: '#!buying-home', - is_module: 'Buying'}, - { gradient: 'purple', sprite: 'support', label: 'Support', link: '#!support-home', - is_module: 'Support'}, - { gradient: 'ocean', sprite: 'hr', label: 'Human
Resources', link: '#!hr-home', - is_module: 'HR'}, - { gradient: 'violet', sprite: 'project', label: 'Projects', link: '#!projects-home', - is_module: 'Projects'}, - { gradient: 'dark-red', sprite: 'production', label: 'Production', link: '#!production-home', - is_module: 'Production'}, - { gradient: 'leaf-green', sprite: 'website', label: 'Website', link: '#!website-home', - is_module: 'Website'}, - ] + var icons = { + 'Accounts': { gradient: 'blue', sprite: 'account', label: 'Accounts'}, + 'Selling': { gradient: 'green', sprite: 'selling', label: 'Selling'}, + 'Stock': { gradient: 'yellow', sprite: 'stock', label: 'Stock'}, + 'Buying': { gradient: 'red', sprite: 'buying', label: 'Buying'}, + 'Support': { gradient: 'purple', sprite: 'support', label: 'Support'}, + 'HR': { gradient: 'ocean', sprite: 'hr', label: 'Human
Resources'}, + 'Projects': { gradient: 'violet', sprite: 'project', label: 'Projects'}, + 'Production': { gradient: 'dark-red', sprite: 'production', label: 'Production'}, + 'Website': { gradient: 'leaf-green', sprite: 'website', label: 'Website'}, + 'Activity': { gradient: 'brown', sprite: 'feed', label: 'Activity'}, + 'Setup': { gradient: 'grey', sprite: 'setting', label: 'Setup'}, + 'Dashboard': { gradient: 'bright-green', sprite: 'dashboard', label: 'Dashboard'}, + 'To Do': { gradient: 'bright-yellow', sprite: 'todo', label: 'To Do'}, + 'Messages': { gradient: 'pink', sprite: 'messages', label: 'Messages'}, + 'Calendar': { gradient: 'peacock', sprite: 'calendar', label: 'Calendar'}, + 'Knowledge Base': { gradient: 'ultra-dark-green', sprite: 'kb', label: 'Knowledge
Base'} + } + - var add_icon = function(v) { + var add_icon = function(m) { + var icon = icons[m]; + icon.link = erpnext.modules[m]; $('#icon-grid').append(repl('\ -
\ +
\
\
\
\
%(label)s
\ -
', v)); +
', icon)); } - var get_module = function(m) { - for(var i in icons) { - if(icons[i].is_module==m) return icons[i] - } - } - - // activity - add_icon({ gradient: 'brown', sprite: 'feed', label: 'Activity', link: '#!Event Updates'}); - - // modules - for(var i in wn.boot.modules_list) - add_icon(get_module(wn.boot.modules_list[i])); - // setup + + for(var i in wn.boot.modules_list) { + var m = wn.boot.modules_list[i]; + if(m!='Setup'); + add_icon(m); + } + if(user_roles.indexOf('System Manager')!=-1) - add_icon({ gradient: 'grey', sprite: 'setting', label: 'Setup', link: '#!Setup' }); + add_icon('Setup') // apps - add_icon({ gradient: 'bright-green', sprite: 'dashboard', label: 'Dashboard', link: '#!dashboard' }); - add_icon({ gradient: 'bright-yellow', sprite: 'todo', label: 'To Do', link: '#!todo' }); - add_icon({ gradient: 'pink', sprite: 'messages', label: 'Messages', link: '#!messages' }); - add_icon({ gradient: 'peacock', sprite: 'calendar', label: 'Calendar', link: '#!calendar' }); - add_icon({ gradient: 'ultra-dark-green', sprite: 'kb', label: 'Knowledge
Base', link: '#!questions' }); - erpnext.desktop.show_pending_notifications(); } diff --git a/erpnext/setup/page/modules_setup/modules_setup.js b/erpnext/setup/page/modules_setup/modules_setup.js index fe7f14fad3..af7522f4ae 100644 --- a/erpnext/setup/page/modules_setup/modules_setup.js +++ b/erpnext/setup/page/modules_setup/modules_setup.js @@ -1,8 +1,8 @@ wn.require('lib/js/lib/jquery-ui-sortable.min.js'); $.extend(wn.pages.modules_setup, { - modules: ['Accounts', 'Selling', 'Buying', 'Stock', 'Production', 'Projects', - 'Support', 'HR', 'Website'], + modules: ['Activity', 'Accounts', 'Selling', 'Buying', 'Stock', 'Production', 'Projects', + 'Support', 'HR', 'Website', 'To Do', 'Messages', 'Calendar', 'Knowledge Base'], onload: function(wrapper) { wn.pages.modules_setup.refresh(wn.boot.modules_list); }, diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 83b1685f55..30ab28d53b 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -19,6 +19,24 @@ var is_system_manager = 0; wn.provide('erpnext.startup'); +erpnext.modules = { + 'Selling': 'selling-home', + 'Accounts': 'accounts-home', + 'Stock': 'stock-home', + 'Buying': 'buying-home', + 'Support': 'support-home', + 'Projects': 'projects-home', + 'Production': 'production-home', + 'Website': 'website-home', + 'HR': 'hr-home', + 'Setup': 'Setup', + 'Activity': 'Event Updates', + 'To Do': 'todo', + 'Calendar': 'calendar', + 'Messages': 'messages', + 'Knowledge Base': 'questions' +} + erpnext.startup.set_globals = function() { pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway) if(inList(user_roles,'System Manager')) is_system_manager = 1; diff --git a/erpnext/startup/toolbar.js b/erpnext/startup/toolbar.js index 8c8d04167e..1a2bfdfe9a 100644 --- a/erpnext/startup/toolbar.js +++ b/erpnext/startup/toolbar.js @@ -81,20 +81,22 @@ erpnext.toolbar.add_modules = function() { if(wn.boot.modules_list) wn.boot.modules_list = JSON.parse(wn.boot.modules_list); else - wn.boot.modules_list = ['Accounts', 'Selling', 'Buying', 'Stock', - 'Production', 'Projects', 'Support', 'HR', 'Website']; + wn.boot.modules_list = keys(erpnext.modules).sort(); // add to dropdown for(var i in wn.boot.modules_list) { var m = wn.boot.modules_list[i] - args = { - module: m, - module_page: m.toLowerCase(), - module_label: m=='HR' ? 'Human Resources' : m + + if(m!='Setup') { + args = { + module: m, + module_page: erpnext.modules[m], + module_label: m=='HR' ? 'Human Resources' : m + } + + $('.navbar .modules').append(repl('
  • %(module_label)s
  • ', args)); } - - $('.navbar .modules').append(repl('
  • %(module_label)s
  • ', args)); } // setup for system manager diff --git a/index.cgi b/index.cgi index 301f395d44..ed766eb11f 100755 --- a/index.cgi +++ b/index.cgi @@ -40,7 +40,7 @@ def init(): webnotes.http_request = webnotes.auth.HTTPRequest() return True except webnotes.AuthenticationError, e: - pass + return True except webnotes.UnknownDomainError, e: print "Location: " + (webnotes.defs.redirect_404) except webnotes.SessionStopped, e: diff --git a/js/all-app.js b/js/all-app.js index cd563f14c3..62d63ce67f 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -2192,7 +2192,8 @@ wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',f /* * erpnext/startup/startup.js */ -var current_module;var is_system_manager=0;wn.provide('erpnext.startup');erpnext.startup.set_globals=function(){pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway) +var current_module;var is_system_manager=0;wn.provide('erpnext.startup');erpnext.modules={'Selling':'selling-home','Accounts':'accounts-home','Stock':'stock-home','Buying':'buying-home','Support':'support-home','Projects':'projects-home','Production':'production-home','Website':'website-home','HR':'hr-home','Setup':'Setup','Activity':'Event Updates','To Do':'todo','Calendar':'calendar','Messages':'messages','Knowledge Base':'questions'} +erpnext.startup.set_globals=function(){pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway) if(inList(user_roles,'System Manager'))is_system_manager=1;} erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.custom_css){set_style(wn.boot.custom_css);} if(user=='Guest'){if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('