From 51146c07c3440459e5863d97348d6016163ae541 Mon Sep 17 00:00:00 2001
From: Anand Doshi
Date: Thu, 12 Jul 2012 18:41:12 +0530
Subject: [PATCH] cleaner web cache code
---
erpnext/patches/june_2012/cms2.py | 33 +-
erpnext/stock/doctype/item/item.py | 17 +-
erpnext/website/blog.py | 7 +-
.../website_settings/website_settings.py | 38 +--
erpnext/website/js/product_category.js | 34 --
erpnext/website/js/topbar.js | 130 --------
erpnext/website/page/about/__init__.py | 0
erpnext/website/page/about/about.txt | 43 ---
erpnext/website/page/blog/__init__.py | 0
erpnext/website/page/blog/blog.html | 23 --
erpnext/website/page/blog/blog.js | 59 ----
erpnext/website/page/blog/blog.py | 29 --
erpnext/website/page/blog/blog.txt | 44 ---
erpnext/website/page/contact/__init__.py | 0
erpnext/website/page/contact/contact.js | 46 ---
erpnext/website/page/contact/contact.py | 32 --
erpnext/website/page/contact/contact.txt | 42 ---
erpnext/website/page/products/README.md | 27 --
erpnext/website/page/products/__init__.py | 0
erpnext/website/page/products/products.html | 14 -
erpnext/website/page/products/products.js | 109 -------
erpnext/website/page/products/products.txt | 43 ---
erpnext/website/templates/css/blog.css | 7 +
erpnext/website/templates/css/blog_page.css | 9 +
erpnext/website/templates/css/login.css | 10 +
.../website/templates/css/product_page.css | 34 ++
erpnext/website/templates/css/products.css | 11 +
.../website/templates/{ => html}/base.html | 0
.../{blog/blog.html => html/blog_page.html} | 42 ++-
.../templates/{blog => html}/comment.html | 0
.../website/templates/{ => html}/outer.html | 6 +-
.../website/templates/{ => html}/page.html | 5 +-
.../product.html => html/product_page.html} | 49 +--
.../templates/{ => html}/web_page.html | 8 +-
.../{blog/blog_list.js => js/blog.js} | 7 +-
.../{blog/blog.js => js/blog_page.js} | 20 +-
.../website/templates/{login => js}/login.js | 38 +--
.../{product => js}/product_category.js | 8 +-
.../product.js => js/product_page.js} | 12 +-
.../product_list.js => js/products.js} | 12 +-
.../website/templates/{ => pages}/404.html | 2 +-
.../{blog/blog_list.html => pages/blog.html} | 16 +-
erpnext/website/templates/pages/index.html | 1 +
.../templates/{login => pages}/login.html | 23 +-
.../product_list.html => pages/products.html} | 24 +-
erpnext/website/utils.py | 85 +----
erpnext/website/web_cache.py | 304 ++++++++++--------
erpnext/website/web_page.py | 5 +-
public/rss.xml | 6 +-
public/web.py | 57 ++--
50 files changed, 442 insertions(+), 1129 deletions(-)
delete mode 100644 erpnext/website/js/product_category.js
delete mode 100644 erpnext/website/js/topbar.js
delete mode 100644 erpnext/website/page/about/__init__.py
delete mode 100644 erpnext/website/page/about/about.txt
delete mode 100644 erpnext/website/page/blog/__init__.py
delete mode 100644 erpnext/website/page/blog/blog.html
delete mode 100644 erpnext/website/page/blog/blog.js
delete mode 100644 erpnext/website/page/blog/blog.py
delete mode 100644 erpnext/website/page/blog/blog.txt
delete mode 100644 erpnext/website/page/contact/__init__.py
delete mode 100644 erpnext/website/page/contact/contact.js
delete mode 100644 erpnext/website/page/contact/contact.py
delete mode 100644 erpnext/website/page/contact/contact.txt
delete mode 100644 erpnext/website/page/products/README.md
delete mode 100644 erpnext/website/page/products/__init__.py
delete mode 100644 erpnext/website/page/products/products.html
delete mode 100644 erpnext/website/page/products/products.js
delete mode 100644 erpnext/website/page/products/products.txt
create mode 100644 erpnext/website/templates/css/blog.css
create mode 100644 erpnext/website/templates/css/blog_page.css
create mode 100644 erpnext/website/templates/css/login.css
create mode 100644 erpnext/website/templates/css/product_page.css
create mode 100644 erpnext/website/templates/css/products.css
rename erpnext/website/templates/{ => html}/base.html (100%)
rename erpnext/website/templates/{blog/blog.html => html/blog_page.html} (72%)
rename erpnext/website/templates/{blog => html}/comment.html (100%)
rename erpnext/website/templates/{ => html}/outer.html (91%)
rename erpnext/website/templates/{ => html}/page.html (87%)
rename erpnext/website/templates/{product/product.html => html/product_page.html} (62%)
rename erpnext/website/templates/{ => html}/web_page.html (81%)
rename erpnext/website/templates/{blog/blog_list.js => js/blog.js} (96%)
rename erpnext/website/templates/{blog/blog.js => js/blog_page.js} (95%)
rename erpnext/website/templates/{login => js}/login.js (59%)
rename erpnext/website/templates/{product => js}/product_category.js (89%)
rename erpnext/website/templates/{product/product.js => js/product_page.js} (96%)
rename erpnext/website/templates/{product/product_list.js => js/products.js} (96%)
rename erpnext/website/templates/{ => pages}/404.html (90%)
rename erpnext/website/templates/{blog/blog_list.html => pages/blog.html} (81%)
create mode 100644 erpnext/website/templates/pages/index.html
rename erpnext/website/templates/{login => pages}/login.html (86%)
rename erpnext/website/templates/{product/product_list.html => pages/products.html} (80%)
diff --git a/erpnext/patches/june_2012/cms2.py b/erpnext/patches/june_2012/cms2.py
index a877c7649b..721f8a7381 100644
--- a/erpnext/patches/june_2012/cms2.py
+++ b/erpnext/patches/june_2012/cms2.py
@@ -2,9 +2,12 @@ def execute():
import webnotes
import webnotes.model.sync
- # sync web page, blog doctype
+ # sync doctypes required for the patch
+ webnotes.model.sync.sync('website', 'web_cache')
webnotes.model.sync.sync('website', 'web_page')
webnotes.model.sync.sync('website', 'blog')
+ webnotes.model.sync.sync('website', 'website_settings')
+ webnotes.model.sync.sync('stock', 'item')
cleanup()
@@ -29,9 +32,29 @@ def cleanup():
update `tabComment` comm, `tabBlog` blog
set comm.comment_doctype = 'Blog', comm.comment_docname = blog.name
where comm.comment_docname = blog.page_name""")
-
-
+
+ # delete deprecated pages
+ import webnotes.model
+ webnotes.model.delete_doc('Page', 'products')
+ webnotes.model.delete_doc('Page', 'contact')
+ webnotes.model.delete_doc('Page', 'blog')
+ webnotes.model.delete_doc('Page', 'about')
+
def save_pages():
"""save all web pages, blogs to create content"""
- import website.web_cache
- website.web_cache.rebuild_web_cache()
\ No newline at end of file
+ query_map = {
+ 'Web Page': """select name from `tabWeb Page` where docstatus=0""",
+ 'Blog': """\
+ select name from `tabBlog`
+ where docstatus = 0 and ifnull(published, 0) = 1""",
+ 'Item': """\
+ select name from `tabItem`
+ where docstatus = 0 and ifnull(show_in_website, 0) = 1""",
+ }
+
+ import webnotes
+ from webnotes.model.doclist import DocList
+
+ for dt in query_map:
+ for result in webnotes.conn.sql(query_map[dt], as_dict=1):
+ DocList(dt, result['name']).save()
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 798528734c..9864fc909f 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -86,8 +86,7 @@ class DocType:
def on_trash(self):
sql("delete from tabBin where item_code='%s'"%(self.doc.item_code))
- import website.web_cache
- website.web_cache.delete_web_cache(self.doc.page_name)
+ self.delete_web_cache(self.doc.page_name)
# Check whether Ref Rate is not entered twice for same Price List and Currency
def check_ref_rate_detail(self):
@@ -224,17 +223,21 @@ Total Available Qty: %s
def on_rename(self,newdn,olddn):
sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
- def clear_web_cache(self):
+ def delete_web_cache(self, page_name):
import website.web_cache
-
+ website.web_cache.delete_cache(page_name)
+
+ def clear_web_cache(self):
if hasattr(self, 'old_page_name') and self.old_page_name and \
self.doc.page_name != self.old_page_name:
- website.web_cache.delete_web_cache(self.old_page_name)
+ self.delete_web_cache(self.doc.page_name)
if self.doc.show_in_website:
- website.web_cache.clear_web_cache(self.doc.doctype, self.doc.name, self.doc.page_name)
+ import website.web_cache
+ website.web_cache.create_cache(self.doc.page_name, self.doc.doctype, self.doc.name)
+ website.web_cache.clear_cache(self.doc.page_name, self.doc.doctype, self.doc.name)
else:
- website.web_cache.delete_web_cache(self.doc.page_name)
+ self.delete_web_cache(self.doc.page_name)
def update_page_name(self):
import website.utils
diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py
index 56bf8e443c..f628338ee0 100644
--- a/erpnext/website/blog.py
+++ b/erpnext/website/blog.py
@@ -52,9 +52,8 @@ def add_comment(args=None):
# since comments are embedded in the page, clear the web cache
import website.web_cache
- website.web_cache.clear_web_cache(
- args.get('comment_doctype'), args.get('comment_docname'),
- args.get('page_name'))
+ website.web_cache.clear_cache(args.get('page_name'),
+ args.get('comment_doctype'), args.get('comment_docname'))
import webnotes.utils
@@ -62,7 +61,7 @@ def add_comment(args=None):
template_args = { 'comment_list': [comment] }
# get html of comment row
- comment_html = website.web_cache.build_html(template_args, 'blog/comment.html')
+ comment_html = website.web_cache.build_html(template_args, 'html/comment.html')
return comment_html
\ No newline at end of file
diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py
index aec5a39188..b08e674ab4 100644
--- a/erpnext/website/doctype/website_settings/website_settings.py
+++ b/erpnext/website/doctype/website_settings/website_settings.py
@@ -28,43 +28,17 @@ class DocType:
self.validate_domain_list()
def on_update(self):
- self.rewrite_pages()
-
- from webnotes.session_cache import clear_cache
- clear_cache('Guest')
-
- def rewrite_pages(self):
- """rewrite all web pages"""
- import webnotes
- from webnotes.model.doclist import DocList
- from webnotes.model.code import get_obj
-
- # rewrite all web pages
- for name in webnotes.conn.sql("""select name, modified from `tabWeb Page`
- where docstatus=0"""):
- DocList('Web Page', name[0]).save()
- webnotes.conn.set_value('Web Page', name[0], 'modified', name[1])
-
- # rewrite all blog pages
- for name in webnotes.conn.sql("""select name, modified from `tabBlog`
- where docstatus=0 and ifnull(published,0)=1"""):
- DocList('Blog', name[0]).save()
- webnotes.conn.set_value('Blog', name[0], 'modified', name[1])
-
+ # make js and css
from webnotes.cms.make import make_web_core
make_web_core()
+ # clear web cache
import website.web_cache
- for page in ['blog', 'products']:
- website.web_cache.delete_web_cache(page)
- website.web_cache.clear_web_cache(None, None, page)
-
- #get_obj('Page', 'blog').write_cms_page(force=True)
- #get_obj('Page', 'Login Page').write_cms_page(force=True)
-
- webnotes.msgprint('Rebuilt all blogs and pages')
-
+ website.web_cache.refresh_cache()
+ from webnotes.session_cache import clear_cache
+ clear_cache('Guest')
+
def set_home_page(self):
import webnotes
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js
deleted file mode 100644
index bed4d2457a..0000000000
--- a/erpnext/website/js/product_category.js
+++ /dev/null
@@ -1,34 +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 .
-
-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" 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('%(item_group)s (%(items)s)',
- data);
- }
- });
- wrapper.category_list.run();
- console.log('product categories made');
-}
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
deleted file mode 100644
index 88cbe8b035..0000000000
--- a/erpnext/website/js/topbar.js
+++ /dev/null
@@ -1,130 +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 .
-
-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('');
- $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
- },
- make_items: function() {
- var items = wn.boot.website_menus;
-
- // parent labels
- for(var i=0;i\
- %(label)s', item));
- }
- }
-
- // child labels
- for(var i=0;i')
- .click(function() {
- return false;
- });
- $parent_li.append('');
- }
- erpnext.header_link_settings(item);
- $parent_li.find('.dropdown-menu').append(repl('\
- %(label)s', 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('', wn.boot.website_settings));
- this.make_items();
- },
- make_items: function() {
- var items = wn.boot.website_menus
- for(var i=0;i%(label)s', item))
- }
- }
- }
-});
-
-// customize hard / soft links
-erpnext.header_link_settings = function(item) {
- item.route = item.url || item.custom_page;
- if(item.route && 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();
-})
diff --git a/erpnext/website/page/about/__init__.py b/erpnext/website/page/about/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/website/page/about/about.txt b/erpnext/website/page/about/about.txt
deleted file mode 100644
index a10651308a..0000000000
--- a/erpnext/website/page/about/about.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Page, about
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-27 11:37:57',
- 'docstatus': 0,
- 'modified': '2012-01-27 13:26:42',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'about',
- 'standard': 'Yes',
- 'title': 'About Us'
- },
-
- # These values are common for all Page Role
- {
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'about',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, about
- {
- 'doctype': 'Page',
- 'name': 'about'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/page/blog/__init__.py b/erpnext/website/page/blog/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html
deleted file mode 100644
index 8d7cd00345..0000000000
--- a/erpnext/website/page/blog/blog.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js
deleted file mode 100644
index 5a10998c6f..0000000000
--- a/erpnext/website/page/blog/blog.js
+++ /dev/null
@@ -1,59 +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 .
-
-
-pscript.onload_blog = function(wrapper) {
- wrapper.blog_list = new wn.ui.Listing({
- parent: $(wrapper).find('#blog-list').get(0),
- query: 'select tabBlog.name, title, left(content, 1000) as content, tabBlog.creation, \
- ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
- from tabProfile, tabBlog\
- where ifnull(published,0)=1 and tabBlog.owner = tabProfile.name \
- order by tabBlog.creation desc',
- hide_refresh: true,
- no_toolbar: true,
- render_row: function(parent, data) {
- if(data.content && data.content.length==1000) data.content += '... (read on)';
- data.content = wn.markdown(data.content);
- if(data.last_name) data.last_name = ' ' + data.last_name;
- data.date = prettyDate(data.creation);
- parent.innerHTML = repl('%(title)s
\
- By %(first_name)s%(last_name)s, %(date)s
\
- %(content)s
\
- Read Full Text
', data);
- },
- page_length: 10
- });
- wrapper.blog_list.run();
-
- // subscribe button
- $('#blog-subscribe').click(function() {
- var email = $(wrapper).find('input[name="blog-subscribe"]').val();
- if(!validate_email(email)) {
- msgprint('Please enter a valid email!');
- }
- wn.call({
- module:'website',
- page:'blog',
- method:'subscribe',
- args:email,
- btn: this,
- callback: function() {
- $(wrapper).find('input[name="blog-subscribe"]').val('');
- }
- });
- })
-}
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.py b/erpnext/website/page/blog/blog.py
deleted file mode 100644
index 9790114154..0000000000
--- a/erpnext/website/page/blog/blog.py
+++ /dev/null
@@ -1,29 +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 .
-
-import webnotes
-
-@webnotes.whitelist()
-def subscribe(arg):
- """subscribe to blog (blog_subscriber)"""
- if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg):
- webnotes.msgprint("Already a subscriber. Thanks!")
- else:
- from webnotes.model.doc import Document
- d = Document('Blog Subscriber')
- d.name = arg
- d.save()
- webnotes.msgprint("Thank you for subscribing!")
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.txt b/erpnext/website/page/blog/blog.txt
deleted file mode 100644
index 4443ec813d..0000000000
--- a/erpnext/website/page/blog/blog.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Page, blog
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-27 15:47:52',
- 'docstatus': 0,
- 'modified': '2012-01-27 15:47:52',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'blog',
- 'standard': 'Yes',
- 'title': 'Blog'
- },
-
- # These values are common for all Page Role
- {
- '__islocal': 1,
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'blog',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, blog
- {
- 'doctype': 'Page',
- 'name': 'blog'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/page/contact/__init__.py b/erpnext/website/page/contact/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/website/page/contact/contact.js b/erpnext/website/page/contact/contact.js
deleted file mode 100644
index c794325631..0000000000
--- a/erpnext/website/page/contact/contact.js
+++ /dev/null
@@ -1,46 +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 .
-
-pscript.onload_contact = function(wrapper) {
- $('#content-contact-us .btn.primary').click(function() {
- var me = this;
- var args = {};
- args.name = $('#content-contact-us [name="contact-name"]').val();
- args.email = $('#content-contact-us [name="contact-email"]').val();
- args.message = $('#content-contact-us [name="contact-message"]').val();
-
- if(!validate_email(args.email)) {
- msgprint('Please enter a valid email id');
- return;
- }
-
- if(args.name && args.email && args.message) {
- $(this).set_working();
- $c_page('website', 'contact', 'send', args, function(r) {
- $('#content-contact-us [name*="contact"]').val('');
- $(me).done_working();
- });
- } else {
- msgprint("Please enter info in all the fields.")
- }
- });
-
- $('#content-contact-us :input').keyup(function(ev) {
- if(ev.which == 13) {
- $('#content-contact-us .btn.primary').click();
- }
- });
-}
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.py b/erpnext/website/page/contact/contact.py
deleted file mode 100644
index 1ee3ab9efc..0000000000
--- a/erpnext/website/page/contact/contact.py
+++ /dev/null
@@ -1,32 +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 .
-
-import json, webnotes
-
-@webnotes.whitelist(allow_guest=True)
-def send(args):
- """create support ticket"""
- args = json.loads(args)
-
- from webnotes.model.doc import Document
- d = Document('Support Ticket')
- d.raised_by = args['email']
- d.description = 'From: ' + args['name'] + '\n\n' + args['message']
- d.subject = 'Website Query'
- d.status = 'Open'
- d.owner = 'Guest'
- d.save(1)
- webnotes.msgprint("Thank you for your query. We will respond as soon as we can.")
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.txt b/erpnext/website/page/contact/contact.txt
deleted file mode 100644
index 6051c6f2c9..0000000000
--- a/erpnext/website/page/contact/contact.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Page, contact
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-25 16:02:15',
- 'docstatus': 0,
- 'modified': '2012-01-25 16:02:15',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'contact',
- 'standard': 'Yes'
- },
-
- # These values are common for all Page Role
- {
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'contact',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, contact
- {
- 'doctype': 'Page',
- 'name': 'contact'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/page/products/README.md b/erpnext/website/page/products/README.md
deleted file mode 100644
index e40b44629f..0000000000
--- a/erpnext/website/page/products/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## Products
-
-Contains
-
-- List of Products tagged by Item master
- - image
- - short description (md)
- - pricing info (if public) (public pricelist)
- - stock info (website warehouse)
-- Search
-- Sidebar contains categories (# of items in each category)
-
-When Item is Saved, a page for that item is created with
-
-- Large image
-- Smaller images
-- Long Description
-- Pricing info
-- Stock info
-- Contact Button (instead of Buy / Add to cart)
-
-### Steps
-
-- update item master
-- update item category (show in web + priority) (or in a products settings page)
-- # of public items in each category
-- validation - item cannot have show in item if parent does not have it
\ No newline at end of file
diff --git a/erpnext/website/page/products/__init__.py b/erpnext/website/page/products/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
deleted file mode 100644
index 30eca4a2e1..0000000000
--- a/erpnext/website/page/products/products.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
deleted file mode 100644
index 1e8dcaab03..0000000000
--- a/erpnext/website/page/products/products.js
+++ /dev/null
@@ -1,109 +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
.
-
-erpnext.products = {}
-
-wn.require('js/product_category.js');
-
-pscript.onload_products = function(wrapper) {
- erpnext.make_product_categories(wrapper);
- erpnext.products.wrapper = wrapper;
-
- // make lists
- erpnext.products.make_product_list(wrapper);
-
- // button
- $(wrapper).find('.products-search .btn').click(function() {
- wrapper.mainlist.run();
- });
-
- $(wrapper).find('.products-search input').keypress(function(ev) {
- if(ev.which==13) $(wrapper).find('.products-search .btn').click();
- });
-}
-
-pscript.onshow_products = function(wrapper) {
- // show default product category
- erpnext.products.set_group();
-}
-
-erpnext.products.get_group = function() {
- route = wn.get_route();
- if(route.length>1) {
- // from url
- var grp = route[1];
- var label = route[1];
- } else {
- // default
- var grp = wn.boot.website_settings.default_product_category;
- var label = wn.boot.website_settings.default_product_category;
- }
- erpnext.products.cur_group = grp;
- return {grp:grp, label:label};
-}
-
-erpnext.products.make_product_list = function(wrapper) {
- wrapper.mainlist = new wn.ui.Listing({
- parent: $(wrapper).find('.products-list').get(0),
- run_btn: $(wrapper).find('.products-search .btn').get(0),
- no_toolbar: true,
- get_query: function() {
- var srch = $('input[name="products-search"]').val()
- var search_cond = 'and (description like "%%(srch)s%"\
- or item_name like "%%(srch)s%")';
- args = {
- search_cond: srch ? repl(search_cond, {srch:srch}) : '',
- cat: erpnext.products.cur_group
- };
- return repl('select name, item_name, website_image, \
- description, page_name \
- from tabItem \
- where is_sales_item="Yes" \
- and item_group="%(cat)s" \
- %(search_cond)s', args)
- },
- render_row: function(parent, data) {
- parent.innerHTML = repl('
\
-
\
-
\
-
', data);
-
- if(data.website_image) {
- $(parent).find('.img-area').append(repl(
- '
s)
', data))
- } else {
- $(parent).find('.img-area').append(wn.dom.placeholder(70,
- data.item_name));
- }
- }
- });
-}
-
-erpnext.products.set_group = function() {
- var cat = erpnext.products.get_group();
- if(!cat.grp) {
- // still nothing
- setTimeout('erpnext.products.set_group()', 1000);
- return;
- }
- // get erpnext.products.default_category
- var wrapper = erpnext.products.wrapper;
-
- $(wrapper).find('h1').html(cat.label);
- wrapper.mainlist.run();
-}
diff --git a/erpnext/website/page/products/products.txt b/erpnext/website/page/products/products.txt
deleted file mode 100644
index f00a05b8e8..0000000000
--- a/erpnext/website/page/products/products.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Page, products
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-30 10:49:01',
- 'docstatus': 0,
- 'modified': '2012-01-30 10:49:01',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'products',
- 'standard': 'Yes',
- 'title': 'Products'
- },
-
- # These values are common for all Page Role
- {
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'products',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, products
- {
- 'doctype': 'Page',
- 'name': 'products'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/templates/css/blog.css b/erpnext/website/templates/css/blog.css
new file mode 100644
index 0000000000..199df1ac77
--- /dev/null
+++ b/erpnext/website/templates/css/blog.css
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/blog_page.css b/erpnext/website/templates/css/blog_page.css
new file mode 100644
index 0000000000..928b8acb37
--- /dev/null
+++ b/erpnext/website/templates/css/blog_page.css
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/login.css b/erpnext/website/templates/css/login.css
new file mode 100644
index 0000000000..4e3e4b122c
--- /dev/null
+++ b/erpnext/website/templates/css/login.css
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/product_page.css b/erpnext/website/templates/css/product_page.css
new file mode 100644
index 0000000000..2708625cf2
--- /dev/null
+++ b/erpnext/website/templates/css/product_page.css
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/products.css b/erpnext/website/templates/css/products.css
new file mode 100644
index 0000000000..73289c4e20
--- /dev/null
+++ b/erpnext/website/templates/css/products.css
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/base.html b/erpnext/website/templates/html/base.html
similarity index 100%
rename from erpnext/website/templates/base.html
rename to erpnext/website/templates/html/base.html
diff --git a/erpnext/website/templates/blog/blog.html b/erpnext/website/templates/html/blog_page.html
similarity index 72%
rename from erpnext/website/templates/blog/blog.html
rename to erpnext/website/templates/html/blog_page.html
index d87b128ddc..c07706af4b 100644
--- a/erpnext/website/templates/blog/blog.html
+++ b/erpnext/website/templates/html/blog_page.html
@@ -1,26 +1,41 @@
-{% extends "blog/blog.js" %}
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/blog_page.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/blog_page.css" %}
+{% endblock %}
{% block content %}
+
{{ title }}
+
+
By {{ full_name }} on {{ updated }}
{{ content_html }}
Comments
+
+
+
-{% endblock %}
-
-{% block css %}
-
-
{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/blog/comment.html b/erpnext/website/templates/html/comment.html
similarity index 100%
rename from erpnext/website/templates/blog/comment.html
rename to erpnext/website/templates/html/comment.html
diff --git a/erpnext/website/templates/outer.html b/erpnext/website/templates/html/outer.html
similarity index 91%
rename from erpnext/website/templates/outer.html
rename to erpnext/website/templates/html/outer.html
index 4b8c04dcab..47184fa28c 100644
--- a/erpnext/website/templates/outer.html
+++ b/erpnext/website/templates/html/outer.html
@@ -2,7 +2,7 @@
requires, brand, top_bar_items, footer_items, copyright, content
#}
-{% extends "base.html" %}
+{% extends "html/base.html" %}
{% block body %}
@@ -31,7 +31,7 @@
@@ -50,7 +50,9 @@
data-label="{{ item.label }}">{{ item.label }}
{% endfor %}
+ {% if copyright %}
diff --git a/erpnext/website/templates/page.html b/erpnext/website/templates/html/page.html
similarity index 87%
rename from erpnext/website/templates/page.html
rename to erpnext/website/templates/html/page.html
index c6e0715232..e2eb6f4824 100644
--- a/erpnext/website/templates/page.html
+++ b/erpnext/website/templates/html/page.html
@@ -1,10 +1,9 @@
-{% extends "outer.html" %}
+{% extends "html/outer.html" %}
{% block title %}{{ title }}{% endblock %}
{% block header %}
{{ super() }}
- {% if insert_code %}
- {% endif %}
{% block css %}
{% if insert_style %}
diff --git a/erpnext/website/templates/product/product.html b/erpnext/website/templates/html/product_page.html
similarity index 62%
rename from erpnext/website/templates/product/product.html
rename to erpnext/website/templates/html/product_page.html
index 6f33ec9508..646bba9501 100644
--- a/erpnext/website/templates/product/product.html
+++ b/erpnext/website/templates/html/product_page.html
@@ -1,4 +1,12 @@
-{% extends "product/product.js" %}
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/product_page.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/product_page.css" %}
+{% endblock %}
{% block title %}
{% if item_name != name %}
@@ -37,41 +45,4 @@
-{% endblock %}
-
-{% block css %}
-
-{% endblock %}
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/web_page.html b/erpnext/website/templates/html/web_page.html
similarity index 81%
rename from erpnext/website/templates/web_page.html
rename to erpnext/website/templates/html/web_page.html
index 8188e71373..6fa7d27b99 100644
--- a/erpnext/website/templates/web_page.html
+++ b/erpnext/website/templates/html/web_page.html
@@ -1,4 +1,10 @@
-{% extends "page.html" %}
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% if insert_code %}
+ {{ javascript }}
+ {% endif %}
+{% endblock %}
{% block content %}
diff --git a/erpnext/website/templates/blog/blog_list.js b/erpnext/website/templates/js/blog.js
similarity index 96%
rename from erpnext/website/templates/blog/blog_list.js
rename to erpnext/website/templates/js/blog.js
index 70628c1540..1212a84c8e 100644
--- a/erpnext/website/templates/blog/blog_list.js
+++ b/erpnext/website/templates/js/blog.js
@@ -1,6 +1,3 @@
-{% extends "page.html" %}
-
-{% block javascript %}
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
@@ -43,6 +40,4 @@ wn.pages['{{ name }}'].onload = function(wrapper) {
page_length: 10
});
erpnext.blog_list.run();
-}
-
-{% endblock %}
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/blog/blog.js b/erpnext/website/templates/js/blog_page.js
similarity index 95%
rename from erpnext/website/templates/blog/blog.js
rename to erpnext/website/templates/js/blog_page.js
index 24d5033719..7121677855 100644
--- a/erpnext/website/templates/blog/blog.js
+++ b/erpnext/website/templates/js/blog_page.js
@@ -1,6 +1,3 @@
-{% extends "page.html" %}
-
-{% block javascript %}
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
@@ -18,6 +15,7 @@
// along with this program. If not, see
.
// js inside blog page
+
wn.provide('erpnext.blog');
wn.pages['{{ name }}'].onload = function(wrapper) {
erpnext.blog.wrapper = wrapper;
@@ -79,6 +77,7 @@ erpnext.blog.toggle_no_result = function(wrapper) {
var $blog_comments = $(wrapper).find('.blog-comments');
var $comment_rows = $blog_comments.find('.comment-row');
var $no_result = $blog_comments.find('.no-result');
+
if ($comment_rows.length == 0) {
$no_result.removeClass('hide');
} else {
@@ -156,9 +155,9 @@ erpnext.blog.add_comment_to_page = function(wrapper, comment) {
$comment_rows = $blog_comments.find('.comment-row');
if ($comment_rows.length) {
- $comment_rows.last().after(comment);
+ $blog_comments.append(comment);
} else {
- $blog_comments.find('.no-result').after(comment);
+ $blog_comments.append(comment);
}
erpnext.blog.toggle_no_result(wrapper);
@@ -170,7 +169,12 @@ erpnext.blog.toggle_add_comment_btn = function(wrapper) {
if ($wrapper.find('.blog-comments .comment-row').length > 50) {
var $comment_btn = $wrapper.find('button.add-comment');
$comment_btn.addClass('hide');
+
+ // show comments are close
+ $wrapper.find('.blog-comments').append("\
+
\
+
Comments Closed
\
+
\
+
");
}
-}
-
-{% endblock %}
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/login/login.js b/erpnext/website/templates/js/login.js
similarity index 59%
rename from erpnext/website/templates/login/login.js
rename to erpnext/website/templates/js/login.js
index d6b6b24147..29e49226fc 100644
--- a/erpnext/website/templates/login/login.js
+++ b/erpnext/website/templates/js/login.js
@@ -1,28 +1,18 @@
-{% extends "page.html" %}
-
-{% block javascript %}
-{{ super() }}
-// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
-// MIT License (MIT)
+// 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.
//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// 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
.
wn.provide('erpnext.login');
@@ -98,6 +88,4 @@ erpnext.login.show_forgot_password = function(){
})
})
d.show();
-}
-
-{% endblock %}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/product/product_category.js b/erpnext/website/templates/js/product_category.js
similarity index 89%
rename from erpnext/website/templates/product/product_category.js
rename to erpnext/website/templates/js/product_category.js
index e1905ac95a..4229d00c6c 100644
--- a/erpnext/website/templates/product/product_category.js
+++ b/erpnext/website/templates/js/product_category.js
@@ -1,7 +1,5 @@
-{% extends "page.html" %}
-
-{% block javascript %}
wn.provide('erpnext.products');
+
erpnext.products.make_product_categories = function(wrapper) {
if (!wrapper) { wrapper = erpnext.products.wrapper; }
if (!wrapper) { return; }
@@ -17,6 +15,4 @@ erpnext.products.make_product_categories = function(wrapper) {
}
});
wrapper.category_list.run();
-}
-
-{% endblock %}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/product/product.js b/erpnext/website/templates/js/product_page.js
similarity index 96%
rename from erpnext/website/templates/product/product.js
rename to erpnext/website/templates/js/product_page.js
index f7745d7b1f..0c4abb4195 100644
--- a/erpnext/website/templates/product/product.js
+++ b/erpnext/website/templates/js/product_page.js
@@ -1,7 +1,3 @@
-{% extends "product/product_category.js" %}
-
-{% block javascript %}
-{{ super() }}
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
@@ -17,7 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
.
-wn.provide('erpnext.products');
+
+{% include "js/product_category.js" %}
+
wn.pages['{{ name }}'].onload = function(wrapper) {
wrapper.product_group = "{{ item_group }}";
wrapper.product_name = "{{ name }}";
@@ -91,6 +89,4 @@ erpnext.products.make_similar_products = function(wrapper) {
}
});
wrapper.similar.run();
-}
-
-{% endblock %}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/product/product_list.js b/erpnext/website/templates/js/products.js
similarity index 96%
rename from erpnext/website/templates/product/product_list.js
rename to erpnext/website/templates/js/products.js
index 1c6f934e80..f4c68cbf80 100644
--- a/erpnext/website/templates/product/product_list.js
+++ b/erpnext/website/templates/js/products.js
@@ -1,8 +1,3 @@
-{% extends "product/product_category.js" %}
-
-{% block javascript %}
-{{ super() }}
-
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
@@ -20,7 +15,8 @@
// along with this program. If not, see
.
// js inside blog page
-wn.provide('erpnext.products');
+
+{% include "js/product_category.js" %}
wn.pages['{{ name }}'].onload = function(wrapper) {
erpnext.products.wrapper = wrapper;
@@ -107,6 +103,4 @@ erpnext.products.get_group = function() {
erpnext.products.cur_group = null;
}
return {grp:grp, label:label};
-}
-
-{% endblock %}
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/404.html b/erpnext/website/templates/pages/404.html
similarity index 90%
rename from erpnext/website/templates/404.html
rename to erpnext/website/templates/pages/404.html
index 8a30892a66..042360823f 100644
--- a/erpnext/website/templates/404.html
+++ b/erpnext/website/templates/pages/404.html
@@ -1,4 +1,4 @@
-{% extends "outer.html" %}
+{% extends "html/outer.html" %}
{% block content %}
diff --git a/erpnext/website/templates/blog/blog_list.html b/erpnext/website/templates/pages/blog.html
similarity index 81%
rename from erpnext/website/templates/blog/blog_list.html
rename to erpnext/website/templates/pages/blog.html
index 242f814a9c..40c90c29a3 100644
--- a/erpnext/website/templates/blog/blog_list.html
+++ b/erpnext/website/templates/pages/blog.html
@@ -1,17 +1,15 @@
-{% extends "blog/blog_list.js" %}
+{% extends "html/page.html" %}
-{% block title %}Blog{% endblock %}
+{% block javascript %}
+ {% include "js/blog.js" %}
+{% endblock %}
{% block css %}
-
+ {% include "css/blog.css" %}
{% endblock %}
+{% block title %}Blog{% endblock %}
+
{% block content %}
diff --git a/erpnext/website/templates/pages/index.html b/erpnext/website/templates/pages/index.html
new file mode 100644
index 0000000000..1307872d4e
--- /dev/null
+++ b/erpnext/website/templates/pages/index.html
@@ -0,0 +1 @@
+{% extends "html/web_page.html" %}
\ No newline at end of file
diff --git a/erpnext/website/templates/login/login.html b/erpnext/website/templates/pages/login.html
similarity index 86%
rename from erpnext/website/templates/login/login.html
rename to erpnext/website/templates/pages/login.html
index 62d252f5d2..9bc3171128 100644
--- a/erpnext/website/templates/login/login.html
+++ b/erpnext/website/templates/pages/login.html
@@ -1,4 +1,12 @@
-{% extends "login/login.js" %}
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/login.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/login.css" %}
+{% endblock %}
{% block title %}
Login Page
@@ -41,17 +49,4 @@
-{% endblock %}
-
-{% block css %}
-
{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/product/product_list.html b/erpnext/website/templates/pages/products.html
similarity index 80%
rename from erpnext/website/templates/product/product_list.html
rename to erpnext/website/templates/pages/products.html
index c8dfd24ed0..aa23ea29c4 100644
--- a/erpnext/website/templates/product/product_list.html
+++ b/erpnext/website/templates/pages/products.html
@@ -1,4 +1,12 @@
-{% extends "product/product_list.js" %}
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/products.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/products.css" %}
+{% endblock %}
{% block title %}
Products
@@ -26,18 +34,4 @@
-{% endblock %}
-
-{% block css %}
-
{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/utils.py b/erpnext/website/utils.py
index 06bb60d94b..22fcce741f 100644
--- a/erpnext/website/utils.py
+++ b/erpnext/website/utils.py
@@ -17,6 +17,12 @@
import webnotes
from webnotes.model.doc import Document
+def scrub_page_name(page_name):
+ if page_name.endswith('.html'):
+ page_name = page_name[:-5]
+
+ return page_name
+
def make_template(doc, path, convert_fields = ['main_section', 'side_section']):
"""make template"""
import os, jinja2
@@ -35,82 +41,3 @@ def page_name(title):
name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4])
-
-def get_header(page_name):
- """get page header"""
-
- from webnotes.model.doc import Document
- from jinja2 import Template
- import webnotes.utils
-
- def get_item(l, label):
- for i in l:
- if i['label']==label:
- return i
-
- top_bar_items = webnotes.conn.sql("""select * from `tabTop Bar Item`
- where parent='Website Settings' and parentfield='top_bar_items'
- order by idx asc""", as_dict=1)
-
- # build child items
- for t in top_bar_items:
- if t.get('parent_label'):
- pi = get_item(top_bar_items, t['parent_label'])
- if 'child_items' not in pi:
- pi['child_items'] = []
- pi['child_items'].append(t)
-
- website_settings = Document('Website Settings', 'Website Settings')
-
- return Template("""""").render(top_bar_items = top_bar_items,
- brand=website_settings.brand_html or webnotes.utils.get_defaults('company') or 'ERPNext')
-
-def get_footer(page_name):
- """get page footer"""
-
- from webnotes.model.doc import Document
- from jinja2 import Template
-
- website_settings = Document('Website Settings', 'Website Settings')
-
- website_settings.footer_items = webnotes.conn.sql("""select * from `tabTop Bar Item`
- where parent='Website Settings' and parentfield='footer_items'
- order by idx asc""", as_dict=1)
-
- return Template("""
Be the first one to comment