From aa848bee2843d571ad09b7c2b80c8a67e12be6e9 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 17 Feb 2012 12:06:33 +0530 Subject: [PATCH 1/2] website css cleanups + dropdown in top toolbar --- css/all-app.css | 7 ++++++ css/all-web.css | 22 +++++++++++------ erpnext/website/css/website.css | 15 +++++------ erpnext/website/doctype/blog/blog_page.js | 2 +- erpnext/website/doctype/web_page/web_page.py | 7 ++++++ erpnext/website/js/topbar.js | 26 +++++++++++++++++--- erpnext/website/page/contact/contact.py | 2 +- erpnext/website/page/products/products.js | 2 +- js/all-app.js | 10 ++++++-- js/all-web.js | 15 +++++++---- version.num | 2 +- 11 files changed, 82 insertions(+), 28 deletions(-) diff --git a/css/all-app.css b/css/all-app.css index 80f023c162..b681fa35f4 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -119,6 +119,13 @@ li { line-height: 1.5em; } +hr { + margin: 18px 0; + border: 0; + border-top: 1px solid #e5e5e5; + border-bottom: 1px solid #ffffff; +} + a:active { outline:none; } :focus { -moz-outline-style:none; } diff --git a/css/all-web.css b/css/all-web.css index ece9bf1a08..f576a1a06c 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -119,6 +119,13 @@ li { line-height: 1.5em; } +hr { + margin: 18px 0; + border: 0; + border-top: 1px solid #e5e5e5; + border-bottom: 1px solid #ffffff; +} + a:active { outline:none; } :focus { -moz-outline-style:none; } @@ -1044,6 +1051,14 @@ h1 { margin-bottom: 15px; } +h2 { + margin-bottom: 11px; +} + +h3 { + margin-bottom: 7px; +} + pre { background-color: #F8F8F8; border: 1px solid #CCCCCC; @@ -1078,13 +1093,6 @@ header .topbar .container { margin-bottom: 20px; } -.web-main-section p, -.web-main-section h4, -.web-main-section h5, -.web-main-section pre { - margin-left: 9px; -} - .web-side-section { width: 30%; float: right; diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index 28303dbd34..6c891306c8 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -11,6 +11,14 @@ h1 { margin-bottom: 15px; } +h2 { + margin-bottom: 11px; +} + +h3 { + margin-bottom: 7px; +} + pre { background-color: #F8F8F8; border: 1px solid #CCCCCC; @@ -45,13 +53,6 @@ header .topbar .container { margin-bottom: 20px; } -.web-main-section p, -.web-main-section h4, -.web-main-section h5, -.web-main-section pre { - margin-left: 9px; -} - .web-side-section { width: 30%; float: right; diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js index 3ad25356ff..d8c4076315 100644 --- a/erpnext/website/doctype/blog/blog_page.js +++ b/erpnext/website/doctype/blog/blog_page.js @@ -21,7 +21,7 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) { // comments - $(wrapper).find('.web-main-section').append('

Comments

'); + $(wrapper).find('.web-main-section').append('

Comments

'); wrapper.comment_list = new wn.widgets.Listing({ parent: $(wrapper).find('.web-main-section').get(0), diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index 0a1a60e010..6d64c7d6c2 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -32,6 +32,7 @@ class DocType: website.utils.add_guest_access_to_page(p.name) self.cleanup_temp() + self.if_home_clear_cache() def add_page_links(self): """add links for next_page and see_also""" @@ -54,4 +55,10 @@ class DocType: for f in fl: if f in self.doc.fields: del self.doc.fields[f] + + def if_home_clear_cache(self): + """if home page, clear cache""" + if webnotes.conn.get_value("Website Settings", None, "home_page")==self.doc.name: + from webnotes.session_cache import clear_cache + clear_cache('Guest') \ No newline at end of file diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index a1012215e9..8b70d1ee7b 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -13,6 +13,7 @@ erpnext.topbar.TopBar = Class.extend({ this.make(); $('.brand').html(wn.boot.website_settings.brand_html); this.make_items(); + $('.topbar').dropdown(); }, make: function() { $('header').append('
\ @@ -31,13 +32,32 @@ erpnext.topbar.TopBar = Class.extend({ $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page')) }, make_items: function() { - var items = wn.boot.website_menus + var items = wn.boot.website_menus; + + // parent labels for(var i=0;i%(label)s', item)) + $('header .nav:first').append(repl('
  • \ + %(label)s
  • ', item)) + } + } + + // child labels + for(var i=0;i'); + } + item.route = item.url || item.custom_page; + $parent_li.find('.dropdown-menu').append(repl('
  • \ + %(label)s
  • ', item)) } } } diff --git a/erpnext/website/page/contact/contact.py b/erpnext/website/page/contact/contact.py index 2fd00f7681..a8a9133729 100644 --- a/erpnext/website/page/contact/contact.py +++ b/erpnext/website/page/contact/contact.py @@ -1,6 +1,6 @@ import json, webnotes -@webnotes.whitelist() +@webnotes.whitelist(allow_guest=True) def send(args): """create support ticket""" args = json.loads(args) diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js index 28baaeca77..4877eee9be 100644 --- a/erpnext/website/page/products/products.js +++ b/erpnext/website/page/products/products.js @@ -67,7 +67,7 @@ erpnext.products.make_product_list = function(wrapper) {
    \

    %(title)s

    \

    %(short_description)s

    \ -
    ', data); +

    ', data); } }); } diff --git a/js/all-app.js b/js/all-app.js index 44f9a839a2..7b76cafd83 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -554,7 +554,10 @@ $dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh this.set_status=this.disp_status;}} Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write') {this.table_refresh();return;} -this.set_label();this.refresh_display();if(this.onrefresh)this.onrefresh();if(this.input&&this.input.refresh)this.input.refresh(this.df);if(!this.not_in_form) +this.set_label();this.refresh_display();if(this.onrefresh) +this.onrefresh();if(this.input){if(this.input.refresh)this.input.refresh(this.df);} +if(this.wrapper){this.wrapper.fieldobj=this;$(this.wrapper).trigger('refresh');} +if(!this.not_in_form) this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.refresh_mandatory();this.set_max_width();} Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) @@ -1486,7 +1489,10 @@ $dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh this.set_status=this.disp_status;}} Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write') {this.table_refresh();return;} -this.set_label();this.refresh_display();if(this.onrefresh)this.onrefresh();if(this.input&&this.input.refresh)this.input.refresh(this.df);if(!this.not_in_form) +this.set_label();this.refresh_display();if(this.onrefresh) +this.onrefresh();if(this.input){if(this.input.refresh)this.input.refresh(this.df);} +if(this.wrapper){this.wrapper.fieldobj=this;$(this.wrapper).trigger('refresh');} +if(!this.not_in_form) this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.refresh_mandatory();this.set_max_width();} Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) diff --git a/js/all-web.js b/js/all-web.js index 43b9df4658..15a2c6c22d 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -463,7 +463,10 @@ $dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh this.set_status=this.disp_status;}} Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write') {this.table_refresh();return;} -this.set_label();this.refresh_display();if(this.onrefresh)this.onrefresh();if(this.input&&this.input.refresh)this.input.refresh(this.df);if(!this.not_in_form) +this.set_label();this.refresh_display();if(this.onrefresh) +this.onrefresh();if(this.input){if(this.input.refresh)this.input.refresh(this.df);} +if(this.wrapper){this.wrapper.fieldobj=this;$(this.wrapper).trigger('refresh');} +if(!this.not_in_form) this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.refresh_mandatory();this.set_max_width();} Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}} Field.prototype.set=function(val){if(this.not_in_form) @@ -1134,7 +1137,7 @@ $(document).bind('startup',function(){erpnext.startup.start();}); /* * erpnext/website/js/topbar.js */ -wn.provide('erpnext.topbar');erpnext.topbar.TopBar=Class.extend({init:function(){this.make();$('.brand').html(wn.boot.website_settings.brand_html);this.make_items();},make:function(){$('header').append('
    \ +wn.provide('erpnext.topbar');erpnext.topbar.TopBar=Class.extend({init:function(){this.make();$('.brand').html(wn.boot.website_settings.brand_html);this.make_items();$('.topbar').dropdown();},make:function(){$('header').append('
    \
    \
    \ [brand]\ @@ -1146,9 +1149,11 @@ wn.provide('erpnext.topbar');erpnext.topbar.TopBar=Class.extend({init:function() \
    \
    \ -
    ');$('.brand').attr('href','#!'+(wn.boot.website_settings.home_page||'Login Page'))},make_items:function(){var items=wn.boot.website_menus -for(var i=0;i%(label)s',item))}}}});erpnext.Footer=Class.extend({init:function(){$('footer').html(repl('');$('.brand').attr('href','#!'+(wn.boot.website_settings.home_page||'Login Page'))},make_items:function(){var items=wn.boot.website_menus;for(var i=0;i\ + %(label)s',item))}} +for(var i=0;i');} +item.route=item.url||item.custom_page;$parent_li.find('.dropdown-menu').append(repl('
  • \ + %(label)s
  • ',item))}}}});erpnext.Footer=Class.extend({init:function(){$('footer').html(repl('