mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-28 14:18:24 +00:00
website style fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Open Sans", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-weight: normal;
|
||||
color: #66ad78;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
@@ -114,34 +114,38 @@ var update_messages = function(reset) {
|
||||
if(inList(['Guest'], user) || !wn.session_alive) { return; }
|
||||
|
||||
if(!reset) {
|
||||
$c_page('home', 'event_updates', 'get_global_status_messages', null,
|
||||
function(r,rt) {
|
||||
if(!r.exc) {
|
||||
// This function is defined in toolbar.js
|
||||
wn.container.wntoolbar.set_new_comments(r.message.unread_messages);
|
||||
|
||||
var show_in_circle = function(parent_id, msg) {
|
||||
var parent = $('#'+parent_id);
|
||||
if(parent) {
|
||||
if(msg) {
|
||||
parent.find('span:first').text(msg);
|
||||
parent.toggle(true);
|
||||
} else {
|
||||
parent.toggle(false);
|
||||
}
|
||||
var set_messages = function(r) {
|
||||
if(!r.exc) {
|
||||
// This function is defined in toolbar.js
|
||||
wn.container.wntoolbar.set_new_comments(r.message.unread_messages);
|
||||
|
||||
var show_in_circle = function(parent_id, msg) {
|
||||
var parent = $('#'+parent_id);
|
||||
if(parent) {
|
||||
if(msg) {
|
||||
parent.find('span:first').text(msg);
|
||||
parent.toggle(true);
|
||||
} else {
|
||||
parent.toggle(false);
|
||||
}
|
||||
}
|
||||
|
||||
show_in_circle('unread_messages', r.message.unread_messages.length);
|
||||
show_in_circle('open_support_tickets', r.message.open_support_tickets);
|
||||
show_in_circle('things_todo', r.message.things_todo);
|
||||
show_in_circle('todays_events', r.message.todays_events);
|
||||
|
||||
} else {
|
||||
clearInterval(wn.updates.id);
|
||||
}
|
||||
|
||||
show_in_circle('unread_messages', r.message.unread_messages.length);
|
||||
show_in_circle('open_support_tickets', r.message.open_support_tickets);
|
||||
show_in_circle('things_todo', r.message.things_todo);
|
||||
show_in_circle('todays_events', r.message.todays_events);
|
||||
|
||||
} else {
|
||||
clearInterval(wn.updates.id);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
wn.call({
|
||||
method: 'startup.startup.get_global_status_messages',
|
||||
callback: set_messages
|
||||
});
|
||||
|
||||
} else {
|
||||
wn.container.wntoolbar.set_new_comments(0);
|
||||
$('#unread_messages').toggle(false);
|
||||
|
||||
54
erpnext/startup/startup.py
Normal file
54
erpnext/startup/startup.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import webnotes
|
||||
|
||||
def get_unread_messages():
|
||||
"returns unread (docstatus-0 messages for a user)"
|
||||
return webnotes.conn.sql("""\
|
||||
SELECT name, comment
|
||||
FROM `tabComment`
|
||||
WHERE comment_doctype IN ('My Company', 'Message')
|
||||
AND comment_docname = %s
|
||||
AND ifnull(docstatus,0)=0
|
||||
""", webnotes.user.name, as_list=1)
|
||||
|
||||
def get_open_support_tickets():
|
||||
"""
|
||||
Returns a count of open support tickets
|
||||
"""
|
||||
from webnotes.utils import cint
|
||||
open_support_tickets = webnotes.conn.sql("""\
|
||||
SELECT COUNT(*) FROM `tabSupport Ticket`
|
||||
WHERE status = 'Open'""")
|
||||
return open_support_tickets and cint(open_support_tickets[0][0]) or 0
|
||||
|
||||
def get_things_todo():
|
||||
"""
|
||||
Returns a count of incomplete todos
|
||||
"""
|
||||
from webnotes.utils import cint
|
||||
incomplete_todos = webnotes.conn.sql("""\
|
||||
SELECT COUNT(*) FROM `tabToDo`
|
||||
WHERE IFNULL(checked, 0) = 0
|
||||
AND owner = %s""", webnotes.session.get('user'))
|
||||
return incomplete_todos and cint(incomplete_todos[0][0]) or 0
|
||||
|
||||
def get_todays_events():
|
||||
"""
|
||||
Returns a count of todays events in calendar
|
||||
"""
|
||||
from webnotes.utils import nowdate, cint
|
||||
todays_events = webnotes.conn.sql("""\
|
||||
SELECT COUNT(*) FROM `tabEvent`
|
||||
WHERE owner = %s
|
||||
AND event_type != 'Cancel'
|
||||
AND event_date = %s""", (
|
||||
webnotes.session.get('user'), nowdate()))
|
||||
return todays_events and cint(todays_events[0][0]) or 0
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_global_status_messages(arg=None):
|
||||
return {
|
||||
'unread_messages': get_unread_messages(),
|
||||
'open_support_tickets': get_open_support_tickets(),
|
||||
'things_todo': get_things_todo(),
|
||||
'todays_events': get_todays_events(),
|
||||
}
|
||||
Reference in New Issue
Block a user