Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 1 | wn.provide('erpnext.topbar'); |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 2 | |
| 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 | |
| 11 | erpnext.topbar.TopBar = Class.extend({ |
| 12 | init: function() { |
| 13 | this.make(); |
Rushabh Mehta | 7018b19 | 2012-02-02 13:42:28 +0530 | [diff] [blame] | 14 | $('.brand').html(wn.boot.website_settings.brand_html); |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 15 | this.make_items(); |
| 16 | }, |
| 17 | make: function() { |
| 18 | $('header').append('<div class="topbar">\ |
| 19 | <div class="topbar-inner">\ |
| 20 | <div class="container">\ |
Rushabh Mehta | 7018b19 | 2012-02-02 13:42:28 +0530 | [diff] [blame] | 21 | <a class="brand">[brand]</a>\ |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 22 | <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 Mehta | 7018b19 | 2012-02-02 13:42:28 +0530 | [diff] [blame] | 31 | $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page')) |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 32 | }, |
| 33 | make_items: function() { |
Rushabh Mehta | 7018b19 | 2012-02-02 13:42:28 +0530 | [diff] [blame] | 34 | var items = wn.boot.website_menus |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 35 | for(var i=0;i<items.length;i++) { |
| 36 | var item = items[i]; |
Rushabh Mehta | ab1148c | 2012-01-31 18:01:16 +0530 | [diff] [blame] | 37 | if(!item.parent_label && item.parentfield=='top_bar_items') { |
Rushabh Mehta | f35992f | 2012-02-07 10:39:17 +0530 | [diff] [blame] | 38 | item.route = item.url || item.custom_page; |
Rushabh Mehta | a8ad390 | 2012-01-25 10:37:35 +0530 | [diff] [blame] | 39 | $('header .nav:first').append(repl('<li><a href="#!%(route)s" \ |
| 40 | data-label="%(label)s">%(label)s</a></li>', item)) |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 41 | } |
| 42 | } |
| 43 | } |
| 44 | }); |
| 45 | |
Rushabh Mehta | ab1148c | 2012-01-31 18:01:16 +0530 | [diff] [blame] | 46 | |
| 47 | // footer |
| 48 | erpnext.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">© %(copyright)s</div>\ |
| 54 | <div class="web-footer-powered">Powered by \ |
| 55 | <a href="https://erpnext.com">erpnext.com</a></div>\ |
Rushabh Mehta | 7018b19 | 2012-02-02 13:42:28 +0530 | [diff] [blame] | 56 | </div>', wn.boot.website_settings)); |
Rushabh Mehta | ab1148c | 2012-01-31 18:01:16 +0530 | [diff] [blame] | 57 | this.make_items(); |
| 58 | }, |
| 59 | make_items: function() { |
Rushabh Mehta | 7018b19 | 2012-02-02 13:42:28 +0530 | [diff] [blame] | 60 | var items = wn.boot.website_menus |
Rushabh Mehta | ab1148c | 2012-01-31 18:01:16 +0530 | [diff] [blame] | 61 | for(var i=0;i<items.length;i++) { |
| 62 | var item = items[i]; |
| 63 | if(!item.parent_label && item.parentfield=='footer_items') { |
Rushabh Mehta | f35992f | 2012-02-07 10:39:17 +0530 | [diff] [blame] | 64 | item.route = item.url || item.custom_page; |
Rushabh Mehta | ab1148c | 2012-01-31 18:01:16 +0530 | [diff] [blame] | 65 | $('.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 Mehta | afaac60 | 2012-02-14 11:44:13 +0530 | [diff] [blame] | 72 | $(document).bind('startup', function() { |
| 73 | erpnext.footer = new erpnext.Footer(); |
| 74 | erpnext.topbar.topbar = new erpnext.topbar.TopBar(); |
| 75 | }) |