update webpage name to be much longer, remove .html from links and refactor newsletter layout

This commit is contained in:
Rushabh Mehta 2013-01-01 10:55:58 +05:30
parent 6072a682bc
commit 5f183982cd
4 changed files with 45 additions and 39 deletions

View File

@ -2,9 +2,9 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-12-04 11:45:44",
"creation": "2012-12-07 15:15:31",
"modified_by": "Administrator",
"modified": "2012-12-06 13:07:47"
"modified": "2013-01-01 10:54:40"
},
{
"autoname": "naming_series:",
@ -33,9 +33,16 @@
"name": "Newsletter",
"doctype": "DocType"
},
{
"description": "Select who you want to send this newsletter to",
"doctype": "DocField",
"label": "Send To",
"fieldname": "send_to",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"default": "NL-",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Naming Series",
"options": "NL-",
@ -45,31 +52,6 @@
"permlevel": 0
},
{
"description": "A Lead with this email id should exist",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Test Email Id",
"fieldname": "test_email_id",
"fieldtype": "Data",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Test",
"options": "test_send",
"fieldname": "test_send",
"fieldtype": "Button",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Send To",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "All Contacts",
"fieldname": "contacts",
@ -77,7 +59,6 @@
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "All Customer Contacts",
"fieldname": "customer_contacts",
@ -85,7 +66,6 @@
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "All Leads",
"fieldname": "leads",
@ -106,9 +86,14 @@
"fieldtype": "Check",
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"description": "Comma separated list of email addresses",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Send to this list",
"fieldname": "email_list",
@ -123,7 +108,6 @@
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "Subject",
"fieldname": "subject",
@ -132,7 +116,6 @@
"permlevel": 0
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "Message",
"fieldname": "message",
@ -140,6 +123,30 @@
"reqd": 0,
"permlevel": 0
},
{
"description": "Check how the newsletter looks in an email by sending it to your email.",
"doctype": "DocField",
"label": "Test the Newsletter",
"fieldname": "test_the_newsletter",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"description": "A Lead with this email id should exist",
"doctype": "DocField",
"label": "Test Email Id",
"fieldname": "test_email_id",
"fieldtype": "Data",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Test",
"options": "test_send",
"fieldname": "test_send",
"fieldtype": "Button",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Newsletter Status",
@ -149,7 +156,6 @@
},
{
"no_copy": 1,
"colour": "White:FFF",
"doctype": "DocField",
"label": "Email Sent?",
"fieldname": "email_sent",

View File

@ -31,7 +31,7 @@ def generate(domain):
order by modified desc""" % (doctype, d.condition_field))
for p in pages:
page_url = os.path.join(domain, urllib.quote(p[0]) + '.html')
page_url = os.path.join(domain, urllib.quote(p[0]))
modified = p[1].strftime('%Y-%m-%d')
site_map += link_xml % (page_url, modified)

View File

@ -53,7 +53,7 @@ var blog = {
b.comment_text = b.comments + ' comments.'
}
$(repl('<h2><a href="%(page_name)s.html">%(title)s</a></h2>\
$(repl('<h2><a href="%(page_name)s">%(title)s</a></h2>\
<div class="help">%(comment_text)s</div>\
%(content)s<br />\
<p><a href="%(page_name)s">Read with comments...</a></p>\

View File

@ -97,7 +97,7 @@ def page_name(title):
import re
name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4])
return '-'.join(name.split()[:8])
def update_page_name(doc, title):
"""set page_name and check if it is unique"""
@ -145,7 +145,7 @@ def prepare_args(page_name):
if page_name in get_template_pages():
args = webnotes._dict({
'template': 'pages/%s.html' % page_name,
'template': 'pages/%s' % page_name,
'name': page_name,
})
if page_name in page_settings_map:
@ -218,7 +218,7 @@ def get_outer_env():
if top_items and ("products" in [d.url.split(".")[0] for d in top_items if d.url]):
# product categories
products = webnotes.conn.sql("""select t1.item_group as label,
concat(t2.page_name, ".html") as url,
t2.page_name as url,
ifnull(t1.indent,0) as indent
from `tabWebsite Product Category` t1, `tabItem Group` t2
where t1.item_group = t2.name