home page fixes

This commit is contained in:
Rushabh Mehta 2012-02-29 10:55:43 +05:30
parent 17da764d04
commit a38bbe28ce
8 changed files with 73 additions and 62 deletions

View File

@ -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<br />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<br />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<br />Base'}
}
var add_icon = function(v) {
var add_icon = function(m) {
var icon = icons[m];
icon.link = erpnext.modules[m];
$('#icon-grid').append(repl('\
<div id="%(sprite)s" class="case-wrapper"><a href="%(link)s">\
<div id="%(sprite)s" class="case-wrapper"><a href="#!%(link)s">\
<div class="case-border case-%(gradient)s">\
<div class="sprite-image sprite-%(sprite)s"></div>\
</div></a>\
<div class="case-label">%(label)s</div>\
</div>', v));
</div>', 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<br />Base', link: '#!questions' });
erpnext.desktop.show_pending_notifications();
}

View File

@ -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);
},

View File

@ -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;

View File

@ -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('<li><a href="#!%(module_page)s" \
data-module="%(module)s">%(module_label)s</a></li>', args));
}
$('.navbar .modules').append(repl('<li><a href="#!%(module_page)s-home" \
data-module="%(module)s">%(module_label)s</a></li>', args));
}
// setup for system manager

View File

@ -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:

View File

@ -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('<div class="web-footer erpnext-footer">\
@ -2244,10 +2245,10 @@ erpnext.toolbar.add_modules=function(){$('<li class="dropdown">\
</ul>\
</li>').prependTo('.navbar .nav:first');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'];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}
$('.navbar .modules').append(repl('<li><a href="#!%(module_page)s-home" \
data-module="%(module)s">%(module_label)s</a></li>',args));}
wn.boot.modules_list=keys(erpnext.modules).sort();for(var i in wn.boot.modules_list){var m=wn.boot.modules_list[i]
if(m!='Setup'){args={module:m,module_page:erpnext.modules[m],module_label:m=='HR'?'Human Resources':m}
$('.navbar .modules').append(repl('<li><a href="#!%(module_page)s" \
data-module="%(module)s">%(module_label)s</a></li>',args));}}
if(user_roles.indexOf("System Manager")!=-1){$('.navbar .modules').append('<li class="divider"></li>\
<li><a href="#!Setup" data-module="Setup">Setup</a></li>');}}
/*

View File

@ -1040,7 +1040,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('<div class="web-footer erpnext-footer">\

View File

@ -1 +1 @@
752
753