fixes to dashboard and setup wizard

This commit is contained in:
Rushabh Mehta
2011-08-30 13:24:49 +05:30
parent 96fde953bc
commit ae5cdeb472
4 changed files with 100 additions and 81 deletions

View File

@@ -25,12 +25,7 @@ pscript.home_make_body = function() {
wrapper.banner_area = $a(wrapper.head, 'div');
wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard')
wrapper.system_message_area = $a(wrapper.body, 'div', '',
{marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'})
wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard');
}
// ==================================
@@ -613,11 +608,7 @@ pscript.home_make_status = function() {
$c_page('home', 'event_updates', 'get_status_details', user,
function(r,rt) {
home_status_bar.render(r.message);
// system_messages
if(r.message.system_message)
pscript.show_system_message(wrapper, r.message.system_message);
// render online users
pscript.online_users_obj.render(r.message.online_users);
pscript.online_users = r.message.online_users;
@@ -630,24 +621,6 @@ pscript.home_make_status = function() {
);
}
// show system message
// -------------------
pscript.show_system_message = function(wrapper, msg) {
$ds(wrapper.system_message_area);
var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'});
txt.innerHTML = msg;
var span = $ln($a(wrapper.system_message_area, 'div', '', {textAlign:'right'}), 'Dismiss'.bold(),
function(me) {
me.set_working();
$c_obj('Home Control', 'dismiss_message', '', function(r,rt) {
me.done_working();
$(wrapper.system_message_area).slideUp();
});
}, {fontSize:'11px'}
)
}
// complete my company registration
// --------------------------------
pscript.complete_registration = function()

View File

@@ -28,18 +28,11 @@ def get_status_details(arg=None):
online = get_online_users()
# system messages
msg_id = webnotes.conn.get_global('system_message_id')
msg = ''
if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']):
msg = webnotes.conn.get_global('system_message')
# system messages
ret = {
'user_count': len(online) or 0,
'unread_messages': get_unread_messages(),
'online_users': online or [],
'system_message':msg,
'is_trial': webnotes.conn.get_global('is_trial'),
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
'setup_status': get_setup_status()
@@ -56,9 +49,20 @@ def get_setup_status():
percent = 20
ret = []
header = webnotes.conn.get_value('Control Panel', None, 'client_name') or ''
if header.startswith('<div style="padding:4px; font-size:20px;">'\
+webnotes.conn.get_value('Control Panel', None, 'company_name')):
def is_header_set():
header = webnotes.conn.get_value('Control Panel', None, 'client_name') or ''
if header.startswith('<div style="padding:4px; font-size:20px;">'\
+webnotes.conn.get_value('Control Panel', None, 'company_name')):
return False
elif 'Banner Comes Here' in header:
return False
else:
return True
if not is_header_set():
ret.append('<a href="#!Form/Personalize/Personalize">Upload your company banner</a>')
else:
percent += 20