diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index d41b26289bb..bec99d48ff8 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -34,8 +34,8 @@ feed_dict = { 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'], # Website - 'Web Page': ['%(title)s', '#00080'], - 'Blog': ['%(title)s', '#00080'] + 'Web Page': ['%(title)s', '#000080'], + 'Blog': ['%(title)s', '#000080'] } def make_feed(feedtype, doctype, name, owner, subject, color): diff --git a/erpnext/patches/jan_mar_2012/latest/__init__.py b/erpnext/patches/jan_mar_2012/website/__init__.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/__init__.py rename to erpnext/patches/jan_mar_2012/website/__init__.py diff --git a/erpnext/patches/jan_mar_2012/latest/cleanups.py b/erpnext/patches/jan_mar_2012/website/cleanups.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/cleanups.py rename to erpnext/patches/jan_mar_2012/website/cleanups.py diff --git a/erpnext/patches/jan_mar_2012/latest/feed.py b/erpnext/patches/jan_mar_2012/website/feed.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/feed.py rename to erpnext/patches/jan_mar_2012/website/feed.py diff --git a/erpnext/patches/jan_mar_2012/latest/login.py b/erpnext/patches/jan_mar_2012/website/login.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/login.py rename to erpnext/patches/jan_mar_2012/website/login.py diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/website/website.py similarity index 98% rename from erpnext/patches/jan_mar_2012/latest/website.py rename to erpnext/patches/jan_mar_2012/website/website.py index 9c930e2659b..4ffb4417388 100644 --- a/erpnext/patches/jan_mar_2012/latest/website.py +++ b/erpnext/patches/jan_mar_2012/website/website.py @@ -12,6 +12,7 @@ def execute(): delete_doc('Website', 'Module Def', 'Website') reload_doc('website', 'Module Def', 'Website') reload_doc('website', 'Role', 'Website Manager') + reload_doc('website', 'Role', 'Blogger') webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""") d = Document('Module Def Role') diff --git a/erpnext/website/Role/Blogger/Blogger.txt b/erpnext/website/Role/Blogger/Blogger.txt new file mode 100644 index 00000000000..a380d4c7b7e --- /dev/null +++ b/erpnext/website/Role/Blogger/Blogger.txt @@ -0,0 +1,26 @@ +# Role, Blogger +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-27 12:22:24', + 'docstatus': 0, + 'modified': '2012-01-27 12:22:24', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all Role + { + 'doctype': 'Role', + 'module': u'Website', + 'name': '__common__', + 'role_name': u'Blogger' + }, + + # Role, Blogger + { + 'doctype': 'Role', + 'name': u'Blogger' + } +] \ No newline at end of file diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index c0e70a61004..c83b922d507 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -18,6 +18,7 @@ class DocType(): def validate(self): """write/update 'Page' with the blog""" p = website.utils.add_page(self.doc.title) + self.doc.name = p.name from jinja2 import Template import markdown2 diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt index 2471c2dfa44..59444f81138 100644 --- a/erpnext/website/doctype/blog/blog.txt +++ b/erpnext/website/doctype/blog/blog.txt @@ -5,21 +5,23 @@ { 'creation': '2012-01-27 12:24:03', 'docstatus': 0, - 'modified': '2012-02-07 12:59:01', + 'modified': '2012-02-07 13:55:17', 'modified_by': u'Administrator', 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': u'1327647244', + '_last_update': u'1328599743', + 'allow_attach': 1, 'colour': u'White:FFF', 'doctype': 'DocType', + 'max_attachments': 5, 'module': u'Website', 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 2 + 'version': 3 }, # These values are common for all DocField @@ -106,5 +108,17 @@ 'fieldtype': u'Text', 'label': u'Preview', '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/product.py b/erpnext/website/doctype/product/product.py index 5880d34c7b5..223a790df98 100644 --- a/erpnext/website/doctype/product/product.py +++ b/erpnext/website/doctype/product/product.py @@ -14,6 +14,7 @@ class DocType: 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: @@ -26,14 +27,15 @@ class DocType: website.utils.add_guest_access_to_page(p.name) self.doc.page_name = p.name - del self.doc.fields['long_description_html'] 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', webnotes.conn.get_value('Item', self.doc.item, 'item_group')) + ig = Document('Item Group', self.doc.item_group) ig.show_in_website = 1 ig.save() diff --git a/erpnext/website/doctype/product/product_page.js b/erpnext/website/doctype/product/product_page.js index 7d031ef94b3..35359cca414 100644 --- a/erpnext/website/doctype/product/product_page.js +++ b/erpnext/website/doctype/product/product_page.js @@ -1,6 +1,8 @@ wn.require('erpnext/website/js/product_category.js'); pscript["onload_{{ doc.page_name }}"] = function(wrapper) { + wrapper.product_group = "{{ doc.item_group }}"; + wrapper.product_name = "{{ doc.name }}"; erpnext.make_product_categories(wrapper); $(wrapper).find('.product-inquiry').click(function() { loadpage('contact', function() { @@ -9,5 +11,37 @@ pscript["onload_{{ doc.page_name }}"] = function(wrapper) { My contact details are:\n\nThank you!\ "); }) - }) + }); + + // similar products + wrapper.similar = new wn.widgets.Listing({ + parent: $(wrapper).find('.similar-products').get(0), + hide_refresh: true, + page_length: 5, + get_query: function() { + args = { + cat: wrapper.product_group, + name: wrapper.product_name + }; + 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 t1.name != "%(name)s" \ + and t2.item_group="%(cat)s" order by t1.modified desc', args) + }, + render_row: function(parent, data) { + if(data.short_description.length > 100) { + data.short_description = data.short_description.substr(0,100) + '...'; + } + parent.innerHTML = repl('
%(short_description)s