added writers page
This commit is contained in:
parent
a2deb68776
commit
1dd330177d
@ -5,4 +5,10 @@ import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
# for blog footer
|
||||
from website.utils import clear_cache
|
||||
clear_cache()
|
||||
|
@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import website.utils
|
||||
from webnotes import _
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def get_blog_list(start=0, by=None, category=None):
|
||||
@ -121,4 +122,18 @@ def get_blog_content(blog_page_name):
|
||||
def get_blog_template_args():
|
||||
return {
|
||||
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
|
||||
}
|
||||
|
||||
def get_writers_args():
|
||||
bloggers = webnotes.conn.sql("select * from `tabBlogger` order by full_name", as_dict=1)
|
||||
for blogger in bloggers:
|
||||
if blogger.avatar and not "/" in blogger.avatar:
|
||||
blogger.avatar = "files/" + blogger.avatar
|
||||
|
||||
return {
|
||||
"bloggers": bloggers,
|
||||
"texts": {
|
||||
"all_posts_by": _("All posts by")
|
||||
},
|
||||
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
<div class="span12">
|
||||
<hr />
|
||||
<p><a href="blog">Show posts by everyone</a></p>
|
||||
{% if categories %}
|
||||
<h5>Explore posts by categories</h5>
|
||||
<ul class="breadcrumb" style="background-color: transparent; padding-left: 0px;">
|
||||
@ -8,5 +7,7 @@
|
||||
<li><a href="blog?category={{ category }}">{{ category }}</a>
|
||||
{% if not loop.last %}<span class="divider">/</span>{% endif %}</li>
|
||||
{% endfor %}
|
||||
<br><br>
|
||||
{% endif %}
|
||||
<p>Show posts by <a href="blog">everyone</a>. Meet the <a href="writers">writers</a> of this blog</p>
|
||||
</div>
|
||||
|
@ -20,19 +20,7 @@
|
||||
<!-- end blog content -->
|
||||
{% if blogger_info %}
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<div class="avatar avatar-large">
|
||||
<img src="{{ blogger_info.avatar }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="span10">
|
||||
<h4>{{ blogger_info.full_name }}</h4>
|
||||
<p>{{ blogger_info.bio }}</p>
|
||||
<p><a href="blog?by={{ blogger_info.name }}&by_name={{ blogger_info.full_name }}">
|
||||
{{ texts.all_posts_by }} {{ blogger_info.full_name }}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{% include "html/blogger.html" %}
|
||||
{% endif %}
|
||||
<hr>
|
||||
<h3>{{ texts.comments }}</h3><br>
|
||||
|
13
website/templates/html/blogger.html
Normal file
13
website/templates/html/blogger.html
Normal file
@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<div class="avatar avatar-large">
|
||||
<img src="{{ blogger_info.avatar }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="span10">
|
||||
<h4>{{ blogger_info.full_name }}</h4>
|
||||
<p style="color: #999">{{ blogger_info.bio }}</p>
|
||||
<p><a href="blog?by={{ blogger_info.name }}&by_name={{ blogger_info.full_name }}">
|
||||
{{ texts.all_posts_by }} {{ blogger_info.full_name }}</a></p>
|
||||
</div>
|
||||
</div>
|
14
website/templates/pages/writers.html
Normal file
14
website/templates/pages/writers.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends "html/page.html" %}
|
||||
|
||||
{% set title="Blog Writers" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="span12">
|
||||
<h2 id="blog-title">Blog Writers</h2>
|
||||
<hr>
|
||||
{% for blogger_info in bloggers %}
|
||||
{% include "html/blogger.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% include 'html/blog_footer.html' %}
|
||||
{% endblock %}
|
@ -42,7 +42,8 @@ page_map = {
|
||||
page_settings_map = {
|
||||
"about": "About Us Settings",
|
||||
"contact": "Contact Us Settings",
|
||||
"blog": "website.helpers.blog.get_blog_template_args"
|
||||
"blog": "website.helpers.blog.get_blog_template_args",
|
||||
"writers": "website.helpers.blog.get_writers_args"
|
||||
}
|
||||
|
||||
def render(page_name):
|
||||
|
Loading…
x
Reference in New Issue
Block a user