From e18133c726aec71d7ffa9a53f1634d75224cc776 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 30 Aug 2013 16:38:36 +0530 Subject: [PATCH 1/3] [blog] [minor] ability to disable blogger --- config.json | 2 +- website/doctype/blogger/blogger.py | 15 +++++++++++++++ website/doctype/blogger/blogger.txt | 8 +++++++- website/helpers/blog.py | 15 --------------- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/config.json b/config.json index 5412b017b2..ef5a164400 100644 --- a/config.json +++ b/config.json @@ -130,7 +130,7 @@ }, "writers": { "template": "app/website/templates/pages/writers", - "args_method": "website.helpers.blog.get_writers_args" + "args_method": "website.doctype.blogger.blogger.get_writers_args" }, "profile": { "no_cache": true, diff --git a/website/doctype/blogger/blogger.py b/website/doctype/blogger/blogger.py index b35b8eeb7e..7d71648c9e 100644 --- a/website/doctype/blogger/blogger.py +++ b/website/doctype/blogger/blogger.py @@ -23,3 +23,18 @@ class DocType: b.doc.blogger = self.doc.name b.save() +def get_writers_args(): + bloggers = webnotes.conn.sql("""select * from `tabBlogger` + where ifnull(posts,0) > 0 and ifnull(disabled,0)=0 + order by posts desc""", as_dict=1) + + args = { + "bloggers": bloggers, + "texts": { + "all_posts_by": _("All posts by") + }, + "categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name") + } + + args.update(webnotes.doc("Blog Settings", "Blog Settings").fields) + return args \ No newline at end of file diff --git a/website/doctype/blogger/blogger.txt b/website/doctype/blogger/blogger.txt index e2b4367efb..1486c01247 100644 --- a/website/doctype/blogger/blogger.txt +++ b/website/doctype/blogger/blogger.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-25 16:00:51", "docstatus": 0, - "modified": "2013-07-05 14:27:34", + "modified": "2013-08-30 16:35:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -39,6 +39,12 @@ "doctype": "DocType", "name": "Blogger" }, + { + "doctype": "DocField", + "fieldname": "disabled", + "fieldtype": "Check", + "label": "Disabled" + }, { "description": "Will be used in url (usually first name).", "doctype": "DocField", diff --git a/website/helpers/blog.py b/website/helpers/blog.py index f8f7a421d6..3f6d94fa6c 100644 --- a/website/helpers/blog.py +++ b/website/helpers/blog.py @@ -119,18 +119,3 @@ def get_blog_template_args(): } args.update(webnotes.doc("Blog Settings", "Blog Settings").fields) return args - -def get_writers_args(): - bloggers = webnotes.conn.sql("""select * from `tabBlogger` - order by posts desc""", as_dict=1) - - args = { - "bloggers": bloggers, - "texts": { - "all_posts_by": _("All posts by") - }, - "categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name") - } - - args.update(webnotes.doc("Blog Settings", "Blog Settings").fields) - return args \ No newline at end of file From 240c017b7cbdebfdd322c9ecf3f0383b52d9aa5b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 30 Aug 2013 16:48:20 +0530 Subject: [PATCH 2/3] [blog] [minor] [style] --- website/templates/css/blog_page.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/website/templates/css/blog_page.css b/website/templates/css/blog_page.css index ffa45b4115..8f56cd2fec 100644 --- a/website/templates/css/blog_page.css +++ b/website/templates/css/blog_page.css @@ -1,8 +1,4 @@