blob: 8a7870c7de6067f1c606aa7e8e9cd1e0a53ba4f1 [file] [log] [blame]
Rushabh Mehta865c00a2012-01-24 14:33:21 +05301wn.provide('erpnext.topbar');
2wn.require('lib/css/bootstrap/bootstrap-topbar.css');
3wn.require('lib/js/bootstrap/bootstrap-dropdown.js');
4
5/*
6<li class="dropdown">\
7 <a class="dropdown-toggle" href="#" onclick="return false;"></a>\
8 <ul class="dropdown-menu" id="toolbar-user">\
9 </ul>\
10</li>\
11*/
12
13erpnext.topbar.TopBar = Class.extend({
14 init: function() {
15 this.make();
Rushabh Mehta7018b192012-02-02 13:42:28 +053016 $('.brand').html(wn.boot.website_settings.brand_html);
Rushabh Mehta865c00a2012-01-24 14:33:21 +053017 this.make_items();
18 },
19 make: function() {
20 $('header').append('<div class="topbar">\
21 <div class="topbar-inner">\
22 <div class="container">\
Rushabh Mehta7018b192012-02-02 13:42:28 +053023 <a class="brand">[brand]</a>\
Rushabh Mehta865c00a2012-01-24 14:33:21 +053024 <ul class="nav">\
25 </ul>\
26 <img src="lib/images/ui/spinner.gif" id="spinner"/>\
27 <ul class="nav secondary-nav">\
28 <li><a href="#!Login Page">Login</a></li>\
29 </ul>\
30 </div>\
31 </div>\
32 </div>');
Rushabh Mehta7018b192012-02-02 13:42:28 +053033 $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
Rushabh Mehta865c00a2012-01-24 14:33:21 +053034 },
35 make_items: function() {
Rushabh Mehta7018b192012-02-02 13:42:28 +053036 var items = wn.boot.website_menus
Rushabh Mehta865c00a2012-01-24 14:33:21 +053037 for(var i=0;i<items.length;i++) {
38 var item = items[i];
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053039 if(!item.parent_label && item.parentfield=='top_bar_items') {
40 item.route = item.std_page ? item.std_page.toLowerCase() : item.custom_page;
Rushabh Mehtaa8ad3902012-01-25 10:37:35 +053041 $('header .nav:first').append(repl('<li><a href="#!%(route)s" \
42 data-label="%(label)s">%(label)s</a></li>', item))
Rushabh Mehta865c00a2012-01-24 14:33:21 +053043 }
44 }
45 }
46});
47
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053048erpnext.topbar.topbar = new erpnext.topbar.TopBar();
49
50// footer
51erpnext.Footer = Class.extend({
52 init: function() {
53 $('footer').html(repl('<div class="web-footer">\
54 <div class="web-footer-menu"><ul></ul></div>\
55 <div class="web-footer-address">%(address)s</div>\
56 <div class="web-footer-copyright">&copy; %(copyright)s</div>\
57 <div class="web-footer-powered">Powered by \
58 <a href="https://erpnext.com">erpnext.com</a></div>\
Rushabh Mehta7018b192012-02-02 13:42:28 +053059 </div>', wn.boot.website_settings));
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053060 this.make_items();
61 },
62 make_items: function() {
Rushabh Mehta7018b192012-02-02 13:42:28 +053063 var items = wn.boot.website_menus
Rushabh Mehtaab1148c2012-01-31 18:01:16 +053064 for(var i=0;i<items.length;i++) {
65 var item = items[i];
66 if(!item.parent_label && item.parentfield=='footer_items') {
67 item.route = item.std_page ? item.std_page.toLowerCase() : item.custom_page;
68 $('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
69 data-label="%(label)s">%(label)s</a></li>', item))
70 }
71 }
72 }
73});
74
75erpnext.footer = new erpnext.Footer();