From f3625c112d429a38c04344826306ce3baca83b4e Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 12 Feb 2014 12:22:34 +0530 Subject: [PATCH 1/7] all applications minor fix --- webnotes/core/page/desktop/desktop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webnotes/core/page/desktop/desktop.js b/webnotes/core/page/desktop/desktop.js index 1dbdbba70a..67850e64da 100644 --- a/webnotes/core/page/desktop/desktop.js +++ b/webnotes/core/page/desktop/desktop.js @@ -132,7 +132,7 @@ wn.desktop.show_all_modules = function() { var module = wn.modules[m]; if(module.link && desktop_items.indexOf(m)!==-1) { module.app_icon = wn.ui.app_icon.get_html(m, true); - $(repl('
\ + $(repl('
\
\ \
\ From 26dfc4ba8980a8fcff6168a82e5897b4234c9fd0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 12 Feb 2014 14:54:57 +0530 Subject: [PATCH 2/7] Breadcrumb part of Page Header instead of a separate section --- webnotes/templates/base.html | 22 ++++++++++++---------- webnotes/templates/includes/footer.html | 2 -- webnotes/templates/includes/navbar.html | 2 +- webnotes/website/css/website.css | 15 ++++++++------- webnotes/website/js/website.js | 5 +++-- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/webnotes/templates/base.html b/webnotes/templates/base.html index 49a4ec9e40..16d79ce870 100644 --- a/webnotes/templates/base.html +++ b/webnotes/templates/base.html @@ -7,8 +7,8 @@ - - + + {% block head -%} {%- if meta_description is defined -%} @@ -49,12 +49,17 @@ -
@@ -68,9 +73,6 @@ {%- endblock -%}
- {%- block content -%}{{ content }}{%- endblock -%}
diff --git a/webnotes/templates/includes/footer.html b/webnotes/templates/includes/footer.html index b02a4e66d5..b08c8f0ff5 100644 --- a/webnotes/templates/includes/footer.html +++ b/webnotes/templates/includes/footer.html @@ -10,8 +10,6 @@ {% endfor %}
-
diff --git a/webnotes/templates/includes/navbar.html b/webnotes/templates/includes/navbar.html index 9a5ecb1d0c..10893aafcf 100644 --- a/webnotes/templates/includes/navbar.html +++ b/webnotes/templates/includes/navbar.html @@ -66,7 +66,7 @@ -
diff --git a/webnotes/website/css/website.css b/webnotes/website/css/website.css index 09696b671b..88283dedd8 100644 --- a/webnotes/website/css/website.css +++ b/webnotes/website/css/website.css @@ -215,7 +215,7 @@ fieldset { .page-header { margin: 0px; - padding: 5px 0px; + padding: 15px 0px; } .page-container { @@ -233,6 +233,10 @@ fieldset { margin-bottom: 5px; } +.page-content { + padding-top: 7px; +} + .sidebar-item { margin: 15px auto; color: #999; @@ -388,15 +392,12 @@ a.no-decoration { color: inherit; } -.page-breadcrumbs { - border-bottom: 1px solid #eee; -} - .page-breadcrumbs .breadcrumb { - margin-bottom: 0px; + padding: 0px; + margin-bottom: 2px; background-color: transparent; border-radius: 0px; - padding: 8px 0px; + font-size: 85%; } @media (min-width: 768px) { diff --git a/webnotes/website/js/website.js b/webnotes/website/js/website.js index 1b38af5501..0b74db7ac1 100644 --- a/webnotes/website/js/website.js +++ b/webnotes/website/js/website.js @@ -422,9 +422,10 @@ $(document).ready(function() { }); $(document).on("page_change", function() { - $(".page-header").toggleClass("hidden", !!!$(".page-header").text().trim()); + $(".page-header").toggleClass("hidden", !!!$("[data-html-block='header']").text().trim()); $(".page-footer").toggleClass("hidden", !!!$(".page-footer").text().trim()); - //$(".page-breadcrumbs").toggleClass("hidden", !!!$(".page-breadcrumbs").text().trim()); + $("[data-html-block='breadcrumbs'] .breadcrumb").toggleClass("hidden", + $("[data-html-block='breadcrumbs']").text().trim()==$("[data-html-block='header']").text().trim()); // add prive pages to sidebar if(website.private_pages && $(".page-sidebar").length) { From 80b4ca88c387ccdc2eb981840992e6919a48f03f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 12 Feb 2014 16:55:35 +0530 Subject: [PATCH 3/7] fix to static sync --- webnotes/website/doctype/web_page/web_page.py | 21 ++++++++++--------- webnotes/webutils.py | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/webnotes/website/doctype/web_page/web_page.py b/webnotes/website/doctype/web_page/web_page.py index 48ed889e58..68105b507d 100644 --- a/webnotes/website/doctype/web_page/web_page.py +++ b/webnotes/website/doctype/web_page/web_page.py @@ -48,7 +48,7 @@ def _sync_statics(): def sync_file(fname, fpath, statics_path, priority=0): url = os.path.relpath(fpath, statics_path).rsplit(".", 1)[0] - if fname.rsplit(".", 1)[0]=="index": + if fname.rsplit(".", 1)[0]=="index" and os.path.dirname(fpath) != statics_path: url = os.path.dirname(url) parent_website_sitemap = os.path.dirname(url) @@ -100,20 +100,21 @@ def _sync_statics(): with open(os.path.join(basepath, "index.txt"), "r") as indexfile: index = indexfile.read().splitlines() - for fname in files: - page_name = fname.rsplit(".", 1)[0] - if page_name=="index" and fname!="index.txt": - sync_file(fname, os.path.join(basepath, fname), statics_path) - has_index = True - break + if basepath!=statics_path: + for fname in files: + page_name = fname.rsplit(".", 1)[0] + if page_name=="index" and fname!="index.txt": + sync_file(fname, os.path.join(basepath, fname), statics_path) + has_index = True + break - if not has_index: - continue + if not has_index: + continue # other files for fname in files: page_name = fname.rsplit(".", 1)[0] - if page_name!="index": + if not (page_name=="index" and basepath!=statics_path): sync_file(fname, os.path.join(basepath, fname), statics_path, index.index(page_name) if page_name in index else 0) diff --git a/webnotes/webutils.py b/webnotes/webutils.py index 4e9e76135d..f8c3a66a15 100644 --- a/webnotes/webutils.py +++ b/webnotes/webutils.py @@ -147,7 +147,7 @@ def build_sitemap_options(path): sitemap_options.children = webnotes.conn.sql("""select * from `tabWebsite Sitemap` where parent_website_sitemap=%s - and public_read=1 order by idx asc""", (sitemap_options.name,), as_dict=True) + and public_read=1 order by idx asc, page_title asc""", (sitemap_options.name,), as_dict=True) # determine templates to be used if not sitemap_options.base_template_path: From 6f8001c9d5be2266e94f5e5f663d1fc9ce5fba80 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 12 Feb 2014 18:39:13 +0530 Subject: [PATCH 4/7] Minor: Website Style --- webnotes/website/css/website.css | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/webnotes/website/css/website.css b/webnotes/website/css/website.css index 88283dedd8..a6918a15ea 100644 --- a/webnotes/website/css/website.css +++ b/webnotes/website/css/website.css @@ -240,7 +240,7 @@ fieldset { .sidebar-item { margin: 15px auto; color: #999; - font-size: 90%; + font-size: 85%; } .sidebar-item a:hover { @@ -350,10 +350,6 @@ textarea { margin: 30px; } -.img-responsive { - border-radius: 4px; -} - .user-profile { min-height: 50px; min-width: 70px; @@ -402,7 +398,7 @@ a.no-decoration { @media (min-width: 768px) { .page-sidebar { - padding-left: 5em; + padding-left: 3em; } } From fb8925fe8a4bf0db7391509d86c3be94a957609e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 12 Feb 2014 21:13:07 +0530 Subject: [PATCH 5/7] Fixes in Bulk Email and Email Template --- .../core/doctype/bulk_email/bulk_email.txt | 4 +-- webnotes/templates/emails/standard.html | 28 ++++++++++++++++++- webnotes/templates/includes/inline_post.html | 4 +-- webnotes/utils/__init__.py | 13 +++++++-- webnotes/utils/email_lib/bulk.py | 22 +++++++-------- webnotes/utils/email_lib/smtp.py | 2 +- 6 files changed, 53 insertions(+), 20 deletions(-) diff --git a/webnotes/core/doctype/bulk_email/bulk_email.txt b/webnotes/core/doctype/bulk_email/bulk_email.txt index 11c747500f..c47da6d4d3 100644 --- a/webnotes/core/doctype/bulk_email/bulk_email.txt +++ b/webnotes/core/doctype/bulk_email/bulk_email.txt @@ -2,7 +2,7 @@ { "creation": "2012-08-02 15:17:28", "docstatus": 0, - "modified": "2013-12-20 19:23:58", + "modified": "2014-02-12 21:11:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -55,7 +55,7 @@ { "doctype": "DocField", "fieldname": "message", - "fieldtype": "Text", + "fieldtype": "Long Text", "label": "Message" }, { diff --git a/webnotes/templates/emails/standard.html b/webnotes/templates/emails/standard.html index 3a3381b454..aabe51d5ce 100644 --- a/webnotes/templates/emails/standard.html +++ b/webnotes/templates/emails/standard.html @@ -78,6 +78,19 @@ body { padding:10px 0; } +.left-padding { + padding-left: 10px; +} + +.breadcrumb { + list-style: none; +} + +.breadcrumb > li { + display: inline-block; + margin-left: 0px; + margin-right: 5px; +} /* ------------------------------------- BODY @@ -183,6 +196,19 @@ table.footer-wrap a{ width: 100%; } +a.no-decoration { + text-decoration: none; + color: inherit; +} + +small, .small { + font-size: 85%; +} + +.text-muted { + color: #999999; +} + @@ -240,7 +266,7 @@ table.footer-wrap a{
- + \ No newline at end of file diff --git a/webnotes/templates/includes/inline_post.html b/webnotes/templates/includes/inline_post.html index ac9c547763..df584b0235 100644 --- a/webnotes/templates/includes/inline_post.html +++ b/webnotes/templates/includes/inline_post.html @@ -5,13 +5,13 @@ data-name="{{ post.name }}" data-group="{{ post.website_group }}" itemscope itemtype="http://schema.org/Article"> - +
{%- if not post.parent_post -%}

- {%- if view != "post" -%} + {%- if view.name != "post" -%} {{ post.title }} {%- else -%} diff --git a/webnotes/utils/__init__.py b/webnotes/utils/__init__.py index 9b4ad265c8..035eeb3605 100644 --- a/webnotes/utils/__init__.py +++ b/webnotes/utils/__init__.py @@ -903,9 +903,16 @@ def scrub_urls(html): def expand_relative_urls(html): # expand relative urls url = get_url() - if not url.endswith("/"): url += "/" - return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', - '\g<1>\g<2>{}\g<3>\g<4>'.format(url), html) + if url.endswith("/"): url = url[:-1] + + def _expand_relative_urls(match): + to_expand = list(match.groups()) + if not to_expand[2].startswith("/"): + to_expand[2] = "/" + to_expand[2] + to_expand.insert(2, url) + return "".join(to_expand) + + return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', _expand_relative_urls, html) def quote_urls(html): def _quote_url(match): diff --git a/webnotes/utils/email_lib/bulk.py b/webnotes/utils/email_lib/bulk.py index d8eb6f3158..4ab448f4c6 100644 --- a/webnotes/utils/email_lib/bulk.py +++ b/webnotes/utils/email_lib/bulk.py @@ -47,7 +47,7 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email', "type": doctype, "email_field": email_field })) - + updated = updated.replace("", unsubscribe_link) return updated @@ -57,11 +57,6 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email', sender = webnotes.conn.get_value('Email Settings', None, 'auto_email_id') check_bulk_limit(len(recipients)) - try: - text_content = html2text(message) - except HTMLParser.HTMLParseError: - text_content = "[See html attachment]" - formatted = get_formatted_html(subject, message) for r in filter(None, list(set(recipients))): @@ -72,8 +67,13 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email', if not is_unsubscribed(doc): # add to queue - add(r, sender, subject, update_message(formatted, doc, add_unsubscribe_link), - text_content, ref_doctype, ref_docname) + updated = update_message(formatted, doc, add_unsubscribe_link) + try: + text_content = html2text(updated) + except HTMLParser.HTMLParseError: + text_content = "[See html attachment]" + + add(r, sender, subject, updated, text_content, ref_doctype, ref_docname) def add(email, sender, subject, formatted, text_content=None, ref_doctype=None, ref_docname=None): @@ -83,7 +83,7 @@ def add(email, sender, subject, formatted, text_content=None, e.recipient = email try: e.message = get_email(email, sender=e.sender, formatted=formatted, subject=subject, - text_content = text_content).as_string() + text_content=text_content).as_string() except webnotes.ValidationError: # bad email id - don't add to queue return @@ -113,7 +113,7 @@ def unsubscribe(): def flush(from_test=False): """flush email queue, every time: called from scheduler""" - smptserver = SMTPServer() + smtpserver = SMTPServer() auto_commit = not from_test @@ -133,7 +133,7 @@ def flush(from_test=False): (email["name"],), auto_commit=auto_commit) try: if not from_test: - smptserver.sess.sendmail(email["sender"], email["recipient"], email["message"]) + smtpserver.sess.sendmail(email["sender"], email["recipient"], email["message"]) webnotes.conn.sql("""update `tabBulk Email` set status='Sent' where name=%s""", (email["name"],), auto_commit=auto_commit) diff --git a/webnotes/utils/email_lib/smtp.py b/webnotes/utils/email_lib/smtp.py index 3e0b4774a7..2228380a51 100644 --- a/webnotes/utils/email_lib/smtp.py +++ b/webnotes/utils/email_lib/smtp.py @@ -21,7 +21,7 @@ def send(email, as_bulk=False): if not email.reply_to: email.reply_to = email.sender email.sender = smtpserver.login - + smtpserver.sess.sendmail(email.sender, email.recipients + (email.cc or []), email.as_string()) From 929ef59df961f5a1d51d02f60d9fa45205e6da77 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 13 Feb 2014 00:52:40 +0530 Subject: [PATCH 6/7] Show Siblings in Sidebar at Leaf Nodes --- webnotes/templates/includes/sidebar.html | 2 +- webnotes/website/css/website.css | 6 ++++++ webnotes/website/js/website.js | 8 ++------ webnotes/webutils.py | 9 ++++++++- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/webnotes/templates/includes/sidebar.html b/webnotes/templates/includes/sidebar.html index 0a76a98b81..899a43b80b 100644 --- a/webnotes/templates/includes/sidebar.html +++ b/webnotes/templates/includes/sidebar.html @@ -1,7 +1,7 @@ {% if children -%} {%- for child in children -%}