blob: a1012215e93b98a5c8c70ad80f17c4933e8bee6c [file] [log] [blame]
Rushabh Mehta865c00a2012-01-24 14:33:21 +05301wn.provide('erpnext.topbar');
Rushabh Mehta865c00a2012-01-24 14:33:21 +05302
3/*
4<li class="dropdown">\
5 <a class="dropdown-toggle" href="#" onclick="return false;"></a>\
6 <ul class="dropdown-menu" id="toolbar-user">\
7 </ul>\
8</li>\
9*/
10
11erpnext.topbar.TopBar = Class.extend({
12 init: function() {
13 this.make();
Rushabh Mehta7018b192012-02-02 13:42:28 +053014 $('.brand').html(wn.boot.website_settings.brand_html);
Rushabh Mehta865c00a2012-01-24 14:33:21 +053015 this.make_items();
16 },
17 make: function() {
18 $('header').append('<div class="topbar">\
19 <div class="topbar-inner">\
20 <div class="container">\
Rushabh Mehta7018b192012-02-02 13:42:28 +053021 <a class="brand">[brand]</a>\
Rushabh Mehta865c00a2012-01-24 14:33:21 +053022 <ul class="nav">\
23 </ul>\
24 <img src="lib/images/ui/spinner.gif" id="spinner"/>\
25 <ul class="nav secondary-nav">\
26 <li><a href="#!Login Page">Login</a></li>\
27 </ul>\
28 </div>\
29 </div>\
30 </div>');
Rushabh Mehta7018b192012-02-02 13:42:28 +053031 $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
Rushabh Mehta865c00a2012-01-24 14:33:21 +053032 },
33 make_items: function() {
Rushabh Mehta7018b192012-02-02 13:42:28 +053034 var items = wn.boot.website_menus
Rushabh Mehta865c00a2012-01-24 14:33:21 +053035 for(var i=0;i<items.length;i++) {
36 var item = items[i];
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053037 if(!item.parent_label && item.parentfield=='top_bar_items') {
Rushabh Mehtaf35992f2012-02-07 10:39:17 +053038 item.route = item.url || item.custom_page;
Rushabh Mehtaa8ad3902012-01-25 10:37:35 +053039 $('header .nav:first').append(repl('<li><a href="#!%(route)s" \
40 data-label="%(label)s">%(label)s</a></li>', item))
Rushabh Mehta865c00a2012-01-24 14:33:21 +053041 }
42 }
43 }
44});
45
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053046
47// footer
48erpnext.Footer = Class.extend({
49 init: function() {
50 $('footer').html(repl('<div class="web-footer">\
51 <div class="web-footer-menu"><ul></ul></div>\
52 <div class="web-footer-address">%(address)s</div>\
53 <div class="web-footer-copyright">&copy; %(copyright)s</div>\
54 <div class="web-footer-powered">Powered by \
55 <a href="https://erpnext.com">erpnext.com</a></div>\
Rushabh Mehta7018b192012-02-02 13:42:28 +053056 </div>', wn.boot.website_settings));
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053057 this.make_items();
58 },
59 make_items: function() {
Rushabh Mehta7018b192012-02-02 13:42:28 +053060 var items = wn.boot.website_menus
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053061 for(var i=0;i<items.length;i++) {
62 var item = items[i];
63 if(!item.parent_label && item.parentfield=='footer_items') {
Rushabh Mehtaf35992f2012-02-07 10:39:17 +053064 item.route = item.url || item.custom_page;
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053065 $('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
66 data-label="%(label)s">%(label)s</a></li>', item))
67 }
68 }
69 }
70});
71
Rushabh Mehtaafaac602012-02-14 11:44:13 +053072$(document).bind('startup', function() {
73 erpnext.footer = new erpnext.Footer();
74 erpnext.topbar.topbar = new erpnext.topbar.TopBar();
75})