added blog settings and metadata

This commit is contained in:
Rushabh Mehta 2013-03-11 17:57:57 +05:30
parent bbbceb617c
commit b33693db35
12 changed files with 74 additions and 26 deletions

View File

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

View File

@ -39,6 +39,9 @@ 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:

View File

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

View File

@ -127,9 +127,11 @@ def get_blog_content(blog_page_name):
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 +140,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")
}
}
args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
return args

View File

@ -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"
},
]
},

View File

@ -19,6 +19,9 @@
<link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
{% endif %}
{% if description %}
<meta name="description" content="{{ description }}">
{% endif %}
{% block header %}
{% endblock %}

View File

@ -9,14 +9,17 @@
{% endblock %}
{% block content %}
<div class="span12">
<h2>{{ title }}</h2>
<div class="span12" itemscope itemtype="http://schema.org/BlogPost">
<h2 itemprop="name headline">{{ title }}</h2>
<!-- begin blog content -->
<div class="help" style="color: #aaa">
{{ blogger_info and blogger_info.full_name or full_name }} / {{ updated }}</div>
<span itemprop="author">{{ blogger_info and blogger_info.full_name or full_name }}</span> /
<span itemprop="dateCreated">{{ updated }}</span></div>
<br>
<div itemprop="articleBody">
{{ content_html }}
</div>
<!-- end blog content -->
{% if blogger_info %}
<hr />

View File

@ -1,7 +1,7 @@
<div class="row">
<div class="span2">
<div class="avatar avatar-large">
<img src="{{ blogger_info.avatar }}" />
<img itemprop="thumbnailUrl" src="{{ blogger_info.avatar }}" />
</div>
</div>
<div class="span10">

View File

@ -3,12 +3,15 @@
it is to be included in the blog/blog.html template
#}
{% for comment in comment_list %}
<div class="comment-row">
<div class="comment-title">
{{ comment.comment_by_fullname }} - {{ comment.comment_date }}:
<div itemscope itemtype="http://schema.org/UserComments">
{% for comment in comment_list %}
<div class="comment-row">
<div class="comment-title">
<span itemprop="name" class="author">{{ comment.comment_by_fullname }}</span> /
<span itemprop="commentTime">{{ comment.comment_date }}</span>:
</div>
<p class="comment-content" itemprop="commentText">{{ comment.comment }}</p>
<hr>
</div>
<p class="comment-content">{{ comment.comment }}</p>
<hr>
</div>
{% endfor %}
{% endfor %}
</div>

View File

@ -25,11 +25,11 @@ $(document).ready(function() {
})
if(get_url_arg("by_name")) {
$("#blog-title").html("Posts by " + get_url_arg("by_name"));
$("#blot-subtitle").html("Posts by " + get_url_arg("by_name")).toggle(true);
}
if(get_url_arg("category")) {
$("#blog-title").html("Posts filed under " + get_url_arg("category"));
$("#blot-subtitle").html("Posts filed under " + get_url_arg("category")).toggle(true);
}
});

View File

@ -12,7 +12,11 @@
{% block content %}
<div class="span12">
<h2 id="blog-title">Blog</h2>
<h2 id="blog-title">{{ blog_title }}</h2>
{% if blog_introduction %}
<p>{{ blog_introduction }}</p>
{% endif %}
<h3 id="blot-subtitle" style="display:none;"></h3>
<br>
<div class="progress progress-striped active">
<div class="bar" style="width: 100%;"></div>

View File

@ -5,6 +5,9 @@
{% block content %}
<div class="span12">
<h2 id="blog-title">Blog Writers</h2>
{% if writers_introduction %}
<p>{{ writers_introduction }}</p>
{% endif %}
<hr>
{% for blogger_info in bloggers %}
{% include "html/blogger.html" %}