added footer subscribe and blog settings
This commit is contained in:
parent
b33693db35
commit
770e7938d9
0
website/doctype/blog_settings/__init__.py
Normal file
0
website/doctype/blog_settings/__init__.py
Normal file
8
website/doctype/blog_settings/blog_settings.py
Normal file
8
website/doctype/blog_settings/blog_settings.py
Normal file
@ -0,0 +1,8 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
61
website/doctype/blog_settings/blog_settings.txt
Normal file
61
website/doctype/blog_settings/blog_settings.txt
Normal file
@ -0,0 +1,61 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-11 17:48:16",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-11 17:48:16",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"description": "Blog Settings",
|
||||
"doctype": "DocType",
|
||||
"issingle": 1,
|
||||
"module": "Website",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Blog Settings",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Blog Settings",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"role": "Website Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Blog Settings"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "blog_title",
|
||||
"fieldtype": "Data",
|
||||
"label": "Blog Title"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "blog_introduction",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Blog Introduction"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "writers_introduction",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Writers Introduction"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
@ -99,10 +99,8 @@ def add_comment(args=None):
|
||||
return comment_html
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def add_subscriber():
|
||||
def add_subscriber(name, email_id):
|
||||
"""add blog subscriber to lead"""
|
||||
full_name = webnotes.form_dict.get('your_name')
|
||||
email = webnotes.form_dict.get('your_email_address')
|
||||
name = webnotes.conn.sql("""select name from tabLead where email_id=%s""", email)
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
@ -114,14 +112,13 @@ def add_subscriber():
|
||||
if not lead.source: lead.source = 'Blog'
|
||||
lead.unsubscribed = 0
|
||||
lead.blog_subscriber = 1
|
||||
lead.lead_name = full_name
|
||||
lead.lead_name = name
|
||||
lead.email_id = email
|
||||
lead.save()
|
||||
|
||||
|
||||
def get_blog_content(blog_page_name):
|
||||
import website.utils
|
||||
content = website.utils.get_html(blog_page_name)
|
||||
content = split_blog_content(content)
|
||||
import webnotes.utils
|
||||
content = webnotes.utils.escape_html(content)
|
||||
return content
|
||||
|
@ -59,7 +59,7 @@ def generate():
|
||||
blog_list = webnotes.conn.sql("""\
|
||||
select page_name as name, modified, creation, title from `tabBlog Post`
|
||||
where ifnull(published,0)=1
|
||||
order by creation desc, modified desc, name asc limit 100""", as_dict=1)
|
||||
order by creation desc, modified desc, name asc limit 20""", as_dict=1)
|
||||
|
||||
for blog in blog_list:
|
||||
blog.link = host + '/' + blog.name + '.html'
|
||||
|
66
website/templates/html/footer.html
Normal file
66
website/templates/html/footer.html
Normal file
@ -0,0 +1,66 @@
|
||||
<footer class="container"><div class="web-footer">
|
||||
{% if facebook_share or google_plus_one or twitter_share or linked_in_share %}
|
||||
<div class="social-icons" style="">
|
||||
<span style="font-size: 11px;">{{ share_text or "Share this page on: "}}</span>
|
||||
{% if google_plus_one %}
|
||||
<a href="https://plus.google.com/share?url={{ url }}"
|
||||
target="_blank"><i class="icon-google-plus"></i></a>
|
||||
{% endif %}
|
||||
{% if twitter_share %}
|
||||
<a href="https://twitter.com/intent/tweet?url={{ url }}&text={{ encoded_title }}"
|
||||
target="_blank" ><i class="icon-twitter"></i></a>
|
||||
{% endif %}
|
||||
{% if facebook_share %}
|
||||
<a href="https://www.facebook.com/sharer.php?u={{ url }}&t={{ encoded_title }}&via={{ twitter_share_via }}"
|
||||
target="_blank"><i class="icon-facebook"></i></a>
|
||||
{% endif %}
|
||||
{% if linked_in_share %}
|
||||
<a href="http://www.linkedin.com/shareArticle?mini=true&url={{ url }}&title={{ encoded_title }}"
|
||||
target="_blank"><i class="icon-linkedin"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<p style="float: right; clear: right;">
|
||||
<a style="font-size: 90%; color: #888;" href="attributions">ERPNext Powered</a>
|
||||
</p>
|
||||
<div class="web-footer-menu">
|
||||
<ul>
|
||||
{% for item in footer_items %}
|
||||
<li><a href="{{ item.url }}" {{ item.target }}
|
||||
data-label="{{ item.label }}">{{ item.label }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if copyright %}
|
||||
<div class="web-footer-copyright">© {{ copyright }}</div>
|
||||
{% endif %}
|
||||
{% if address %}
|
||||
{{ address }}
|
||||
{% endif %}
|
||||
<p><div class="input-append" style="text-align: center; margin:30px 0px;">
|
||||
<input class="span3" id="footer-subscribe-email" type="text" placeholder="Your email address...">
|
||||
<button class="btn" type="button" id="footer-subscribe-button">Stay Updated</button>
|
||||
</div></p>
|
||||
<script>
|
||||
$("#footer-subscribe-button").click(function() {
|
||||
if($("#footer-subscribe-email").val()) {
|
||||
erpnext.send_message({
|
||||
subject:"Subscribe me",
|
||||
sender: $("#footer-subscribe-email").val(),
|
||||
message: "Subscribe to newsletter (via website footer).",
|
||||
callback: function(r) {
|
||||
console.log(r)
|
||||
if(!r.exc) {
|
||||
$("#footer-subscribe-email").val("").attr('disabled', true);
|
||||
$("#footer-subscribe-button").html("Thank You :)")
|
||||
.addClass("btn-success").attr("disabled", true);
|
||||
} else {
|
||||
$("#footer-subscribe-button").html("Error :( Not a valid id?").addClass("btn-danger");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</footer>
|
57
website/templates/html/navbar.html
Normal file
57
website/templates/html/navbar.html
Normal file
@ -0,0 +1,57 @@
|
||||
<div class="navbar{% if top_bar_background=="Black" %} navbar-inverse{% endif %}"
|
||||
style="">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="index">{{ brand_html }}</a>
|
||||
<div class="container">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
{% for page in top_bar_items %}
|
||||
{% if not page.parent_label %}
|
||||
<li data-label="{{ page.label }}"
|
||||
{% if page.child_items %}
|
||||
class="dropdown"
|
||||
{% endif %}>
|
||||
<a href="{{ page.url or '#' }}"
|
||||
{% if page.child_items %}
|
||||
class="dropdown-toggle"
|
||||
onclick="return false;"
|
||||
data-toggle="dropdown"
|
||||
{% endif %}
|
||||
{{ page.target or ''}}>
|
||||
{{ page.label }}
|
||||
{% if page.child_items %}
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{% for child in page.child_items %}
|
||||
<li data-label="{{ child.label }}">
|
||||
<a {% if child.indent %}
|
||||
style="padding-left:
|
||||
{{(int(child.indent)+1)*15 }}px"
|
||||
{% endif %}
|
||||
href="{{ child.url }}" {{ child.target or '' }}>
|
||||
{{ child.label }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li id="login-topbar-item"><a href="login">Login</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('.dropdown-toggle').dropdown()</script>
|
@ -5,106 +5,13 @@
|
||||
</header>
|
||||
<div class="container">
|
||||
<div class="outer">
|
||||
<div class="navbar{% if top_bar_background=="Black" %} navbar-inverse{% endif %}"
|
||||
style="">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="index">{{ brand_html }}</a>
|
||||
<div class="container">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
{% for page in top_bar_items %}
|
||||
{% if not page.parent_label %}
|
||||
<li data-label="{{ page.label }}"
|
||||
{% if page.child_items %}
|
||||
class="dropdown"
|
||||
{% endif %}>
|
||||
<a href="{{ page.url or '#' }}"
|
||||
{% if page.child_items %}
|
||||
class="dropdown-toggle"
|
||||
onclick="return false;"
|
||||
data-toggle="dropdown"
|
||||
{% endif %}
|
||||
{{ page.target or ''}}>
|
||||
{{ page.label }}
|
||||
{% if page.child_items %}
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{% for child in page.child_items %}
|
||||
<li data-label="{{ child.label }}">
|
||||
<a {% if child.indent %}
|
||||
style="padding-left:
|
||||
{{(int(child.indent)+1)*15 }}px"
|
||||
{% endif %}
|
||||
href="{{ child.url }}" {{ child.target or '' }}>
|
||||
{{ child.label }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li id="login-topbar-item"><a href="login">Login</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('.dropdown-toggle').dropdown()</script>
|
||||
{% include "html/navbar.html" %}
|
||||
<div class="content row" id="page-{{ name }}" style="display: block;">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="container"><div class="web-footer">
|
||||
{% if facebook_share or google_plus_one or twitter_share or linked_in_share %}
|
||||
<div class="social-icons" style="">
|
||||
<span style="font-size: 11px;">{{ share_text or "Share this page on: "}}</span>
|
||||
{% if google_plus_one %}
|
||||
<a href="https://plus.google.com/share?url={{ url }}"
|
||||
target="_blank"><i class="icon-google-plus"></i></a>
|
||||
{% endif %}
|
||||
{% if twitter_share %}
|
||||
<a href="https://twitter.com/intent/tweet?url={{ url }}&text={{ encoded_title }}"
|
||||
target="_blank" ><i class="icon-twitter"></i></a>
|
||||
{% endif %}
|
||||
{% if facebook_share %}
|
||||
<a href="https://www.facebook.com/sharer.php?u={{ url }}&t={{ encoded_title }}&via={{ twitter_share_via }}"
|
||||
target="_blank"><i class="icon-facebook"></i></a>
|
||||
{% endif %}
|
||||
{% if linked_in_share %}
|
||||
<a href="http://www.linkedin.com/shareArticle?mini=true&url={{ url }}&title={{ encoded_title }}"
|
||||
target="_blank"><i class="icon-linkedin"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<p style="float: right; clear: right;">
|
||||
<a style="font-size: 90%; color: #888;" href="attributions">ERPNext Powered</a></p>
|
||||
<div class="web-footer-menu"><ul>
|
||||
{% for item in footer_items %}
|
||||
<li><a href="{{ item.url }}" {{ item.target }}
|
||||
data-label="{{ item.label }}">{{ item.label }}</a></li>
|
||||
{% endfor %}
|
||||
</ul></div>
|
||||
{% if copyright %}
|
||||
<div class="web-footer-copyright">© {{ copyright }}</div>
|
||||
{% endif %}
|
||||
{% if address %}
|
||||
{{ address }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</footer>
|
||||
{% include "html/footer.html" %}
|
||||
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user