mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
product listing and pages
This commit is contained in:
@@ -252,8 +252,7 @@ wn.re_route={}
|
||||
wn.route=function(){if(wn.re_route[window.location.hash]){var re_route_val=wn.get_route_str(wn.re_route[window.location.hash]);var cur_route_val=wn.get_route_str(wn._cur_route);if(decodeURIComponent(re_route_val)===decodeURIComponent(cur_route_val)){window.history.back();return;}else{window.location.hash=wn.re_route[window.location.hash];}}
|
||||
wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!wn.boot){return[window.page_name];}
|
||||
return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route=function(route){return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route_str=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
|
||||
|
||||
@@ -139,8 +139,7 @@ wn.re_route={}
|
||||
wn.route=function(){if(wn.re_route[window.location.hash]){var re_route_val=wn.get_route_str(wn.re_route[window.location.hash]);var cur_route_val=wn.get_route_str(wn._cur_route);if(decodeURIComponent(re_route_val)===decodeURIComponent(cur_route_val)){window.history.back();return;}else{window.location.hash=wn.re_route[window.location.hash];}}
|
||||
wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!wn.boot){return[window.page_name];}
|
||||
return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route=function(route){return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route_str=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
|
||||
|
||||
@@ -3,5 +3,8 @@
|
||||
* erpnext/website/js/product_category.js
|
||||
*/
|
||||
erpnext.make_product_categories=function(wrapper){wrapper.category_list=new wn.ui.Listing({parent:$(wrapper).find('.more-categories').get(0),query:'select count(name) as items, item_group \
|
||||
from tabItem where is_sales_item="Yes" \
|
||||
group by item_group order by items desc',hide_refresh:true,render_row:function(parent,data){parent.innerHTML=repl('<a href="#!products/%(item_group)s">%(item_group)s</a> (%(items)s)',data);}});wrapper.category_list.run();}
|
||||
from tabItem \
|
||||
where is_sales_item="Yes" and \
|
||||
ifnull(show_in_website, "No")="Yes" and \
|
||||
docstatus = 0 \
|
||||
group by item_group order by items desc',hide_refresh:true,render_row:function(parent,data){parent.innerHTML=repl('<a href="#!products/%(item_group)s">%(item_group)s</a> (%(items)s)',data);}});wrapper.category_list.run();console.log('product categories made');}
|
||||
@@ -48,13 +48,26 @@ def get_html(page_name):
|
||||
page_name = scrub_page_name(page_name)
|
||||
|
||||
if page_name == '404':
|
||||
comments = """error: %s""" % webnotes.getTraceback()
|
||||
template = '404.html'
|
||||
traceback = webnotes.getTraceback()
|
||||
|
||||
# script is used to display traceback in error console
|
||||
args = {
|
||||
'comments': """error: %s""" % traceback,
|
||||
'template': '404.html',
|
||||
}
|
||||
# 'script': """(function() {
|
||||
# var error = "ERROR: %s";
|
||||
# console.log(error);
|
||||
# })();""" % traceback.replace('"', '\\"').replace('\n', ' \\\n'),
|
||||
# }
|
||||
|
||||
else:
|
||||
comments = """page: %s""" % page_name
|
||||
template = 'page.html'
|
||||
args = {
|
||||
'comments': """page: %s""" % page_name,
|
||||
'template': 'page.html',
|
||||
}
|
||||
|
||||
html = website.web_cache.load_from_web_cache(page_name, comments, template)
|
||||
html = website.web_cache.load_from_web_cache(page_name, **args)
|
||||
|
||||
return html
|
||||
|
||||
|
||||
Reference in New Issue
Block a user