blob: 30dbd3b87e6015e09bc72d044028465ceca51438 [file] [log] [blame]
Rushabh Mehtabd7f7232012-06-15 14:00:06 +05301{% extends "index.html" %}
2
3{% block content %}
4<div class="layout-wrapper layout-wrapper-background">
5 <div class="web-content" id="content-blog">
6 <div class="layout-main-section">
7 <h1>Blog</h1>
8 <br>
9 <div id="blog-list">
10 <!-- blog list will be generated dynamically -->
11 </div>
12 </div>
13 <div class="layout-side-section">
14 <!-- for later
15 <h4>Get Updates</h4>
16 <p>
17 <input name="blog-subscribe">
18 <button class="btn" id="blog-subscribe">Subscribe</button>
19 </p>-->
20 <h4>Subscribe</h4>
21 <p>
22 <img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
23 <a href="rss.xml" target="_blank">RSS Feed</a>
24 </p>
25 </div>
26 <div style="clear: both"></div>
27 </div>
28</div>
29
30<script>
31wrapper.blog_list = new wn.ui.Listing({
32 parent: $(wrapper).find('#blog-list').get(0),
33 query: 'select tabBlog.name, title, left(content, 1000) as content, tabBlog.creation, \
34 ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
35 from tabProfile, tabBlog\
36 where ifnull(published,0)=1 and tabBlog.owner = tabProfile.name \
37 order by tabBlog.creation desc',
38 hide_refresh: true,
39 no_toolbar: true,
40 render_row: function(parent, data) {
41 if(data.content && data.content.length==1000) data.content += '... (read on)';
42 data.content = wn.markdown(data.content);
43 if(data.last_name) data.last_name = ' ' + data.last_name;
44 data.date = prettyDate(data.creation);
45 parent.innerHTML = repl('<h2>%(title)s</h2>\
46 <p><div class="help">By %(first_name)s%(last_name)s, %(date)s</div></p>\
47 <p>%(content)s</p>\
48 <a href="%(name)s.html">Read Full Text</a><br>', data);
49 },
50 page_length: 10
51});
52wrapper.blog_list.run();
53</script>