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