\ 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 5a10998c6f8..00000000000
--- 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 97901141544..00000000000
--- 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 4443ec813d9..00000000000
--- 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 e69de29bb2d..00000000000
diff --git a/erpnext/website/page/contact/contact.js b/erpnext/website/page/contact/contact.js
deleted file mode 100644
index c7943256319..00000000000
--- 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 1ee3ab9efc3..00000000000
--- 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 6051c6f2c95..00000000000
--- 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 e40b44629f1..00000000000
--- 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 e69de29bb2d..00000000000
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
deleted file mode 100644
index 30eca4a2e13..00000000000
--- a/erpnext/website/page/products/products.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
Categories
-
-
-
-
\ No newline at end of file
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/product.py b/erpnext/website/product.py
new file mode 100644
index 00000000000..aff15d95f3f
--- /dev/null
+++ b/erpnext/website/product.py
@@ -0,0 +1,116 @@
+import webnotes
+
+@webnotes.whitelist(allow_guest=True)
+def get_product_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 20,
+ 'search': '',
+ 'product_group': '',
+ }
+ """
+ import webnotes
+ from webnotes.utils import cstr, cint
+
+ if not args: args = webnotes.form_dict
+
+ # base query
+ query = """\
+ select name, item_name, page_name, website_image,
+ description, web_short_description
+ from `tabItem`
+ where is_sales_item = 'Yes'
+ and docstatus = 0
+ and show_in_website = 1"""
+
+ # search term condition
+ if args.get('search'):
+ query += """
+ and (
+ web_short_description like %(search)s or
+ web_long_description like %(search)s or
+ description like %(search)s or
+ item_name like %(search)s or
+ name like %(search)s
+ )"""
+ args['search'] = "%" + cstr(args.get('search')) + "%"
+
+ # product group condition
+ if args.get('product_group') and args.get('product_group') != 'All Products':
+ query += """
+ and item_group = %(product_group)s"""
+
+ # order by
+ query += """
+ order by item_name asc, name asc"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+ return webnotes.conn.sql(query, args, as_dict=1)
+
+@webnotes.whitelist(allow_guest=True)
+def get_product_category_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 5,
+ }
+ """
+ import webnotes
+
+ if not args: args = webnotes.form_dict
+
+ query = """\
+ select count(name) as items, item_group
+ from `tabItem`
+ where is_sales_item = 'Yes'
+ and docstatus = 0
+ and show_in_website = 1
+ group by item_group
+ order by items desc"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+
+ result = webnotes.conn.sql(query, args, as_dict=1)
+
+ # add All Products link
+ total_count = sum((r.get('items') or 0 for r in result))
+ result = [{'items': total_count, 'item_group': 'All Products'}] + (result or [])
+
+ return result
+
+@webnotes.whitelist(allow_guest=True)
+def get_similar_product_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 5,
+ 'product_name': '',
+ 'product_group': '',
+ }
+ """
+ import webnotes
+
+ if not args: args = webnotes.form_dict
+
+ query = """\
+ select name, item_name, page_name, website_image,
+ description, web_short_description
+ from `tabItem`
+ where is_sales_item = 'Yes'
+ and docstatus = 0
+ and show_in_website = 1
+ and name != %(product_name)s
+ and item_group = %(product_group)s
+ order by item_name"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+ result = webnotes.conn.sql(query, args, as_dict=1)
+
+ return result
\ No newline at end of file
diff --git a/erpnext/website/page/blog/__init__.py b/erpnext/website/templates/__init__.py
similarity index 100%
rename from erpnext/website/page/blog/__init__.py
rename to erpnext/website/templates/__init__.py
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/html/base.html b/erpnext/website/templates/html/base.html
new file mode 100644
index 00000000000..8639a8f546e
--- /dev/null
+++ b/erpnext/website/templates/html/base.html
@@ -0,0 +1,27 @@
+
+
+
+ {% block title %}{% endblock %}
+
+
+
+
+
+
+
+ {% if favicon %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
+
+ {% block header %}
+ {% endblock %}
+
+
+ {% block body %}
+ {% endblock %}
+
\ No newline at end of file
diff --git a/erpnext/website/templates/html/blog_page.html b/erpnext/website/templates/html/blog_page.html
new file mode 100644
index 00000000000..e9c16461748
--- /dev/null
+++ b/erpnext/website/templates/html/blog_page.html
@@ -0,0 +1,58 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/blog_page.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/blog_page.css" %}
+{% endblock %}
+
+{% block content %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/comment.html b/erpnext/website/templates/html/comment.html
new file mode 100644
index 00000000000..1323e094d22
--- /dev/null
+++ b/erpnext/website/templates/html/comment.html
@@ -0,0 +1,14 @@
+{#
+ this template generates comment rows for a blog
+ it is to be included in the blog/blog.html template
+#}
+
+{% for comment in comment_list %}
+
{{ comment.comment }}
++