created files for blog subscription to be embedded in blog and blog_page

This commit is contained in:
Rushabh Mehta 2012-08-03 14:13:30 +05:30
parent 0c5b438623
commit 5f21cc03e6
5 changed files with 53 additions and 18 deletions

View File

@ -2,6 +2,7 @@
{% block javascript %}
{% include "js/blog_page.js" %}
{% include "js/blog_subscribe.js" %}
{% endblock %}
{% block css %}
@ -41,11 +42,9 @@
<div class="layout-side-section">
<p><a href="blog.html">All Blogs</a></p>
<br />
<h4>Subscribe</h4>
<p>
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
<a href="rss.xml" target="_blank">RSS Feed</a>
</p>
{% block blog_subscribe %}
{% include "html/blog_subscribe.html" %}
{% endblock %}
<br />
<h4>Recent Posts</h4>
<div class="recent-posts" style="min-height: 100px;"></div>

View File

@ -0,0 +1,9 @@
<h4>Subscribe</h4>
<br>
<p>
<button class="btn btn-warning btn-blog-subscribe">Get Updates via Email</button>
</p>
<p>
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
<a href="rss.xml" target="_blank">RSS Feed</a>
</p>

View File

@ -59,8 +59,9 @@ erpnext.blog.render_recent_list = function(wrapper) {
hide_refresh: true,
render_row: function(parent, data) {
if(data.content && data.content.length>=100) data.content += '...';
parent.innerHTML = repl('<a href="%(page_name)s.html">%(title)s</a>\
<div class="comment">%(content)s</div><br>', data);
parent.innerHTML = repl('<div style="font-size: 80%">\
<a href="%(page_name)s.html">%(title)s</a>\
<div class="comment">%(content)s</div><br></div>', data);
// adjust page height depending on sidebar height
erpnext.blog.adjust_page_height(wrapper);

View File

@ -0,0 +1,33 @@
wn.provide('erpnext.blog');
(function() {
$('body').on('click', '.btn-blog-subscribe', function() {
var d = new wn.ui.Dialog({
title: "Get Blog Updates via Email",
fields: [
{label: "Your Name", fieldtype:"Data", reqd:1},
{label: "Your Email Address", fieldtype:"Data", reqd:1
,description: "You can unsubscribe anytime."},
{label: "Subscribe", fieldtype:"Button"}
]
});
$(d.fields_dict.subscribe.input).click(function() {
var args = d.get_values();
if(!args) return;
wn.call({
method: 'website.blog.add_subscriber',
args: args,
callback: function(r) {
if(r.exc) {
msgprint('Opps there seems to be some error, Please check back after some time.');
} else {
msgprint('Thanks for subscribing!');
}
d.hide();
},
btn: this
})
})
d.show()
})
})()

View File

@ -2,6 +2,7 @@
{% block javascript %}
{% include "js/blog.js" %}
{% include "js/blog_subscribe.js" %}
{% endblock %}
{% block css %}
@ -23,17 +24,9 @@
</div>
<div class="layout-side-section">
<!-- for later
<h4>Get Updates</h4>
<p>
<input name="blog-subscribe">
<button class="btn" id="blog-subscribe">Subscribe</button>
</p>-->
<h4>Subscribe</h4>
<p>
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
<a href="rss.xml" target="_blank">RSS Feed</a>
</p>
{% block blog_subscribe %}
{% include "html/blog_subscribe.html" %}
{% endblock %}
</div>
<div style="clear: both"></div>
</div>