added blog subscriber, unsubscribe
This commit is contained in:
parent
ad10c695ff
commit
3a751e8f82
@ -1,6 +1,5 @@
|
|||||||
pscript.onload_dashboard = function() {
|
pscript.onload_dashboard = function() {
|
||||||
// load jqplot
|
// load jqplot
|
||||||
$.scriptPath = 'js/'
|
|
||||||
wn.require('lib/css/jqpot.css');
|
wn.require('lib/css/jqpot.css');
|
||||||
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
|
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
|
||||||
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.barRenderer.js');
|
wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.barRenderer.js');
|
||||||
|
@ -16,10 +16,14 @@ def execute():
|
|||||||
reload_doc('website', 'doctype', 'top_bar_item')
|
reload_doc('website', 'doctype', 'top_bar_item')
|
||||||
reload_doc('website', 'doctype', 'contact_us_settings')
|
reload_doc('website', 'doctype', 'contact_us_settings')
|
||||||
reload_doc('website', 'doctype', 'about_us_settings')
|
reload_doc('website', 'doctype', 'about_us_settings')
|
||||||
|
reload_doc('website', 'doctype', 'blog')
|
||||||
|
reload_doc('website', 'doctype', 'blog_subscriber')
|
||||||
|
|
||||||
reload_doc('website', 'page', 'home')
|
reload_doc('website', 'page', 'home')
|
||||||
reload_doc('website', 'page', 'contact')
|
reload_doc('website', 'page', 'contact')
|
||||||
reload_doc('website', 'page', 'about')
|
reload_doc('website', 'page', 'about')
|
||||||
|
reload_doc('website', 'page', 'blog')
|
||||||
|
reload_doc('website', 'page', 'unsubscribe')
|
||||||
|
|
||||||
def add_website_manager():
|
def add_website_manager():
|
||||||
"""add website manager to system manager"""
|
"""add website manager to system manager"""
|
||||||
|
@ -5,11 +5,10 @@ pscript['onload_Sales Dashboard'] = function() {
|
|||||||
$dh(pscript.mnt_div);
|
$dh(pscript.mnt_div);
|
||||||
$dh(pscript.mnt_div1);
|
$dh(pscript.mnt_div1);
|
||||||
//pscript.dx_axis = [];
|
//pscript.dx_axis = [];
|
||||||
|
|
||||||
if($.jqplot) pscript.all_onchnge();
|
wn.require('lib/css/jqpot.css');
|
||||||
else
|
wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
|
||||||
// import the library
|
pscript.all_onchnge();
|
||||||
$c_js('jquery/jquery.jqplot.min.js', pscript.all_onchnge);
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
pscript.make_filters = function(){
|
pscript.make_filters = function(){
|
||||||
|
@ -42,7 +42,7 @@ def boot_session(bootinfo):
|
|||||||
if webnotes.session['user']=='Guest':
|
if webnotes.session['user']=='Guest':
|
||||||
bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings')
|
bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings')
|
||||||
bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page, parent_label
|
bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page, parent_label
|
||||||
from `tabTop Bar Item`""", as_dict=1)
|
from `tabTop Bar Item` where parent='Top Bar Settings' order by idx asc""", as_dict=1)
|
||||||
else:
|
else:
|
||||||
bootinfo['letter_heads'] = get_letter_heads()
|
bootinfo['letter_heads'] = get_letter_heads()
|
||||||
|
|
||||||
|
0
erpnext/website/doctype/blog_subscriber/__init__.py
Normal file
0
erpnext/website/doctype/blog_subscriber/__init__.py
Normal file
29
erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
Normal file
29
erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# DocType, Blog Subscriber
|
||||||
|
[
|
||||||
|
|
||||||
|
# These values are common in all dictionaries
|
||||||
|
{
|
||||||
|
'creation': '2012-01-27 17:18:33',
|
||||||
|
'docstatus': 0,
|
||||||
|
'modified': '2012-01-27 17:18:33',
|
||||||
|
'modified_by': 'Administrator',
|
||||||
|
'owner': 'Administrator'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocType
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'module': 'Website',
|
||||||
|
'name': '__common__',
|
||||||
|
'section_style': 'Simple',
|
||||||
|
'show_in_menu': 0,
|
||||||
|
'version': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocType, Blog Subscriber
|
||||||
|
{
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'name': 'Blog Subscriber'
|
||||||
|
}
|
||||||
|
]
|
@ -20,7 +20,7 @@ erpnext.topbar.TopBar = Class.extend({
|
|||||||
$('header').append('<div class="topbar">\
|
$('header').append('<div class="topbar">\
|
||||||
<div class="topbar-inner">\
|
<div class="topbar-inner">\
|
||||||
<div class="container">\
|
<div class="container">\
|
||||||
<a class="brand">[brand]</a>\
|
<a class="brand" href="#!home">[brand]</a>\
|
||||||
<ul class="nav">\
|
<ul class="nav">\
|
||||||
</ul>\
|
</ul>\
|
||||||
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
|
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
|
||||||
|
14
erpnext/website/page/blog/blog.html
Normal file
14
erpnext/website/page/blog/blog.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<div class="layout_wrapper">
|
||||||
|
<div class="web-content" id="content-blog">
|
||||||
|
<h1>Blog</h1>
|
||||||
|
<br>
|
||||||
|
<div class="web-main-section">
|
||||||
|
</div>
|
||||||
|
<div class="web-side-section">
|
||||||
|
<h4>Get Updates</h4>
|
||||||
|
<input name="blog-subscribe">
|
||||||
|
<button class="btn" id="blog-subscribe">Subscribe</button>
|
||||||
|
</div>
|
||||||
|
<div style="clear: both"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
39
erpnext/website/page/blog/blog.js
Normal file
39
erpnext/website/page/blog/blog.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
wn.require('lib/js/lib/prettydate.js')
|
||||||
|
|
||||||
|
pscript.onload_blog = function(wrapper) {
|
||||||
|
wrapper.blog_list = new wn.widgets.Listing({
|
||||||
|
parent: $(wrapper).find('.web-main-section').get(0),
|
||||||
|
query: 'select tabBlog.name, title, left(content, 300) as content, tabBlog.modified, \
|
||||||
|
ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
|
||||||
|
from tabProfile, tabBlog\
|
||||||
|
where ifnull(published,1)=1 and tabBlog.owner = tabProfile.name',
|
||||||
|
hide_refresh: true,
|
||||||
|
render_row: function(parent, data) {
|
||||||
|
if(data.content.length==300) data.content += '...';
|
||||||
|
data.date = prettyDate(data.modified);
|
||||||
|
parent.innerHTML = repl('<h4><a href="#!%(name)s">%(title)s</a></h4>\
|
||||||
|
<div class="help">By %(first_name)s %(last_name)s on %(date)s</div>\
|
||||||
|
<p><div class="comment">%(content)s</div></p><br>', data);
|
||||||
|
},
|
||||||
|
page_length: 10
|
||||||
|
});
|
||||||
|
wrapper.blog_list.run();
|
||||||
|
|
||||||
|
// subscribe button
|
||||||
|
$('#blog-subscribe').click(function() {
|
||||||
|
var email = $(wrapper).find('input[name="blog-subscribe"]').val();
|
||||||
|
if(!validate_email(email)) {
|
||||||
|
msgprint('Please enter a valid email!');
|
||||||
|
}
|
||||||
|
wn.call({
|
||||||
|
module:'website',
|
||||||
|
page:'blog',
|
||||||
|
method:'subscribe',
|
||||||
|
args:email,
|
||||||
|
btn: this,
|
||||||
|
callback: function() {
|
||||||
|
$(wrapper).find('input[name="blog-subscribe"]').val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
11
erpnext/website/page/blog/blog.py
Normal file
11
erpnext/website/page/blog/blog.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import webnotes
|
||||||
|
def subscribe(arg):
|
||||||
|
"""subscribe to blog (blog_subscriber)"""
|
||||||
|
if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg):
|
||||||
|
webnotes.msgprint("Already a subscriber. Thanks!")
|
||||||
|
else:
|
||||||
|
from webnotes.model.doc import Document
|
||||||
|
d = Document('Blog Subscriber')
|
||||||
|
d.name = arg
|
||||||
|
d.save()
|
||||||
|
webnotes.msgprint("Thank you for subscribing!")
|
0
erpnext/website/page/unsubscribe/__init__.py
Normal file
0
erpnext/website/page/unsubscribe/__init__.py
Normal file
13
erpnext/website/page/unsubscribe/unsubscribe.html
Normal file
13
erpnext/website/page/unsubscribe/unsubscribe.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<div class="layout_wrapper">
|
||||||
|
<div class="web-content">
|
||||||
|
<h1>Unsubscribe</h1>
|
||||||
|
<br>
|
||||||
|
<div class="web-main-section">
|
||||||
|
<input name="unsubscribe">
|
||||||
|
<button class="btn" id="btn-unsubscribe">Unsubscribe</button>
|
||||||
|
</div>
|
||||||
|
<div class="web-side-section">
|
||||||
|
</div>
|
||||||
|
<div style="clear: both"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
21
erpnext/website/page/unsubscribe/unsubscribe.js
Normal file
21
erpnext/website/page/unsubscribe/unsubscribe.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
pscript.onload_unsubscribe = function(wrapper) {
|
||||||
|
var email = window.location.hash.split('/').splice(-1);
|
||||||
|
$(wrapper).find('input[name="unsubscribe"]').val(email)
|
||||||
|
|
||||||
|
$('#btn-unsubscribe').click(function() {
|
||||||
|
var email = $(wrapper).find('input[name="unsubscribe"]').val();
|
||||||
|
if(email) {
|
||||||
|
var btn = this;
|
||||||
|
wn.call({
|
||||||
|
module:'website',
|
||||||
|
page:'unsubscribe',
|
||||||
|
method:'unsubscribe',
|
||||||
|
args:email,
|
||||||
|
btn: this,
|
||||||
|
callback: function() {
|
||||||
|
$(wrapper).find('input[name="unsubscribe"]').val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
8
erpnext/website/page/unsubscribe/unsubscribe.py
Normal file
8
erpnext/website/page/unsubscribe/unsubscribe.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
def unsubscribe(arg):
|
||||||
|
"""unsubscribe from lists"""
|
||||||
|
import webnotes
|
||||||
|
lists = [['Blog Subscriber', 'name']]
|
||||||
|
for l in lists:
|
||||||
|
webnotes.conn.sql("""delete from `tab%s` where %s=%s""" % (l[0], l[1], '%s'), arg)
|
||||||
|
|
||||||
|
webnotes.msgprint('Unsubscribed!')
|
43
erpnext/website/page/unsubscribe/unsubscribe.txt
Normal file
43
erpnext/website/page/unsubscribe/unsubscribe.txt
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Page, unsubscribe
|
||||||
|
[
|
||||||
|
|
||||||
|
# These values are common in all dictionaries
|
||||||
|
{
|
||||||
|
'creation': '2012-01-27 17:19:02',
|
||||||
|
'docstatus': 0,
|
||||||
|
'modified': '2012-01-27 17:19:02',
|
||||||
|
'modified_by': 'Administrator',
|
||||||
|
'owner': 'Administrator'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all Page
|
||||||
|
{
|
||||||
|
'doctype': 'Page',
|
||||||
|
'module': 'Website',
|
||||||
|
'name': '__common__',
|
||||||
|
'page_name': 'unsubscribe',
|
||||||
|
'standard': 'Yes',
|
||||||
|
'title': 'Unsubscribe'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all Page Role
|
||||||
|
{
|
||||||
|
'doctype': 'Page Role',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': 'unsubscribe',
|
||||||
|
'parentfield': 'roles',
|
||||||
|
'parenttype': 'Page',
|
||||||
|
'role': 'Guest'
|
||||||
|
},
|
||||||
|
|
||||||
|
# Page, unsubscribe
|
||||||
|
{
|
||||||
|
'doctype': 'Page',
|
||||||
|
'name': 'unsubscribe'
|
||||||
|
},
|
||||||
|
|
||||||
|
# Page Role
|
||||||
|
{
|
||||||
|
'doctype': 'Page Role'
|
||||||
|
}
|
||||||
|
]
|
@ -3,7 +3,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ERPNext</title>
|
<title>ERPNext</title>
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<script type="text/javascript">window._version_number="228";
|
<script type="text/javascript">window._version_number="233";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/class.js
|
* lib/js/wn/class.js
|
||||||
|
@ -1 +1 @@
|
|||||||
228
|
233
|
Loading…
x
Reference in New Issue
Block a user