bugfix to topbar

This commit is contained in:
Rushabh Mehta 2012-02-06 07:29:52 +01:00
parent 04048ff890
commit af1cb632d6
2 changed files with 6 additions and 5 deletions

View File

@ -37,7 +37,7 @@ erpnext.topbar.TopBar = Class.extend({
for(var i=0;i<items.length;i++) {
var item = items[i];
if(!item.parent_label && item.parentfield=='top_bar_items') {
item.route = item.std_page ? item.std_page.toLowerCase() : item.custom_page;
item.route = item.custom_page ? item.custom_page : item.std_page.toLowerCase();
$('header .nav:first').append(repl('<li><a href="#!%(route)s" \
data-label="%(label)s">%(label)s</a></li>', item))
}
@ -64,7 +64,7 @@ erpnext.Footer = Class.extend({
for(var i=0;i<items.length;i++) {
var item = items[i];
if(!item.parent_label && item.parentfield=='footer_items') {
item.route = item.std_page ? item.std_page.toLowerCase() : item.custom_page;
item.route = item.custom_page ? item.custom_page : item.std_page.toLowerCase();
$('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
data-label="%(label)s">%(label)s</a></li>', item))
}
@ -72,4 +72,4 @@ erpnext.Footer = Class.extend({
}
});
erpnext.footer = new erpnext.Footer();
erpnext.footer = new erpnext.Footer();

View File

@ -25,7 +25,8 @@ def markdown(doc, fields):
def page_name(title):
"""make page name from title, and check that there is no duplicate"""
import re
name = re.sub('[~!@#$%^&*()<>,."\']', '', title.lower())
name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4])
def add_page(title):
@ -50,4 +51,4 @@ def add_guest_access_to_page(page):
d = Document('Page Role')
d.parent = page
d.role = 'Guest'
d.save()
d.save()