-
-
-
-
\ 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 1e8dcaab039..00000000000
--- 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 f00a05b8e84..00000000000
--- 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 00000000000..199df1ac779
--- /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 00000000000..928b8acb373
--- /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 00000000000..4e3e4b122ce
--- /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 00000000000..2708625cf23
--- /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 00000000000..73289c4e203
--- /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 71%
rename from erpnext/website/templates/blog/blog.html
rename to erpnext/website/templates/html/blog_page.html
index d87b128ddcb..c07706af4bd 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 90%
rename from erpnext/website/templates/outer.html
rename to erpnext/website/templates/html/outer.html
index 4b8c04dcab1..47184fa28c9 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 85%
rename from erpnext/website/templates/page.html
rename to erpnext/website/templates/html/page.html
index c6e07152321..e2eb6f48242 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 6f33ec95085..646bba95011 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 @@
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 70628c15402..1212a84c8ec 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 24d50337196..71216778555 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 d6b6b24147a..29e49226fcc 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 e1905ac95a9..4229d00c6c5 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 f7745d7b1ff..0c4abb4195e 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 1c6f934e808..f4c68cbf80e 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 86%
rename from erpnext/website/templates/404.html
rename to erpnext/website/templates/pages/404.html
index 8a30892a663..042360823fb 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 79%
rename from erpnext/website/templates/blog/blog_list.html
rename to erpnext/website/templates/pages/blog.html
index 242f814a9c6..40c90c29a35 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 00000000000..1307872d4e0
--- /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 85%
rename from erpnext/website/templates/login/login.html
rename to erpnext/website/templates/pages/login.html
index 62d252f5d2c..9bc31711288 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 79%
rename from erpnext/website/templates/product/product_list.html
rename to erpnext/website/templates/pages/products.html
index c8dfd24ed03..aa23ea29c41 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 06bb60d94b4..22fcce741f2 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("""
Be the first one to comment