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