The "batteries included" language that lets you write elegant code, quickly.
Python Libraries:
diff --git a/website/doctype/blog_post/blog_post.py b/website/doctype/blog_post/blog_post.py
index 1664b4fca5c..ff6cc9931e4 100644
--- a/website/doctype/blog_post/blog_post.py
+++ b/website/doctype/blog_post/blog_post.py
@@ -74,13 +74,15 @@ class DocType:
# temp fields
from webnotes.utils import global_date_format, get_fullname
self.doc.full_name = get_fullname(self.doc.owner)
- self.doc.updated = global_date_format(self.doc.creation)
+ self.doc.updated = global_date_format(self.doc.published_on)
self.doc.content_html = self.doc.content
if self.doc.blogger:
self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
if self.doc.blogger_info.avatar and not "/" in self.doc.blogger_info.avatar:
self.doc.blogger_info.avatar = "files/" + self.doc.blogger_info.avatar
+ self.doc.description = self.doc.blog_intro or self.doc.content[:140]
+
self.doc.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
self.doc.texts = {
diff --git a/website/doctype/blog_settings/__init__.py b/website/doctype/blog_settings/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/website/doctype/blog_settings/blog_settings.py b/website/doctype/blog_settings/blog_settings.py
new file mode 100644
index 00000000000..928aa9ff9f2
--- /dev/null
+++ b/website/doctype/blog_settings/blog_settings.py
@@ -0,0 +1,8 @@
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/website/doctype/blog_settings/blog_settings.txt b/website/doctype/blog_settings/blog_settings.txt
new file mode 100644
index 00000000000..09740eb78f8
--- /dev/null
+++ b/website/doctype/blog_settings/blog_settings.txt
@@ -0,0 +1,61 @@
+[
+ {
+ "creation": "2013-03-11 17:48:16",
+ "docstatus": 0,
+ "modified": "2013-03-11 17:48:16",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "description": "Blog Settings",
+ "doctype": "DocType",
+ "issingle": 1,
+ "module": "Website",
+ "name": "__common__"
+ },
+ {
+ "doctype": "DocField",
+ "name": "__common__",
+ "parent": "Blog Settings",
+ "parentfield": "fields",
+ "parenttype": "DocType",
+ "permlevel": 0
+ },
+ {
+ "create": 1,
+ "doctype": "DocPerm",
+ "name": "__common__",
+ "parent": "Blog Settings",
+ "parentfield": "permissions",
+ "parenttype": "DocType",
+ "permlevel": 0,
+ "read": 1,
+ "role": "Website Manager",
+ "write": 1
+ },
+ {
+ "doctype": "DocType",
+ "name": "Blog Settings"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "blog_title",
+ "fieldtype": "Data",
+ "label": "Blog Title"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "blog_introduction",
+ "fieldtype": "Small Text",
+ "label": "Blog Introduction"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "writers_introduction",
+ "fieldtype": "Small Text",
+ "label": "Writers Introduction"
+ },
+ {
+ "doctype": "DocPerm"
+ }
+]
\ No newline at end of file
diff --git a/website/doctype/style_settings/custom_template.css b/website/doctype/style_settings/custom_template.css
index 4925837c59d..24353f97e03 100644
--- a/website/doctype/style_settings/custom_template.css
+++ b/website/doctype/style_settings/custom_template.css
@@ -12,13 +12,16 @@ body {
background-color: #edede7;
{% endif %}
{% if doc.font or doc.google_web_font_for_text %}
- font-family: '{{ doc.google_web_font_for_text or doc.font }}', Verdana, Sans !important;
-{% endif %}
-{% if doc.font_size %}
- font-size: {{ doc.font_size }} !important;
+ font-family: '{{ doc.google_web_font_for_text or doc.font }}', 'Helvetica Neue', Arial, Sans !important;
{% endif %}
+ {% if doc.font_size %}font-size: {{ doc.font_size }} !important;{% endif %}
+ {% if doc.page_text %}color: #{{ doc.page_text }};{% endif %}
}
+{% if doc.page_links %}a, a:hover {
+ color: #{{ doc.page_links }};
+}{% endif %}
+
{% if doc.font_size %}
.small {
font-size: {{ doc.small_font_size }} !important;
@@ -29,16 +32,17 @@ div.outer {
background-color: #{{ doc.page_background or "fff" }};
}
-{% if doc.google_web_font_for_heading or doc.heading_font %}
-h1, h2, h3, h4, h5 {
- font-family: '{{ doc.google_web_font_for_heading or doc.heading_font }}', Arial, 'Helvetica Neue' !important;
-}
-{% endif %}
-{% if doc.heading_text_style %}
-h1, h2, h3, h4, h5 {
+{% if doc.google_web_font_for_heading or doc.heading_font %}h1, h2, h3, h4, h5 {
+ font-family: '{{ doc.google_web_font_for_heading or doc.heading_font }}', 'Helvetica Neue', Arial !important;
+}{% endif %}
+
+{% if doc.heading_text_style %}h1, h2, h3, h4, h5 {
text-transform: {{ doc.heading_text_style }};
-}
-{% endif %}
+}{% endif %}
+
+{% if doc.page_headings %}h1, h2, h3, h4, h5 {
+ color: #{{ doc.page_headings }};
+}{% endif %}
{% if doc.page_border %}
/* Page Border*/
@@ -64,20 +68,16 @@ div.web-footer {
}
.navbar-inverse .brand,
+.navbar-inverse .brand:hover,
+.navbar-inverse .brand:focus,
.navbar-inverse .nav > li > a {
color: #{{ doc.top_bar_foreground or "fff"}};
text-shadow: none;
}
-.navbar-inverse .brand:hover,
.navbar-inverse .nav > li > a:hover,
-.navbar-inverse .brand:focus,
.navbar-inverse .nav > li > a:focus {
- color: #{{ doc.top_bar_background or "aaa"}};
-}
-
-.navbar-inverse .brand {
- color: #{{ doc.top_bar_foreground or "fff"}};
+ color: #{{ doc.top_bar_background or "000"}};
}
.navbar-inverse .navbar-text {
diff --git a/website/doctype/style_settings/style_settings.js b/website/doctype/style_settings/style_settings.js
index e8ee9087992..54c4f085111 100644
--- a/website/doctype/style_settings/style_settings.js
+++ b/website/doctype/style_settings/style_settings.js
@@ -17,8 +17,9 @@
cur_frm.cscript.onload_post_render = function() {
wn.require('lib/public/js/lib/jscolor/jscolor.js');
- cur_frm.fields_dict.background_color.input.className = 'color';
- cur_frm.fields_dict.page_background.input.className = 'color';
- cur_frm.fields_dict.top_bar_background.input.className = 'color';
+ $.each(["background_color", "page_background", "page_text", "page_links",
+ "top_bar_background", "top_bar_foreground", "page_headings"], function(i, v) {
+ cur_frm.fields_dict[v].input.className = 'color';
+ })
jscolor.bind();
}
\ No newline at end of file
diff --git a/website/doctype/style_settings/style_settings.py b/website/doctype/style_settings/style_settings.py
index 434f4b546d0..bf46afb97d7 100644
--- a/website/doctype/style_settings/style_settings.py
+++ b/website/doctype/style_settings/style_settings.py
@@ -15,7 +15,10 @@
# along with this program. If not, see .
from __future__ import unicode_literals
+import webnotes
+
from webnotes.utils import cint, cstr
+from webnotes import _
class DocType:
def __init__(self, d, dl):
@@ -26,6 +29,8 @@ class DocType:
from jinja2 import Template
import os
+ self.validate_colors()
+
with open(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'custom_template.css'), 'r') as f:
@@ -39,11 +44,24 @@ class DocType:
from webnotes.sessions import clear_cache
clear_cache('Guest')
+
+ from website.utils import clear_cache
+ clear_cache()
for f in ["small_font_size", "at_import", "heading_text_style"]:
if f in self.doc.fields:
del self.doc.fields[f]
+ def validate_colors(self):
+ if self.doc.page_background==self.doc.page_text:
+ webnotes.msgprint(_("Page text and background is same color. Please change."),
+ raise_exception=1)
+
+ if self.doc.top_bar_background==self.doc.top_bar_foreground:
+ webnotes.msgprint(_("Top Bar text and background is same color. Please change."),
+ raise_exception=1)
+
+
def prepare(self):
if not self.doc.font_size:
self.doc.font_size = '13px'
diff --git a/website/doctype/style_settings/style_settings.txt b/website/doctype/style_settings/style_settings.txt
index e58ae09e955..fbb4c422f66 100644
--- a/website/doctype/style_settings/style_settings.txt
+++ b/website/doctype/style_settings/style_settings.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-25 11:35:10",
+ "creation": "2013-03-08 11:36:53",
"docstatus": 0,
- "modified": "2013-03-08 09:58:49",
+ "modified": "2013-03-12 11:34:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -65,6 +65,24 @@
"fieldtype": "Data",
"label": "Page Background"
},
+ {
+ "doctype": "DocField",
+ "fieldname": "page_headings",
+ "fieldtype": "Data",
+ "label": "Page Headings"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "page_text",
+ "fieldtype": "Data",
+ "label": "Page Text"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "page_links",
+ "fieldtype": "Data",
+ "label": "Page Links"
+ },
{
"doctype": "DocField",
"fieldname": "page_border",
@@ -88,9 +106,8 @@
"description": "000 is black, fff is white",
"doctype": "DocField",
"fieldname": "top_bar_foreground",
- "fieldtype": "Select",
- "label": "Top Bar Foreground",
- "options": "000\nFFF"
+ "fieldtype": "Data",
+ "label": "Top Bar Text"
},
{
"doctype": "DocField",
diff --git a/website/doctype/web_page/web_page.txt b/website/doctype/web_page/web_page.txt
index 861ac86e397..eed7d2b63b4 100644
--- a/website/doctype/web_page/web_page.txt
+++ b/website/doctype/web_page/web_page.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-27 16:31:21",
+ "creation": "2013-02-12 13:19:11",
"docstatus": 0,
- "modified": "2013-02-12 09:33:47",
+ "modified": "2013-03-11 17:41:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -24,18 +24,16 @@
"permlevel": 0
},
{
- "create": 1,
+ "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Web Page",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
"read": 1,
"report": 1,
"role": "Website Manager",
- "submit": 0,
- "write": 1
+ "submit": 0
},
{
"doctype": "DocType",
@@ -85,6 +83,13 @@
"label": "Slideshow",
"options": "Website Slideshow"
},
+ {
+ "description": "Description for page header.",
+ "doctype": "DocField",
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "label": "Description"
+ },
{
"description": "Content in markdown format that appears on the main side of your page",
"doctype": "DocField",
@@ -143,6 +148,17 @@
"print_hide": 1
},
{
- "doctype": "DocPerm"
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "permlevel": 0,
+ "write": 1
+ },
+ {
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "permlevel": 1,
+ "write": 0
}
]
\ No newline at end of file
diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt
index 6af0575a360..5bc4f71f68e 100644
--- a/website/doctype/website_settings/website_settings.txt
+++ b/website/doctype/website_settings/website_settings.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-25 11:35:10",
+ "creation": "2013-03-07 11:55:11",
"docstatus": 0,
- "modified": "2013-02-21 10:05:09",
+ "modified": "2013-03-12 11:17:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -72,24 +72,31 @@
"label": "Home Page is Products"
},
{
+ "description": "Add a banner to the site. (small banners are usually good)",
+ "doctype": "DocField",
+ "fieldname": "banner",
+ "fieldtype": "Section Break",
+ "label": "Banner"
+ },
+ {
+ "description": "Banner is above the Top Menu Bar.",
+ "doctype": "DocField",
+ "fieldname": "banner_html",
+ "fieldtype": "Small Text",
+ "label": "Banner HTML"
+ },
+ {
+ "description": "Menu items in the Top Bar. For setting the color of the Top Bar, go to Style Settings",
"doctype": "DocField",
"fieldname": "top_bar",
"fieldtype": "Section Break",
"label": "Top Bar"
},
- {
- "description": "Background shade of the top menu bar",
- "doctype": "DocField",
- "fieldname": "top_bar_background",
- "fieldtype": "Select",
- "label": "Top Bar Background",
- "options": "Black\nWhite"
- },
{
"description": "Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag. Keep size as 200px x 30px",
"doctype": "DocField",
"fieldname": "brand_html",
- "fieldtype": "Text",
+ "fieldtype": "Small Text",
"label": "Brand HTML"
},
{
diff --git a/website/helpers/blog.py b/website/helpers/blog.py
index ec57105e354..5ee34519561 100644
--- a/website/helpers/blog.py
+++ b/website/helpers/blog.py
@@ -99,10 +99,8 @@ def add_comment(args=None):
return comment_html
@webnotes.whitelist(allow_guest=True)
-def add_subscriber():
+def add_subscriber(name, email_id):
"""add blog subscriber to lead"""
- full_name = webnotes.form_dict.get('your_name')
- email = webnotes.form_dict.get('your_email_address')
name = webnotes.conn.sql("""select name from tabLead where email_id=%s""", email)
from webnotes.model.doc import Document
@@ -114,22 +112,23 @@ def add_subscriber():
if not lead.source: lead.source = 'Blog'
lead.unsubscribed = 0
lead.blog_subscriber = 1
- lead.lead_name = full_name
+ lead.lead_name = name
lead.email_id = email
lead.save()
-
+
def get_blog_content(blog_page_name):
import website.utils
content = website.utils.get_html(blog_page_name)
- content = split_blog_content(content)
import webnotes.utils
content = webnotes.utils.escape_html(content)
return content
def get_blog_template_args():
- return {
+ args = {
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
}
+ args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
+ return args
def get_writers_args():
bloggers = webnotes.conn.sql("""select * from `tabBlogger`
@@ -138,10 +137,13 @@ def get_writers_args():
if blogger.avatar and not "/" in blogger.avatar:
blogger.avatar = "files/" + blogger.avatar
- return {
+ args = {
"bloggers": bloggers,
"texts": {
"all_posts_by": _("All posts by")
},
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
- }
\ No newline at end of file
+ }
+
+ args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
+ return args
\ No newline at end of file
diff --git a/website/helpers/blog_feed.py b/website/helpers/blog_feed.py
index 19fc5d8ec66..c59a419fc6d 100644
--- a/website/helpers/blog_feed.py
+++ b/website/helpers/blog_feed.py
@@ -59,7 +59,7 @@ def generate():
blog_list = webnotes.conn.sql("""\
select page_name as name, modified, creation, title from `tabBlog Post`
where ifnull(published,0)=1
- order by creation desc, modified desc, name asc limit 100""", as_dict=1)
+ order by creation desc, modified desc, name asc limit 20""", as_dict=1)
for blog in blog_list:
blog.link = host + '/' + blog.name + '.html'
diff --git a/website/page/website_home/website_home.js b/website/page/website_home/website_home.js
index bb3d14f04a6..e1122071dde 100644
--- a/website/page/website_home/website_home.js
+++ b/website/page/website_home/website_home.js
@@ -37,6 +37,12 @@ wn.module_page["Website"] = [
description: wn._("Categorize blog posts."),
doctype:"Blog Category"
},
+ {
+ label: wn._("Blog Settings"),
+ description: wn._("Write titles and introductions to your blog."),
+ doctype:"Blog Settings",
+ route: "Form/Blog Settings"
+ },
]
},
diff --git a/website/templates/html/base.html b/website/templates/html/base.html
index fa01f8aad7c..2719f8db36d 100644
--- a/website/templates/html/base.html
+++ b/website/templates/html/base.html
@@ -19,6 +19,9 @@
{% endif %}
+ {% if description %}
+
+ {% endif %}
{% block header %}
{% endblock %}
diff --git a/website/templates/html/blog_page.html b/website/templates/html/blog_page.html
index e605a122480..270d427f7f1 100644
--- a/website/templates/html/blog_page.html
+++ b/website/templates/html/blog_page.html
@@ -9,14 +9,17 @@
{% endblock %}
{% block content %}
-
-
{{ title }}
+
+
{{ title }}
- {{ blogger_info and blogger_info.full_name or full_name }} / {{ updated }}
+ {{ blogger_info and blogger_info.full_name or full_name }} /
+ {{ updated }}
+
{{ content_html }}
+
{% if blogger_info %}
diff --git a/website/templates/html/blogger.html b/website/templates/html/blogger.html
index eab371e45b7..e18f86a4dde 100644
--- a/website/templates/html/blogger.html
+++ b/website/templates/html/blogger.html
@@ -1,7 +1,7 @@
-
+
diff --git a/website/templates/html/comment.html b/website/templates/html/comment.html
index 1323e094d22..27baaad54db 100644
--- a/website/templates/html/comment.html
+++ b/website/templates/html/comment.html
@@ -3,12 +3,15 @@
it is to be included in the blog/blog.html template
#}
-{% for comment in comment_list %}
-
Note: A link to this page must be easily accessible.
+
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.
{{ comment.comment }}
+{{ comment.comment }}
--
+ {% for page in top_bar_items %} + {% if not page.parent_label %} +-
+
+ {{ page.label }}
+ {% if page.child_items %}
+
+
+
+ {% endif %}
+ {% endfor %}
+
++ {% for child in page.child_items %} +-
+
+ {{ child.label }}
+
+
+ {% endfor %}
+
+ {% else %} + + {% endif %} ++- Login
+
+- {% for page in top_bar_items %} - {% if not page.parent_label %} --
-
- {{ page.label }}
- {% if page.child_items %}
-
-
-
- {% endif %}
- {% endfor %}
-
-- {% for child in page.child_items %} --
-
- {{ child.label }}
-
-
- {% endfor %}
-
- {% else %} - - {% endif %} --- Login
-
-{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
Specifications
-{{ slide.heading }}
-{{ slide.description }}
+ {% if slide.heading %}{{ slide.heading }}
{% endif %} + {% if slide.heading %}{{ slide.description }}
{% endif %}', b)).appendTo($wrap); }); blog.start += (data.length || 0); - if(!data.length) { + if(!data.length || data.length < 20) { if(blog.start) { $("#next-page").toggle(false) - .parent().append("
This website is made using these Awesome Open Source Projects
+This website is made using these awesome Open Source projects
Python Libraries: @@ -80,6 +84,10 @@
+
ERPNext License: GNU/General Public License
+ERPNext - Open Source, web based ERP
+Copyright © 2012, Web Notes Technologies Pvt Ltd, India
-Note: A link to this page must be easily accessible.
+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.
+ +For complete license see http://www.gnu.org/licenses/
+Note: A link to this page must be easily accessible and all other ERPNext branding must remain as it is.
++
For more information please write to us at support@erpnext.com
Blog
+{{ blog_title }}
+ {% if blog_introduction %} +{{ blog_introduction }}
+ {% endif %} ++
Blog Writers
+ {% if writers_introduction %} +{{ writers_introduction }}
+ {% endif %}{% for blogger_info in bloggers %} {% include "html/blogger.html" %} diff --git a/website/utils.py b/website/utils.py index 1d07c638114..921d2fc5f1f 100644 --- a/website/utils.py +++ b/website/utils.py @@ -255,18 +255,13 @@ def get_outer_env(page_name, args): args.update(ret) settings = webnotes.doc("Website Settings", "Website Settings") - for k in ["brand_html", "copyright", "address", "top_bar_background", "favicon", - "facebook_share", "google_plus_one", "twitter_share", "linked_in_share", "twitter_share_via"]: + for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via" + "favicon", "facebook_share", "google_plus_one", "twitter_share", "linked_in_share"]: if k in settings.fields: args[k] = settings.fields.get(k) for k in ["facebook_share", "google_plus_one", "twitter_share", "linked_in_share"]: args[k] = int(args.get(k) or 0) - - if not args.brand_html: - args.brand_html = "ERPNext" - if not args.top_bar_background: - args.top_bar_background = "Black" args.url = quote(str(get_request_site_address(full_address=True)), str("")) args.encoded_title = quote(str(args.title or ""), str(""))