website fixes

This commit is contained in:
Rushabh Mehta 2012-05-01 13:41:44 +05:30
parent 220434c0ef
commit 6f8e9e951e
5 changed files with 44 additions and 21 deletions

View File

@ -25,6 +25,9 @@ class DocType:
with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f:
temp = Template(f.read())
if not self.doc.font_size:
self.doc.font_size = '13px'
self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px'
self.doc.custom_css = temp.render(doc = self.doc)

View File

@ -27,7 +27,7 @@ wn.provide('erpnext.navbar');
erpnext.navbar.Navbar = Class.extend({
init: function() {
this.make();
$('.brand').html(wn.boot.website_settings.brand_html);
$('.brand').html(wn.boot.website_settings.brand_html || sys_defaults.company);
this.make_items();
$('.dropdown-toggle').dropdown();
},
@ -54,9 +54,11 @@ erpnext.navbar.Navbar = 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.url || item.custom_page;
console.log(item)
erpnext.header_link_settings(item);
$('header .nav:first').append(repl('<li data-label="%(label)s">\
<a href="#!%(route)s">%(label)s</a></li>', item))
<a href="%(route)s" %(target)s>%(label)s</a></li>', item));
}
}
@ -77,18 +79,23 @@ erpnext.navbar.Navbar = Class.extend({
});
$parent_li.append('<ul class="dropdown-menu"></ul>');
}
item.route = item.url || item.custom_page;
erpnext.header_link_settings(item);
$parent_li.find('.dropdown-menu').append(repl('<li data-label="%(label)s">\
<a href="#!%(route)s">%(label)s</a></li>', item))
<a href="%(route)s" %(target)s>%(label)s</a></li>', item))
}
}
}
});
// footer
erpnext.Footer = Class.extend({
init: function() {
if(!wn.boot.website_settings.copyright) {
wn.boot.website_settings.copyright = sys_defaults.company;
}
if(!wn.boot.website_settings.address) {
wn.boot.website_settings.address = '';
}
$('footer').html(repl('<div class="web-footer">\
<div class="web-footer-menu"><ul></ul></div>\
<div class="web-footer-copyright">&copy; %(copyright)s | %(address)s</div>\
@ -102,14 +109,25 @@ 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.url || item.custom_page;
$('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
erpnext.header_link_settings(item);
$('.web-footer-menu ul').append(repl('<li><a href="%(route)s" %(target)s\
data-label="%(label)s">%(label)s</a></li>', item))
}
}
}
});
// customize hard / soft links
erpnext.header_link_settings = function(item) {
item.route = item.url || item.custom_page;
if(item.route.substr(0,4)=='http') {
item.target = 'target="_blank"';
} else {
item.target = '';
item.route = '#!' + item.route;
}
}
$(document).bind('startup', function() {
erpnext.footer = new erpnext.Footer();
erpnext.navbar.navbar = new erpnext.navbar.Navbar();

View File

@ -2219,8 +2219,7 @@ $(favicon).appendTo('head');}})
* js/app.js
*/
wn.provide('erpnext');erpnext.set_about=function(){wn.provide('wn.app');$.extend(wn.app,{name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'&copy; Web Notes Technologies Pvt Ltd',version:'2'});}
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
<i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html($wn.boot.website_settings.brand_html.substr(0,15)||'erpnext'+' <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
/*
* erpnext/startup/startup.js
*/

View File

@ -830,8 +830,7 @@ $(favicon).appendTo('head');}})
* js/app.js
*/
wn.provide('erpnext');erpnext.set_about=function(){wn.provide('wn.app');$.extend(wn.app,{name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'&copy; Web Notes Technologies Pvt Ltd',version:'2'});}
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
<i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html($wn.boot.website_settings.brand_html.substr(0,15)||'erpnext'+' <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
/*
* erpnext/startup/startup.js
*/
@ -868,7 +867,7 @@ if(opts.callback)opts.callback(r)}});}
/*
* erpnext/website/js/topbar.js
*/
wn.provide('erpnext.navbar');erpnext.navbar.Navbar=Class.extend({init:function(){this.make();$('.brand').html(wn.boot.website_settings.brand_html);this.make_items();$('.dropdown-toggle').dropdown();},make:function(){$('header').append('<div class="navbar navbar-fixed-top">\
wn.provide('erpnext.navbar');erpnext.navbar.Navbar=Class.extend({init:function(){this.make();$('.brand').html(wn.boot.website_settings.brand_html||sys_defaults.company);this.make_items();$('.dropdown-toggle').dropdown();},make:function(){$('header').append('<div class="navbar navbar-fixed-top">\
<div class="navbar-inner">\
<div class="container">\
<a class="brand">[brand]</a>\
@ -880,15 +879,19 @@ wn.provide('erpnext.navbar');erpnext.navbar.Navbar=Class.extend({init:function()
</ul>\
</div>\
</div>\
</div>');$('.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<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 data-label="%(label)s">\
<a href="#!%(route)s">%(label)s</a></li>',item))}}
</div>');$('.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<items.length;i++){var item=items[i];if(!item.parent_label&&item.parentfield=='top_bar_items'){console.log(item)
erpnext.header_link_settings(item);$('header .nav:first').append(repl('<li data-label="%(label)s">\
<a href="%(route)s" %(target)s>%(label)s</a></li>',item));}}
for(var i=0;i<items.length;i++){var item=items[i];if(item.parent_label&&item.parentfield=='top_bar_items'){$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').attr('data-toggle','dropdown').attr('href','').append('<b class="caret"></b>').click(function(){return false;});$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))}}}});erpnext.Footer=Class.extend({init:function(){$('footer').html(repl('<div class="web-footer">\
erpnext.header_link_settings(item);$parent_li.find('.dropdown-menu').append(repl('<li data-label="%(label)s">\
<a href="%(route)s" %(target)s>%(label)s</a></li>',item))}}}});erpnext.Footer=Class.extend({init:function(){if(!wn.boot.website_settings.copyright){wn.boot.website_settings.copyright=sys_defaults.company;}
if(!wn.boot.website_settings.address){wn.boot.website_settings.address='';}
$('footer').html(repl('<div class="web-footer">\
<div class="web-footer-menu"><ul></ul></div>\
<div class="web-footer-copyright">&copy; %(copyright)s | %(address)s</div>\
<div class="web-footer-powered">Powered by \
<a href="https://erpnext.com">erpnext.com</a></div>\
</div>',wn.boot.website_settings));this.make_items();},make_items:function(){var items=wn.boot.website_menus
for(var i=0;i<items.length;i++){var item=items[i];if(!item.parent_label&&item.parentfield=='footer_items'){item.route=item.url||item.custom_page;$('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
data-label="%(label)s">%(label)s</a></li>',item))}}}});$(document).bind('startup',function(){erpnext.footer=new erpnext.Footer();erpnext.navbar.navbar=new erpnext.navbar.Navbar();})
for(var i=0;i<items.length;i++){var item=items[i];if(!item.parent_label&&item.parentfield=='footer_items'){erpnext.header_link_settings(item);$('.web-footer-menu ul').append(repl('<li><a href="%(route)s" %(target)s\
data-label="%(label)s">%(label)s</a></li>',item))}}}});erpnext.header_link_settings=function(item){item.route=item.url||item.custom_page;if(item.route.substr(0,4)=='http'){item.target='target="_blank"';}else{item.target='';item.route='#!'+item.route;}}
$(document).bind('startup',function(){erpnext.footer=new erpnext.Footer();erpnext.navbar.navbar=new erpnext.navbar.Navbar();})

View File

@ -14,8 +14,8 @@ erpnext.set_about = function() {
wn.modules_path = 'erpnext';
$(document).bind('toolbar_setup', function() {
$('.brand').html('<b>erp</b>next\
<i class="icon-home icon-white navbar-icon-home" ></i>')
$('.brand').html($wn.boot.website_settings.brand_html.substr(0,15) || 'erpnext' +
' <i class="icon-home icon-white navbar-icon-home" ></i>')
.hover(function() {
$(this).find('.icon-home').addClass('navbar-icon-home-hover');
}, function() {