website css cleanups + dropdown in top toolbar

This commit is contained in:
Rushabh Mehta
2012-02-17 12:06:33 +05:30
parent 9670292543
commit aa848bee28
11 changed files with 82 additions and 28 deletions

View File

@@ -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;

View File

@@ -21,7 +21,7 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) {
// comments
$(wrapper).find('.web-main-section').append('<h3>Comments</h3>');
$(wrapper).find('.web-main-section').append('<hr><h3>Comments</h3>');
wrapper.comment_list = new wn.widgets.Listing({
parent: $(wrapper).find('.web-main-section').get(0),

View File

@@ -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')

View File

@@ -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('<div class="topbar">\
@@ -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<items.length;i++) {
var item = items[i];
if(!item.parent_label && item.parentfield=='top_bar_items') {
item.route = item.url || item.custom_page;
$('header .nav:first').append(repl('<li><a href="#!%(route)s" \
data-label="%(label)s">%(label)s</a></li>', item))
$('header .nav:first').append(repl('<li data-label="%(label)s">\
<a href="#!%(route)s">%(label)s</a></li>', item))
}
}
// child labels
for(var i=0;i<items.length;i++) {
var item = items[i];
if(item.parent_label && item.parentfield=='top_bar_items') {
// check if parent label has class "dropdown"
$parent_li = $(repl('header li[data-label="%(parent_label)s"]', item));
if(!$parent_li.hasClass('dropdown')) {
$parent_li.addClass('dropdown');
$parent_li.find('a:first').addClass('dropdown-toggle');
$parent_li.append('<ul class="dropdown-menu"></ul>');
}
item.route = item.url || item.custom_page;
$parent_li.find('.dropdown-menu').append(repl('<li data-label="%(label)s">\
<a href="#!%(route)s">%(label)s</a></li>', item))
}
}
}

View File

@@ -1,6 +1,6 @@
import json, webnotes
@webnotes.whitelist()
@webnotes.whitelist(allow_guest=True)
def send(args):
"""create support ticket"""
args = json.loads(args)

View File

@@ -67,7 +67,7 @@ erpnext.products.make_product_list = function(wrapper) {
<div style="float:left; width: 400px">\
<p><b><a href="#!%(page_name)s">%(title)s</a></b></p>\
<p>%(short_description)s</p></div>\
<div style="clear: both; margin-bottom: 15px; border-bottom: 1px solid #AAA"></div>', data);
<div style="clear: both;"></div><hr />', data);
}
});
}