fix to product, blog
This commit is contained in:
parent
8ebf4e27ef
commit
f9620eaf44
@ -34,8 +34,8 @@ feed_dict = {
|
|||||||
'Support Ticket': ['[%(status)s] %(subject)s', '#000080'],
|
'Support Ticket': ['[%(status)s] %(subject)s', '#000080'],
|
||||||
|
|
||||||
# Website
|
# Website
|
||||||
'Web Page': ['%(title)s', '#00080'],
|
'Web Page': ['%(title)s', '#000080'],
|
||||||
'Blog': ['%(title)s', '#00080']
|
'Blog': ['%(title)s', '#000080']
|
||||||
}
|
}
|
||||||
|
|
||||||
def make_feed(feedtype, doctype, name, owner, subject, color):
|
def make_feed(feedtype, doctype, name, owner, subject, color):
|
||||||
|
|||||||
@ -12,6 +12,7 @@ def execute():
|
|||||||
delete_doc('Website', 'Module Def', 'Website')
|
delete_doc('Website', 'Module Def', 'Website')
|
||||||
reload_doc('website', 'Module Def', 'Website')
|
reload_doc('website', 'Module Def', 'Website')
|
||||||
reload_doc('website', 'Role', 'Website Manager')
|
reload_doc('website', 'Role', 'Website Manager')
|
||||||
|
reload_doc('website', 'Role', 'Blogger')
|
||||||
|
|
||||||
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
|
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
|
||||||
d = Document('Module Def Role')
|
d = Document('Module Def Role')
|
||||||
26
erpnext/website/Role/Blogger/Blogger.txt
Normal file
26
erpnext/website/Role/Blogger/Blogger.txt
Normal file
@ -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'
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -18,6 +18,7 @@ class DocType():
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
"""write/update 'Page' with the blog"""
|
"""write/update 'Page' with the blog"""
|
||||||
p = website.utils.add_page(self.doc.title)
|
p = website.utils.add_page(self.doc.title)
|
||||||
|
self.doc.name = p.name
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
import markdown2
|
import markdown2
|
||||||
|
|||||||
@ -5,21 +5,23 @@
|
|||||||
{
|
{
|
||||||
'creation': '2012-01-27 12:24:03',
|
'creation': '2012-01-27 12:24:03',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-02-07 12:59:01',
|
'modified': '2012-02-07 13:55:17',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
'_last_update': u'1327647244',
|
'_last_update': u'1328599743',
|
||||||
|
'allow_attach': 1,
|
||||||
'colour': u'White:FFF',
|
'colour': u'White:FFF',
|
||||||
'doctype': 'DocType',
|
'doctype': 'DocType',
|
||||||
|
'max_attachments': 5,
|
||||||
'module': u'Website',
|
'module': u'Website',
|
||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'section_style': u'Simple',
|
'section_style': u'Simple',
|
||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'version': 2
|
'version': 3
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
@ -106,5 +108,17 @@
|
|||||||
'fieldtype': u'Text',
|
'fieldtype': u'Text',
|
||||||
'label': u'Preview',
|
'label': u'Preview',
|
||||||
'permlevel': 1
|
'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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -14,6 +14,7 @@ class DocType:
|
|||||||
import markdown2
|
import markdown2
|
||||||
import os
|
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 '')
|
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:
|
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)
|
website.utils.add_guest_access_to_page(p.name)
|
||||||
self.doc.page_name = p.name
|
self.doc.page_name = p.name
|
||||||
del self.doc.fields['long_description_html']
|
|
||||||
self.make_item_group_active()
|
self.make_item_group_active()
|
||||||
|
|
||||||
|
del self.doc.fields['long_description_html']
|
||||||
|
del self.doc.fields['item_group']
|
||||||
|
|
||||||
def make_item_group_active(self):
|
def make_item_group_active(self):
|
||||||
"""show item group in website"""
|
"""show item group in website"""
|
||||||
if self.doc.published:
|
if self.doc.published:
|
||||||
from webnotes.model.doc import Document
|
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.show_in_website = 1
|
||||||
ig.save()
|
ig.save()
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
wn.require('erpnext/website/js/product_category.js');
|
wn.require('erpnext/website/js/product_category.js');
|
||||||
|
|
||||||
pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
|
pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
|
||||||
|
wrapper.product_group = "{{ doc.item_group }}";
|
||||||
|
wrapper.product_name = "{{ doc.name }}";
|
||||||
erpnext.make_product_categories(wrapper);
|
erpnext.make_product_categories(wrapper);
|
||||||
$(wrapper).find('.product-inquiry').click(function() {
|
$(wrapper).find('.product-inquiry').click(function() {
|
||||||
loadpage('contact', function() {
|
loadpage('contact', function() {
|
||||||
@ -9,5 +11,37 @@ pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
|
|||||||
My contact details are:\n\nThank you!\
|
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('<div style="float:left; width: 60px;">\
|
||||||
|
<img src="files/%(thumbnail_image)s" style="width:55px;"></div>\
|
||||||
|
<div style="float:left; width: 180px">\
|
||||||
|
<b><a href="#!%(page_name)s">%(title)s</a></b>\
|
||||||
|
<p>%(short_description)s</p></div>\
|
||||||
|
<div style="clear: both; margin-bottom: 15px;"></div>', data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wrapper.similar.run();
|
||||||
}
|
}
|
||||||
@ -22,6 +22,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<h4>More Categories</h4>
|
<h4>More Categories</h4>
|
||||||
|
<div class="more-categories"></div>
|
||||||
|
<br>
|
||||||
|
<h4>Similar Products</h4>
|
||||||
|
<div class="similar-products"></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -3,7 +3,7 @@ erpnext.product_item_group = {}
|
|||||||
|
|
||||||
erpnext.make_product_categories = function(wrapper) {
|
erpnext.make_product_categories = function(wrapper) {
|
||||||
wrapper.category_list = new wn.widgets.Listing({
|
wrapper.category_list = new wn.widgets.Listing({
|
||||||
parent: $(wrapper).find('.web-side-section').get(0),
|
parent: $(wrapper).find('.more-categories').get(0),
|
||||||
query: 'select label, count(t2.name) as items, t1.item_group \
|
query: 'select label, count(t2.name) as items, t1.item_group \
|
||||||
from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\
|
from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\
|
||||||
where t1.parent="Products Settings" \
|
where t1.parent="Products Settings" \
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="web-side-section">
|
<div class="web-side-section">
|
||||||
<h3>Categories</h3>
|
<h3>Categories</h3>
|
||||||
|
<div class="more-categories"></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear:both;">
|
<div style="clear:both;">
|
||||||
</div>
|
</div>
|
||||||
@ -70,7 +70,6 @@ erpnext.products.make_product_list = function(wrapper) {
|
|||||||
<div style="clear: both; margin-bottom: 15px; border-bottom: 1px solid #AAA"></div>', data);
|
<div style="clear: both; margin-bottom: 15px; border-bottom: 1px solid #AAA"></div>', data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
erpnext.products.set_group = function() {
|
erpnext.products.set_group = function() {
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
360
|
361
|
||||||
6
wnf.py
6
wnf.py
@ -52,6 +52,8 @@ def setup_options():
|
|||||||
help="Apply the patches on given db")
|
help="Apply the patches on given db")
|
||||||
parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname",
|
parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname",
|
||||||
help="reload doc")
|
help="reload doc")
|
||||||
|
parser.add_option('--export_doc', nargs=2, metavar = "doctype docname",
|
||||||
|
help="export doc")
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
@ -121,6 +123,10 @@ def run():
|
|||||||
{"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]})
|
{"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]})
|
||||||
print '\n'.join(webnotes.modules.patch_handler.log_list)
|
print '\n'.join(webnotes.modules.patch_handler.log_list)
|
||||||
|
|
||||||
|
elif options.export_doc:
|
||||||
|
from webnotes.modules import export_doc
|
||||||
|
export_doc(options.export_doc[0], options.export_doc[1])
|
||||||
|
|
||||||
# run all pending
|
# run all pending
|
||||||
elif options.run_latest:
|
elif options.run_latest:
|
||||||
webnotes.modules.patch_handler.run_all()
|
webnotes.modules.patch_handler.run_all()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user