Product Description
- {{ web_long_description or web_short_description }}
+ {{ web_long_description or web_short_description or
+ "[No description given]" }}
{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
@@ -51,7 +57,7 @@
{% for d in obj.doclist.get(
{"doctype":"Item Website Specification"}) %}
- {{ d.label }} |
+ {{ d.label }} |
{{ d.description }} |
{% endfor %}
diff --git a/website/templates/html/product_search.html b/website/templates/html/product_search.html
deleted file mode 100644
index 034ec112f8..0000000000
--- a/website/templates/html/product_search.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
\ No newline at end of file
diff --git a/website/templates/html/product_search_box.html b/website/templates/html/product_search_box.html
new file mode 100644
index 0000000000..125f0ba4b5
--- /dev/null
+++ b/website/templates/html/product_search_box.html
@@ -0,0 +1,26 @@
+
+
\ No newline at end of file
diff --git a/website/templates/js/blog.js b/website/templates/js/blog.js
index 43b2d70a96..6f3260ca86 100644
--- a/website/templates/js/blog.js
+++ b/website/templates/js/blog.js
@@ -59,10 +59,17 @@ var blog = {
Read with comments...
\
', b)).appendTo($wrap);
});
- blog.start += data.length;
+ blog.start += (data.length || 0);
if(!data.length) {
- $("#next-page").toggle(false)
- .parent().append("
Nothing more to show.
");
+ if(blog.start) {
+ $("#next-page").toggle(false)
+ .parent().append("
Nothing more to show.
");
+ } else {
+ $("#next-page").toggle(false)
+ .parent().append("
No blogs written yet.
");
+ }
+ } else {
+ $("#next-page").toggle(true);
}
}
}
\ No newline at end of file
diff --git a/website/templates/js/blog_subscribe.js b/website/templates/js/blog_subscribe.js
deleted file mode 100644
index cdc013025d..0000000000
--- a/website/templates/js/blog_subscribe.js
+++ /dev/null
@@ -1,33 +0,0 @@
-wn.provide('erpnext.blog');
-
-(function() {
- $('body').on('click', '.btn-blog-subscribe', function() {
- var d = new wn.ui.Dialog({
- title: "Get Blog Updates via Email",
- fields: [
- {label: "Your Name", fieldtype:"Data", reqd:1},
- {label: "Your Email Address", fieldtype:"Data", reqd:1
- ,description: "You can unsubscribe anytime."},
- {label: "Subscribe", fieldtype:"Button"}
- ]
- });
- $(d.fields_dict.subscribe.input).click(function() {
- var args = d.get_values();
- if(!args) return;
- wn.call({
- method: 'website.helpers.blog.add_subscriber',
- args: args,
- callback: function(r) {
- if(r.exc) {
- msgprint('Opps there seems to be some error, Please check back after some time.');
- } else {
- msgprint('Thanks for subscribing!');
- }
- d.hide();
- },
- btn: this
- })
- })
- d.show()
- })
-})()
diff --git a/website/templates/js/product_category.js b/website/templates/js/product_category.js
deleted file mode 100644
index 2b34708ec2..0000000000
--- a/website/templates/js/product_category.js
+++ /dev/null
@@ -1,18 +0,0 @@
-wn.provide('erpnext.products');
-
-erpnext.products.make_product_categories = function(wrapper) {
- if (!wrapper) { wrapper = erpnext.products.wrapper; }
- if (!wrapper) { return; }
-
- wrapper.category_list = new wn.ui.Listing({
- parent: $(wrapper).find('.more-categories').get(0),
- method: 'website.helpers.product.get_product_category_list',
- hide_refresh: true,
- render_row: function(parent, data) {
- parent.innerHTML = repl(
- '
%(item_group)s (%(items)s)',
- data);
- }
- });
- wrapper.category_list.run();
-}
\ No newline at end of file
diff --git a/website/templates/js/products.js b/website/templates/js/products.js
deleted file mode 100644
index 720d192f3e..0000000000
--- a/website/templates/js/products.js
+++ /dev/null
@@ -1,106 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see
.
-
-// js inside blog page
-
-{% include "js/product_category.js" %}
-
-wn.pages['{{ name }}'].onload = function(wrapper) {
- erpnext.products.wrapper = wrapper;
-
- // make product categories in the sidebar
- erpnext.products.make_product_categories(wrapper);
-
- // make lists
- erpnext.products.make_product_list(wrapper);
-
- // bind search button or enter key
- $(wrapper).find('.products-search .btn').click(function() {
- erpnext.products.product_list.run();
- });
-
- $(wrapper).find('.products-search input').keypress(function(ev) {
- if(ev.which==13) $(wrapper).find('.products-search .btn').click();
- });
-}
-
-erpnext.products.make_product_list = function(wrapper) {
- if (!wrapper) { wrapper = erpnext.products.wrapper; }
- if (!wrapper) { return; }
-
- erpnext.products.product_list = new wn.ui.Listing({
- parent: $(wrapper).find('#products-list').get(0),
- run_btn: $(wrapper).find('.products-search .btn').get(0),
- no_toolbar: true,
- method: 'website.helpers.product.get_product_list',
- get_args: function() {
- return {
- search: $('input[name="products-search"]').val() || '',
- product_group: erpnext.products.cur_group || '',
- };
- },
- render_row: function(parent, data) {
- if (!data.web_short_description) {
- data.web_short_description = data.description;
- }
- parent.innerHTML = repl('\
-
\
-
\
-
\
-
%(web_short_description)s
\
-
', data);
-
- if(data.website_image) {
- $(parent).find('.img-area').append(repl(
- '
', data))
- } else {
- $(parent).find('.img-area').append(wn.dom.placeholder(100,
- data.item_name));
- }
- }
- });
-}
-
-wn.pages['{{ name }}'].onshow = function(wrapper) {
- // show default product category
- erpnext.products.set_group();
-}
-
-erpnext.products.set_group = function() {
- var cat = erpnext.products.get_group();
-
- // get erpnext.products.default_category
- var wrapper = erpnext.products.wrapper;
-
- $(wrapper).find('h1').html(cat.label);
- erpnext.products.product_list.run();
-}
-
-erpnext.products.get_group = function() {
- route = wn.get_route();
- if(route && route.length>1) {
- // from url
- var grp = route[1];
- var label = route[1];
- erpnext.products.cur_group = grp;
- } else {
- // default
- var grp = 'Products';
- var label = 'Products';
- erpnext.products.cur_group = null;
- }
- return {grp:grp, label:label};
-}
\ No newline at end of file
diff --git a/website/templates/pages/404.html b/website/templates/pages/404.html
index 042360823f..04584d9a72 100644
--- a/website/templates/pages/404.html
+++ b/website/templates/pages/404.html
@@ -3,7 +3,7 @@
{% block content %}
-
Page missing or moved
+
Page missing or moved
We are very sorry for this, but the page you are looking for is missing
(this could be because of a typo in the address) or moved.
diff --git a/website/templates/pages/blog.html b/website/templates/pages/blog.html
index 75681d5045..f31af42222 100644
--- a/website/templates/pages/blog.html
+++ b/website/templates/pages/blog.html
@@ -17,11 +17,12 @@
diff --git a/website/templates/pages/error.html b/website/templates/pages/error.html
new file mode 100644
index 0000000000..4fe394f66b
--- /dev/null
+++ b/website/templates/pages/error.html
@@ -0,0 +1,11 @@
+{% extends "html/outer.html" %}
+
+{% block content %}
+
+
+
Oops, a server error has occured
+
+
%(error)s
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/product_search.html b/website/templates/pages/product_search.html
new file mode 100644
index 0000000000..f8a1144fbb
--- /dev/null
+++ b/website/templates/pages/product_search.html
@@ -0,0 +1,97 @@
+{% extends "html/page.html" %}
+
+{% block title %}Product Search{% endblock %}
+
+{% block content %}
+
+
+
+
+
+ {% include 'html/product_search_box.html' %}
+
Search Results
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/products.html b/website/templates/pages/products.html
deleted file mode 100644
index aa23ea29c4..0000000000
--- a/website/templates/pages/products.html
+++ /dev/null
@@ -1,37 +0,0 @@
-{% extends "html/page.html" %}
-
-{% block javascript %}
- {% include "js/products.js" %}
-{% endblock %}
-
-{% block css %}
- {% include "css/products.css" %}
-{% endblock %}
-
-{% block title %}
- Products
-{% endblock %}
-
-{% block content %}
-
-{% endblock %}
\ No newline at end of file
diff --git a/website/utils.py b/website/utils.py
index 198746f20a..be8f5e1b2e 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -48,7 +48,7 @@ def render(page_name):
else:
html = get_html('index')
except Exception, e:
- html = get_html('404')
+ html = get_html('error')
from webnotes.handler import eprint, print_zip
eprint("Content-Type: text/html")
@@ -57,32 +57,29 @@ def render(page_name):
def get_html(page_name):
"""get page html"""
page_name = scrub_page_name(page_name)
- comments = get_comments(page_name)
html = ''
# load from cache, if auto cache clear is falsy
if not (hasattr(conf, 'auto_cache_clear') and conf.auto_cache_clear or 0):
html = webnotes.cache().get_value("page:" + page_name)
+ from_cache = True
- if html:
- comments += "\nload status: cache"
- else:
+ if not html:
html = load_into_cache(page_name)
- comments += "\nload status: fresh"
+ from_cache = False
- # insert comments
- html += """\n""" % webnotes.utils.cstr(comments)
+ if not html:
+ html = get_html("404")
+
+ if page_name=="error":
+ html = html % {"error": webnotes.getTraceback()}
+ else:
+ comments = "\n\npage:"+page_name+\
+ "\nload status: " + (from_cache and "cache" or "fresh")
+ html += """\n""" % webnotes.utils.cstr(comments)
return html
-
-def get_comments(page_name):
- if page_name == '404':
- comments = """error: %s""" % webnotes.getTraceback()
- else:
- comments = """page: %s""" % page_name
-
- return comments
def scrub_page_name(page_name):
if page_name.endswith('.html'):
@@ -114,6 +111,8 @@ def update_page_name(doc, title):
def load_into_cache(page_name):
args = prepare_args(page_name)
+ if not args:
+ return ""
html = build_html(args)
webnotes.cache().set_value("page:" + page_name, html)
return html
@@ -141,6 +140,9 @@ def prepare_args(page_name):
else:
args = get_doc_fields(page_name)
+ if not args:
+ return False
+
args.update(get_outer_env())
return args
@@ -156,6 +158,9 @@ def get_template_pages():
def get_doc_fields(page_name):
doc_type, doc_name = get_source_doc(page_name)
+ if not doc_type:
+ return False
+
obj = webnotes.get_obj(doc_type, doc_name, with_children=True)
if hasattr(obj, 'prepare_template_args'):