mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-31 23:33:43 +00:00
Merge branch 'latest' of github.com:webnotes/erpnext into latest
This commit is contained in:
@@ -43,4 +43,16 @@ body {
|
||||
.module-icons-selling{ background-position: 0 -528px; }
|
||||
.module-icons-setup{ background-position: 0 -594px; }
|
||||
.module-icons-stock{ background-position: 0 -660px; }
|
||||
.module-icons-support{ background-position: 0 -726px; }
|
||||
.module-icons-support{ background-position: 0 -726px; }
|
||||
|
||||
.topbar-new-comments {
|
||||
margin: -3px 0px;
|
||||
padding: 2px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
background-color: #B00D07;
|
||||
min-width: 20px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,16 @@ erpnext.startup.start = function() {
|
||||
|
||||
// setup toolbar
|
||||
erpnext.toolbar.setup();
|
||||
|
||||
// set interval for updates
|
||||
erpnext.startup.set_periodic_updates();
|
||||
|
||||
// border to the body
|
||||
// ------------------
|
||||
$('footer').html('<div class="erpnext-footer">\
|
||||
Powered by <a href="https://erpnext.com">ERPNext</a></div>');
|
||||
}
|
||||
|
||||
|
||||
$('#startup_div').toggle(false);
|
||||
}
|
||||
|
||||
@@ -77,6 +80,35 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) {
|
||||
if(callback) this.callback = function(){ callback(); }
|
||||
}
|
||||
|
||||
// ========== Update Messages ============
|
||||
var update_messages = function() {
|
||||
// Updates Team Messages
|
||||
|
||||
if(inList(['Guest', 'Administrator'], user)) { return; }
|
||||
|
||||
$c_page('home', 'event_updates', 'get_unread_messages', null,
|
||||
function(r,rt) {
|
||||
if(!r.exc) {
|
||||
// This function is defined in toolbar.js
|
||||
page_body.wntoolbar.set_new_comments(r.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
erpnext.startup.set_periodic_updates = function() {
|
||||
// Set interval for periodic updates of team messages
|
||||
wn.updates = {};
|
||||
|
||||
if(wn.updates.id) {
|
||||
clearInterval(wn.updates.id);
|
||||
}
|
||||
|
||||
wn.updates.id = setInterval(update_messages, 180000);
|
||||
}
|
||||
|
||||
// =======================================
|
||||
|
||||
// start
|
||||
$(document).bind('startup', function() {
|
||||
erpnext.startup.start();
|
||||
|
||||
@@ -3,7 +3,12 @@ wn.provide('erpnext.toolbar');
|
||||
|
||||
erpnext.toolbar.setup = function() {
|
||||
// profile
|
||||
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>')
|
||||
$('#toolbar-user').append('<li><a href="#profile-settings">Profile Settings</a></li>');
|
||||
|
||||
$('#toolbar-user').append('<li><a href="#My Company">Team / Messages</a></li>');
|
||||
|
||||
$('.topbar .secondary-nav').prepend('\
|
||||
<li><a href="#" id="toolbar-new-comments"></a></li>');
|
||||
|
||||
// help
|
||||
$('.topbar .secondary-nav').append('<li class="dropdown">\
|
||||
@@ -24,4 +29,25 @@ erpnext.toolbar.setup = function() {
|
||||
if(pscript.is_erpnext_saas && is_system_manager) {
|
||||
$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')
|
||||
}
|
||||
}
|
||||
|
||||
$.extend(page_body.wntoolbar, {
|
||||
set_new_comments: function(new_comments) {
|
||||
var topbar_nc = $('#toolbar-new-comments');
|
||||
if(new_comments && new_comments.length>0) {
|
||||
topbar_nc.html('<span class="topbar-new-comments">' + new_comments.length + '</span>');
|
||||
topbar_nc.click(function() { loadpage('My Company'); });
|
||||
$.each(new_comments, function(i, v) {
|
||||
var msg = 'New Message: ' + (v[1].length<=100 ? v[1] : (v[1].substr(0, 100) + "..."));
|
||||
var id = v[0].replace('/', '-');
|
||||
if(!$('#' + id)[0]) { show_alert(msg, id); }
|
||||
})
|
||||
} else {
|
||||
topbar_nc.html('');
|
||||
topbar_nc.click(function() { return false; });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
page_body.wntoolbar.set_new_comments();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user