More Categories
diff --git a/erpnext/utilities/page/messages/messages.py b/erpnext/utilities/page/messages/messages.py
index 212a2686b09..db27805e7e8 100644
--- a/erpnext/utilities/page/messages/messages.py
+++ b/erpnext/utilities/page/messages/messages.py
@@ -55,6 +55,7 @@ def get_active_users(arg=None):
@webnotes.whitelist()
def post(arg=None):
+ import webnotes
"""post message"""
if arg:
import json
diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css
index fa27d4a9f8a..a68209f4395 100644
--- a/erpnext/website/css/website.css
+++ b/erpnext/website/css/website.css
@@ -65,21 +65,7 @@ pre {
footer {
- background-color: #eee;
- box-shadow: inset 0 10px 10px rgba(0,0,0,0.3), inset 0 3px 3px rgba(0,0,0,0.3);
- border-top: 1px solid #555;
- padding-top: 10px;
- text-align: center;
-}
-.web-footer {
- color: inherit;
- padding: 10px;
- line-height: 1.7;
-}
-
-.web-footer div, .web-footer a {
- font-size: 12px;
}
.web-footer-menu {
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index c78a9cc3b90..37f77a5c950 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -33,6 +33,10 @@ class DocType():
def validate(self):
"""write/update 'Page' with the blog"""
+ # we need the name for the templates
+ if not self.doc.name:
+ self.autoname()
+
if self.doc.page_name:
webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name)
diff --git a/erpnext/website/doctype/product/__init__.py b/erpnext/website/doctype/product/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/website/doctype/product/product.js b/erpnext/website/doctype/product/product.js
deleted file mode 100644
index ebdc90aa108..00000000000
--- a/erpnext/website/doctype/product/product.js
+++ /dev/null
@@ -1,22 +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
.
-
-$.extend(cur_frm.cscript, {
- onload: function() {
- cur_frm.add_fetch('item', 'description', 'short_description');
- cur_frm.add_fetch('item', 'item_name', 'title');
- }
-});
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py
deleted file mode 100644
index 4abddc037a6..00000000000
--- a/erpnext/website/doctype/product/product.py
+++ /dev/null
@@ -1,57 +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
-
-class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
-
- def validate(self):
- """make page for this product"""
- import website.utils
-
- p = website.utils.add_page("Product " + self.doc.title)
-
- from jinja2 import Template
- import markdown2
- import os
-
- self.doc.item_group = webnotes.conn.get_value('Item', self.doc.item, 'item_group')
- self.doc.long_description_html = markdown2.markdown(self.doc.long_description or '')
-
- with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
- p.content = Template(f.read()).render(doc=self.doc)
-
- with open(os.path.join(os.path.dirname(__file__), 'product_page.js'), 'r') as f:
- p.script = Template(f.read()).render(doc=self.doc)
-
- p.save()
-
- website.utils.add_guest_access_to_page(p.name)
- self.doc.page_name = p.name
- self.make_item_group_active()
-
- del self.doc.fields['long_description_html']
- del self.doc.fields['item_group']
-
- def make_item_group_active(self):
- """show item group in website"""
- if self.doc.published:
- from webnotes.model.doc import Document
- ig = Document('Item Group', self.doc.item_group)
- ig.show_in_website = 1
- ig.save()
diff --git a/erpnext/website/doctype/product/product.txt b/erpnext/website/doctype/product/product.txt
deleted file mode 100644
index 7d9c7704f55..00000000000
--- a/erpnext/website/doctype/product/product.txt
+++ /dev/null
@@ -1,266 +0,0 @@
-# DocType, Product
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-03-27 14:36:47',
- 'docstatus': 0,
- 'modified': '2012-03-27 14:36:47',
- 'modified_by': u'Administrator',
- 'owner': u'Administrator'
- },
-
- # These values are common for all DocType
- {
- '_last_update': u'1327997783',
- 'allow_attach': 1,
- 'autoname': u'field:item',
- 'colour': u'White:FFF',
- 'description': u'A Product is shown on the website and is linked to an item.',
- 'doctype': 'DocType',
- 'document_type': u'Master',
- 'max_attachments': 5,
- 'module': u'Website',
- 'name': '__common__',
- 'section_style': u'Simple',
- 'show_in_menu': 0,
- 'version': 12
- },
-
- # These values are common for all DocField
- {
- 'doctype': u'DocField',
- 'name': '__common__',
- 'parent': u'Product',
- 'parentfield': u'fields',
- 'parenttype': u'DocType'
- },
-
- # These values are common for all DocPerm
- {
- 'amend': 0,
- 'create': 1,
- 'doctype': u'DocPerm',
- 'name': '__common__',
- 'parent': u'Product',
- 'parentfield': u'permissions',
- 'parenttype': u'DocType',
- 'permlevel': 0,
- 'read': 1,
- 'submit': 0,
- 'write': 1
- },
-
- # DocType, Product
- {
- 'doctype': 'DocType',
- 'name': u'Product'
- },
-
- # DocPerm
- {
- 'cancel': 0,
- 'doctype': u'DocPerm',
- 'role': u'Sales Manager'
- },
-
- # DocPerm
- {
- 'cancel': 0,
- 'doctype': u'DocPerm',
- 'role': u'Sales User'
- },
-
- # DocPerm
- {
- 'cancel': 1,
- 'doctype': u'DocPerm',
- 'role': u'Website Manager'
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'item',
- 'fieldtype': u'Link',
- 'label': u'Item',
- 'options': u'Item',
- 'permlevel': 0,
- 'reqd': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'title',
- 'fieldtype': u'Data',
- 'label': u'Title',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'published',
- 'fieldtype': u'Check',
- 'label': u'Published',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Select Price List for the web. Leave blank to hide price.',
- 'doctype': u'DocField',
- 'fieldname': u'price_list',
- 'fieldtype': u'Link',
- 'label': u'Price List',
- 'options': u'Price List',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Select shipping warehouse to show "In Stock" or "Out of Stock". To hide, leave blank',
- 'doctype': u'DocField',
- 'fieldname': u'warehouse',
- 'fieldtype': u'Link',
- 'label': u'Warehouse',
- 'options': u'Warehouse',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'column_break0',
- 'fieldtype': u'Column Break',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Image for listing (Width: 100px) (Attach First)',
- 'doctype': u'DocField',
- 'fieldname': u'thumbnail_image',
- 'fieldtype': u'Select',
- 'label': u'Thumbnail Image',
- 'options': u'attach_files:',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Image for listing (Width: 300px) (Attach First)',
- 'doctype': u'DocField',
- 'fieldname': u'full_image',
- 'fieldtype': u'Select',
- 'label': u'Full Image',
- 'options': u'attach_files:',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'short_description',
- 'fieldtype': u'Text',
- 'label': u'Short Description',
- 'permlevel': 0,
- 'reqd': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'section_break0',
- 'fieldtype': u'Section Break',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Full description (formatted as markdown)',
- 'doctype': u'DocField',
- 'fieldname': u'long_description',
- 'fieldtype': u'Code',
- 'label': u'Long Description',
- 'permlevel': 0,
- 'reqd': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'section_break1',
- 'fieldtype': u'Section Break',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'page_name',
- 'fieldtype': u'Data',
- 'label': u'Page Name',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'price',
- 'fieldtype': u'Currency',
- 'hidden': 0,
- 'label': u'Price',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'sales',
- 'fieldtype': u'Currency',
- 'label': u'Sales',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'stock',
- 'fieldtype': u'Currency',
- 'label': u'Stock',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'currency',
- 'fieldtype': u'Link',
- 'label': u'Currency',
- 'options': u'Currency',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'file_list',
- 'fieldtype': u'Text',
- 'hidden': 1,
- 'label': u'File List',
- 'no_copy': 1,
- 'permlevel': 0,
- 'print_hide': 1
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/doctype/product_group/__init__.py b/erpnext/website/doctype/product_group/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/website/doctype/product_group/product_group.txt b/erpnext/website/doctype/product_group/product_group.txt
deleted file mode 100644
index e199b86fc62..00000000000
--- a/erpnext/website/doctype/product_group/product_group.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-# DocType, Product Group
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-03-27 14:36:48',
- 'docstatus': 0,
- 'modified': '2012-03-27 14:36:48',
- 'modified_by': u'Administrator',
- 'owner': u'Administrator'
- },
-
- # These values are common for all DocType
- {
- 'colour': u'White:FFF',
- 'doctype': 'DocType',
- 'istable': 1,
- 'module': u'Website',
- 'name': '__common__',
- 'section_style': u'Simple',
- 'show_in_menu': 0,
- 'version': 1
- },
-
- # These values are common for all DocField
- {
- 'doctype': u'DocField',
- 'name': '__common__',
- 'parent': u'Product Group',
- 'parentfield': u'fields',
- 'parenttype': u'DocType',
- 'permlevel': 0
- },
-
- # DocType, Product Group
- {
- 'doctype': 'DocType',
- 'name': u'Product Group'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'item_group',
- 'fieldtype': u'Link',
- 'label': u'Item Group',
- 'options': u'Item Group'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'label',
- 'fieldtype': u'Data',
- 'label': u'Label'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/doctype/products_settings/__init__.py b/erpnext/website/doctype/products_settings/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/website/doctype/products_settings/products_settings.py b/erpnext/website/doctype/products_settings/products_settings.py
deleted file mode 100644
index 23c247dfecd..00000000000
--- a/erpnext/website/doctype/products_settings/products_settings.py
+++ /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
.
-
-import webnotes
-
-class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
-
- def on_update(self):
- tmp = None
- for d in self.doclist:
- if d.doctype=="Product Group":
- import json
- tmp = json.dumps({"item_group": d.item_group, "label":d.label})
- break
-
- webnotes.conn.set_default("default_product_category", tmp)
-
- from webnotes.session_cache import clear_cache
- clear_cache('Guest')
\ No newline at end of file
diff --git a/erpnext/website/doctype/products_settings/products_settings.txt b/erpnext/website/doctype/products_settings/products_settings.txt
deleted file mode 100644
index 31d207475ee..00000000000
--- a/erpnext/website/doctype/products_settings/products_settings.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# DocType, Products Settings
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-03-27 14:36:48',
- 'docstatus': 0,
- 'modified': '2012-03-27 14:36:48',
- 'modified_by': u'Administrator',
- 'owner': u'Administrator'
- },
-
- # These values are common for all DocType
- {
- '_last_update': u'1327911653',
- 'colour': u'White:FFF',
- 'description': u'\n\n',
- 'doctype': 'DocType',
- 'issingle': 1,
- 'module': u'Website',
- 'name': '__common__',
- 'section_style': u'Simple',
- 'show_in_menu': 0,
- 'version': 4
- },
-
- # These values are common for all DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Product Groups that are listed on the website. The first product group from this list will be listed by default on the "Products Page"',
- 'doctype': u'DocField',
- 'fieldname': u'groups',
- 'fieldtype': u'Table',
- 'label': u'Groups',
- 'name': '__common__',
- 'options': u'Product Group',
- 'parent': u'Products Settings',
- 'parentfield': u'fields',
- 'parenttype': u'DocType',
- 'permlevel': 0
- },
-
- # These values are common for all DocPerm
- {
- 'create': 1,
- 'doctype': u'DocPerm',
- 'name': '__common__',
- 'parent': u'Products Settings',
- 'parentfield': u'permissions',
- 'parenttype': u'DocType',
- 'permlevel': 0,
- 'read': 1,
- 'role': u'Website Manager',
- 'write': 1
- },
-
- # DocType, Products Settings
- {
- 'doctype': 'DocType',
- 'name': u'Products Settings'
- },
-
- # DocPerm
- {
- 'doctype': u'DocPerm'
- },
-
- # DocField
- {
- 'doctype': u'DocField'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py
index ff8a9049ac1..7f50d53d1cf 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -27,8 +27,13 @@ class DocType:
def validate(self):
"""make page for this product"""
- if not self.doc.name:
- self.doc.name = website.utils.page_name(self.doc.title)
+
+ # we need the name for the templates
+ if not self.doc.name:
+ self.autoname()
+
+ if self.doc.page_name:
+ webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name)
p = website.utils.add_page(self.doc.name)
@@ -38,9 +43,7 @@ class DocType:
self.doc.updated = global_date_format(self.doc.modified)
website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
-
- self.add_page_links()
-
+
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
p.content = Template(f.read()).render(doc=self.doc)
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index fb6febdbc7d..f5d128005d9 100644
--- a/erpnext/website/doctype/web_page/web_page.txt
+++ b/erpnext/website/doctype/web_page/web_page.txt
@@ -5,7 +5,7 @@
{
'creation': '2012-04-02 16:02:43',
'docstatus': 0,
- 'modified': '2012-04-25 16:03:57',
+ 'modified': '2012-04-28 10:03:45',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -22,7 +22,7 @@
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
- 'version': 16
+ 'version': 17
},
# These values are common for all DocField
@@ -31,8 +31,7 @@
'name': '__common__',
'parent': u'Web Page',
'parentfield': u'fields',
- 'parenttype': u'DocType',
- 'permlevel': 0
+ 'parenttype': u'DocType'
},
# These values are common for all DocPerm
@@ -71,7 +70,8 @@
'doctype': u'DocField',
'fieldname': u'sb0',
'fieldtype': u'Section Break',
- 'label': u'Title and Style'
+ 'label': u'Title and Style',
+ 'permlevel': 0
},
# DocField
@@ -82,6 +82,7 @@
'fieldname': u'title',
'fieldtype': u'Data',
'label': u'Title',
+ 'permlevel': 0,
'reqd': 1
},
@@ -90,6 +91,7 @@
'doctype': u'DocField',
'fieldname': u'cb1',
'fieldtype': u'Column Break',
+ 'permlevel': 0,
'width': u'50%'
},
@@ -99,7 +101,8 @@
'fieldname': u'layout',
'fieldtype': u'Select',
'label': u'Layout',
- 'options': u'Two column with header\nTwo column\nSingle column'
+ 'options': u'Two column with header\nTwo column\nSingle column',
+ 'permlevel': 0
},
# DocField
@@ -109,7 +112,8 @@
'doctype': u'DocField',
'fieldname': u'sb1',
'fieldtype': u'Section Break',
- 'label': u'Content'
+ 'label': u'Content',
+ 'permlevel': 0
},
# DocField
@@ -119,7 +123,8 @@
'doctype': u'DocField',
'fieldname': u'head_section',
'fieldtype': u'Text',
- 'label': u'Head Section'
+ 'label': u'Head Section',
+ 'permlevel': 0
},
# DocField
@@ -129,7 +134,8 @@
'doctype': u'DocField',
'fieldname': u'main_section',
'fieldtype': u'Code',
- 'label': u'Main Section'
+ 'label': u'Main Section',
+ 'permlevel': 0
},
# DocField
@@ -139,7 +145,8 @@
'doctype': u'DocField',
'fieldname': u'side_section',
'fieldtype': u'Code',
- 'label': u'Side Section'
+ 'label': u'Side Section',
+ 'permlevel': 0
},
# DocField
@@ -149,7 +156,8 @@
'doctype': u'DocField',
'fieldname': u'sb2',
'fieldtype': u'Section Break',
- 'label': u'More'
+ 'label': u'More',
+ 'permlevel': 0
},
# DocField
@@ -158,7 +166,8 @@
'fieldname': u'text_align',
'fieldtype': u'Select',
'label': u'Text Align',
- 'options': u'Left\nCenter\nRight'
+ 'options': u'Left\nCenter\nRight',
+ 'permlevel': 0
},
# DocField
@@ -167,7 +176,8 @@
'doctype': u'DocField',
'fieldname': u'insert_code',
'fieldtype': u'Check',
- 'label': u'Insert Code'
+ 'label': u'Insert Code',
+ 'permlevel': 0
},
# DocField
@@ -175,7 +185,8 @@
'doctype': u'DocField',
'fieldname': u'javascript',
'fieldtype': u'Code',
- 'label': u'Javascript'
+ 'label': u'Javascript',
+ 'permlevel': 0
},
# DocField
@@ -183,7 +194,8 @@
'doctype': u'DocField',
'fieldname': u'insert_style',
'fieldtype': u'Check',
- 'label': u'Insert Style'
+ 'label': u'Insert Style',
+ 'permlevel': 0
},
# DocField
@@ -191,7 +203,17 @@
'doctype': u'DocField',
'fieldname': u'css',
'fieldtype': u'Code',
- 'label': u'CSS'
+ 'label': u'CSS',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'page_name',
+ 'fieldtype': u'Data',
+ 'label': u'Page Name',
+ 'permlevel': 1
},
# DocField
@@ -202,6 +224,7 @@
'hidden': 1,
'label': u'File List',
'no_copy': 1,
+ 'permlevel': 0,
'print_hide': 1
}
]
\ No newline at end of file
diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt
index ce2a18e0c21..71093dd180b 100644
--- a/erpnext/website/doctype/website_settings/website_settings.txt
+++ b/erpnext/website/doctype/website_settings/website_settings.txt
@@ -5,7 +5,7 @@
{
'creation': '2012-04-02 16:38:02',
'docstatus': 0,
- 'modified': '2012-04-27 16:41:40',
+ 'modified': '2012-04-30 14:20:56',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -23,7 +23,7 @@
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
- 'version': 11
+ 'version': 1
},
# These values are common for all DocField
@@ -109,6 +109,16 @@
'reqd': 1
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'default_product_category',
+ 'fieldtype': u'Link',
+ 'label': u'Default Product Category',
+ 'options': u'Item Group',
+ 'permlevel': 0
+ },
+
# DocField
{
'colour': u'White:FFF',
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js
index 956d7a65d3d..8d3f8988838 100644
--- a/erpnext/website/js/product_category.js
+++ b/erpnext/website/js/product_category.js
@@ -14,25 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
.
-// make sidelisting of categories
-erpnext.product_item_group = {}
-
erpnext.make_product_categories = function(wrapper) {
wrapper.category_list = new wn.ui.Listing({
parent: $(wrapper).find('.more-categories').get(0),
- query: 'select label, count(t2.name) as items, t1.item_group \
- from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\
- where t1.parent="Products Settings" \
- and t2.item = t3.name \
- and t3.item_group = t1.item_group \
- and ifnull(t2.published, 0)=1 \
- group by t1.item_group \
- order by t1.idx',
+ query: 'select count(name) as items, item_group \
+ from tabItem where is_sales_item="Yes" \
+ group by item_group order by items desc',
hide_refresh: true,
render_row: function(parent, data) {
- parent.innerHTML = repl('
%(label)s (%(items)s)',
+ parent.innerHTML = repl('
%(item_group)s (%(items)s)',
data);
- erpnext.product_item_group[data.label] = data.item_group;
}
});
wrapper.category_list.run();
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
index 3e460d269b0..30eca4a2e13 100644
--- a/erpnext/website/page/products/products.html
+++ b/erpnext/website/page/products/products.html
@@ -1,11 +1,12 @@
-
-
-
+
+
-
+
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
index 09ccba0ed24..d7abfe4d9a4 100644
--- a/erpnext/website/page/products/products.js
+++ b/erpnext/website/page/products/products.js
@@ -19,11 +19,10 @@ erpnext.products = {}
wn.require('erpnext/website/js/product_category.js');
pscript.onload_products = function(wrapper) {
- sys_defaults.default_product_category = JSON.parse(sys_defaults.default_product_category);
+ erpnext.make_product_categories(wrapper);
erpnext.products.wrapper = wrapper;
// make lists
- erpnext.make_product_categories(wrapper);
erpnext.products.make_product_list(wrapper);
// button
@@ -42,15 +41,15 @@ pscript.onshow_products = function(wrapper) {
}
erpnext.products.get_group = function() {
- var route = window.location.hash.split('/');
+ route = wn.get_route();
if(route.length>1) {
// from url
- var grp = erpnext.product_item_group[route[1]];
+ var grp = route[1];
var label = route[1];
} else {
// default
- var grp = sys_defaults.default_product_category.item_group;
- var label = sys_defaults.default_product_category.label;
+ 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};
@@ -58,32 +57,39 @@ erpnext.products.get_group = function() {
erpnext.products.make_product_list = function(wrapper) {
wrapper.mainlist = new wn.ui.Listing({
- parent: $(wrapper).find('.web-main-section').get(0),
+ parent: $(wrapper).find('.products-list').get(0),
run_btn: $(wrapper).find('.products-search .btn').get(0),
- hide_refresh: true,
+ no_toolbar: true,
get_query: function() {
var srch = $('input[name="products-search"]').val()
- var search_cond = 'and (t1.short_description like "%%(srch)s%"\
- or t1.title like "%%(srch)s%")';
+ 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 t1.name, t1.title, t1.thumbnail_image, \
- t1.page_name, t1.short_description \
- from tabProduct t1, tabItem t2 \
- where t1.item = t2.name \
- and ifnull(t1.published,0)=1 \
- and t2.item_group="%(cat)s" \
+ 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('
\
-
\
+ parent.innerHTML = repl('
\
+
\
\
-
', data);
+
%(item_name)s
\
+
%(description)s
\
+
', data);
+
+ if(data.website_image) {
+ $(parent).find('.img-area').append(repl(
+ '
', data))
+ } else {
+ $(parent).find('.img-area').append(wn.dom.placeholder(70,
+ data.item_name));
+ }
}
});
}
diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html
index ad8bb55fd97..76dab6a59cb 100644
--- a/erpnext/website/page/website_home/website_home.html
+++ b/erpnext/website/page/website_home/website_home.html
@@ -3,13 +3,11 @@
Website
+
Static (content) web page
-
-
Product listed in catolog
-
Weblog (blog) entry
@@ -19,9 +17,6 @@
Setup of fonts and background
-
-
-
Setup product categories
@@ -31,9 +26,19 @@
-
\ No newline at end of file
diff --git a/js/all-app.js b/js/all-app.js
index 07f04e188e9..0ac837f2578 100644
--- a/js/all-app.js
+++ b/js/all-app.js
@@ -170,17 +170,30 @@ var l=items.length;for(var i=0;i
%(letter)s ',args);}}
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
@@ -313,7 +326,7 @@ if(this.args)
$.extend(args,this.args)
if(this.get_args){$.extend(args,this.get_args(opts));}
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
-if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i
=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return this.$w.find('.result-list').append('').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
+if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i
=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
/*
* lib/js/wn/ui/filters.js
*/
@@ -1368,7 +1381,7 @@ wn.ui.toolbar.NewDialog=wn.ui.toolbar.SelectorDialog.extend({init:function(){thi
/*
* lib/js/wn/ui/toolbar/search.js
*/
-wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(profile.can_search.join(',').split(','));makeselector();}});
+wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(wn.boot.profile.can_search.join(',').split(','));makeselector();}});
/*
* lib/js/wn/ui/toolbar/report.js
*/
@@ -1902,22 +1915,20 @@ _f.Grid.prototype.refresh_cell=function(docname,fieldname){for(var r=0;r=37&&keycode<=40&&e.shiftKey){if(text_dialog&&text_dialog.display){return;}}else
@@ -2199,7 +2210,7 @@ me.dialog.clear();me.dialog.show();}});
wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
console.log(wn.boot.error_messages)
if(wn.boot.server_messages)
-msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
+msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
\
'
diff --git a/js/all-web.js b/js/all-web.js
index 9b1360c2a31..1346f4c97a8 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -57,17 +57,30 @@ var l=items.length;for(var i=0;i%(letter)s
',args);}}
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
@@ -200,7 +213,7 @@ if(this.args)
$.extend(args,this.args)
if(this.get_args){$.extend(args,this.get_args(opts));}
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
-if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return this.$w.find('.result-list').append('').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
+if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i
=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
/*
* lib/js/wn/ui/filters.js
*/
@@ -808,7 +821,7 @@ if(errfld.length)msgprint('Mandatory fields required in '+
wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
console.log(wn.boot.error_messages)
if(wn.boot.server_messages)
-msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
+msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
\
'