added blog category and other updates to website module

This commit is contained in:
Rushabh Mehta
2013-03-08 10:44:25 +05:30
parent e73b5e23b9
commit a2deb68776
16 changed files with 157 additions and 26 deletions

View File

@@ -18,6 +18,7 @@ from __future__ import unicode_literals
import webnotes
import website.utils
from webnotes import _
class DocType:
def __init__(self, d, dl):
@@ -73,6 +74,16 @@ class DocType:
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.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
self.doc.texts = {
"comments": _("Comments"),
"first_comment": _("Be the first one to comment"),
"add_comment": _("Add Comment"),
"submit": _("Submit"),
"all_posts_by": _("All posts by"),
}
comment_list = webnotes.conn.sql("""\
select comment, comment_by_fullname, creation

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-25 11:35:09",
"docstatus": 0,
"modified": "2013-03-07 16:32:13",
"modified": "2013-03-08 09:41:37",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -62,6 +62,13 @@
"options": "Blogger",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "blog_category",
"fieldtype": "Link",
"label": "Blog Category",
"options": "Blog Category"
},
{
"doctype": "DocField",
"fieldname": "section_break_5",

View File

@@ -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

View File

@@ -0,0 +1,51 @@
[
{
"creation": "2013-03-08 09:41:11",
"docstatus": 0,
"modified": "2013-03-08 09:41:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"autoname": "field:category_name",
"doctype": "DocType",
"document_type": "Master",
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"fieldname": "category_name",
"fieldtype": "Data",
"label": "Category Name",
"name": "__common__",
"parent": "Blog Category",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"reqd": 1
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Blog Category",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"role": "Website Manager",
"write": 1
},
{
"doctype": "DocType",
"name": "Blog Category"
},
{
"doctype": "DocField"
},
{
"doctype": "DocPerm"
}
]

View File

@@ -32,6 +32,11 @@ div.outer {
{% 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_as %}
h1, h2, h3, h4, h5 {
text-transform: {{ doc.heading_text_as }};
}
{% endif %}

View File

@@ -57,10 +57,16 @@ class DocType:
fonts = list(set(fonts))
if self.doc.heading_text_as:
self.doc.heading_text_as = {
"UPPERCASE": "uppercase",
"Title Case":"capitalize",
"lowercase": "lowercase"
}[self.doc.heading_text_as]
self.doc.at_import = ""
for f in fonts:
self.doc.at_import += "\n@import url(http://fonts.googleapis.com/css?family=%s);" % f.replace(" ", "+")
def on_update(self):

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-25 11:35:10",
"docstatus": 0,
"modified": "2013-03-07 16:06:22",
"modified": "2013-03-08 09:58:49",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -119,6 +119,13 @@
"label": "Font Size (Text)",
"options": "\n12px\n13px\n14px\n15px\n16px"
},
{
"doctype": "DocField",
"fieldname": "heading_text_as",
"fieldtype": "Select",
"label": "Heading Text As",
"options": "\nUPPERCASE\nTitle Case\nlowercase"
},
{
"doctype": "DocField",
"fieldname": "column_break_13",

View File

@@ -31,9 +31,6 @@ class DocType:
from website.utils import clear_cache
clear_cache()
from webnotes.sessions import clear_cache
clear_cache('Guest')
def set_home_page(self):
import webnotes