Favicon for website
Started work on comments to be embedded in blog page
This commit is contained in:
parent
e47def842d
commit
40fce89631
@ -24,6 +24,13 @@ def cleanup():
|
||||
set show_in_website = if(show_in_website = 'Yes', 1, 0)
|
||||
where show_in_website is not null""")
|
||||
|
||||
# move comments from comment_doctype Page to Blog
|
||||
webnotes.conn.sql("""\
|
||||
update `tabComment` comm, `tabBlog` blog
|
||||
set comm.comment_doctype = 'Blog', comm.comment_docname = blog.name
|
||||
where comm.comment_docname = blog.page_name""")
|
||||
|
||||
|
||||
def save_pages():
|
||||
"""save all web pages, blogs to create content"""
|
||||
import webnotes
|
||||
|
@ -35,6 +35,8 @@ class DocType(website.web_page.Page):
|
||||
self.delete_web_cache(self.doc.page_name)
|
||||
|
||||
def get_html(self):
|
||||
import webnotes.utils
|
||||
|
||||
# this is for double precaution. usually it wont reach this code if not published
|
||||
if not webnotes.utils.cint(self.doc.published):
|
||||
raise Exception, "This blog has not been published yet!"
|
||||
@ -45,3 +47,12 @@ class DocType(website.web_page.Page):
|
||||
self.doc.updated = global_date_format(self.doc.modified)
|
||||
|
||||
self.markdown_to_html(['content'])
|
||||
|
||||
comment_list = webnotes.conn.sql("""\
|
||||
select comment, comment_by_fullname, creation
|
||||
from `tabComment` where comment_doctype="Blog"
|
||||
and comment_docname=%s order by creation""", self.doc.name, as_dict=1)
|
||||
|
||||
self.doc.comment_list = comment_list or []
|
||||
for comment in self.doc.comment_list:
|
||||
comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-03 18:43:46',
|
||||
'creation': '2012-05-21 15:54:09',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-05-21 14:59:25',
|
||||
'modified': '2012-07-09 16:20:58',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -18,7 +18,7 @@
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Other',
|
||||
'issingle': 1,
|
||||
'max_attachments': 1,
|
||||
'max_attachments': 10,
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
@ -180,21 +180,21 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'file_list',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 1,
|
||||
'label': u'File List',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
'fieldname': u'misc_section',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Misc',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'An icon file with .ico extension. Should be 16 x 16 px. Generated using a favicon generator. [<a href="http://favicon-generator.org/" target="_blank">favicon-generator.org</a>]',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'domains',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Domains',
|
||||
'fieldname': u'favicon',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'FavIcon',
|
||||
'options': u'attach_files:',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
@ -221,6 +221,18 @@
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'file_list',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 1,
|
||||
'label': u'File List',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
|
@ -3,14 +3,21 @@
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<meta name="generator" content="wnframework">
|
||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<script type="text/javascript" src="js/lib/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/all-web.js"></script>
|
||||
<script type="text/javascript" src="js/wn-web.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="css/all-web.css">
|
||||
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
|
||||
|
||||
{% if favicon %}
|
||||
<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
|
||||
<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
|
||||
{% else %}
|
||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% block header %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
@ -11,21 +11,51 @@
|
||||
{{ content_html }}
|
||||
<hr><h3>Comments</h3>
|
||||
<br>
|
||||
<div class="blog-comments"></div>
|
||||
<div class="blog-comments">
|
||||
{% for comment in comment_list %}
|
||||
<div class="comment-row">
|
||||
<div class="comment-title">
|
||||
{{ comment.comment_by_fullname }} - {{ comment.comment_date }}:
|
||||
{{ comment.comment_date_type }}
|
||||
</div>
|
||||
<p class="comment-content">{{ comment.comment }}</p>
|
||||
<hr>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layout-side-section">
|
||||
<p><a href="blog.html">All Blogs</a></p>
|
||||
<h4>Recent Posts</h4>
|
||||
<div class="recent-posts" style="min-height: 100px;"></div>
|
||||
<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>
|
||||
<br />
|
||||
<h4>Recent Posts</h4>
|
||||
<div class="recent-posts" style="min-height: 100px;"></div>
|
||||
</div>
|
||||
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
.comment-title {
|
||||
color:#777;
|
||||
}
|
||||
|
||||
.comment-content {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
/* .comment-row {
|
||||
padding: 5px 0px;
|
||||
}
|
||||
*/ </style>
|
||||
|
||||
{% endblock %}
|
@ -18,7 +18,10 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// js inside blog page
|
||||
wn.provide('erpnext.blog');
|
||||
wn.pages['{{ name }}'].onload = function(wrapper) {
|
||||
erpnext.blog.wrapper = wrapper;
|
||||
|
||||
// sidebar
|
||||
wrapper.recent_list = new wn.ui.Listing({
|
||||
parent: $(wrapper).find('.recent-posts'),
|
||||
@ -31,57 +34,72 @@ wn.pages['{{ name }}'].onload = function(wrapper) {
|
||||
if(data.content && data.content.length==100) data.content += '...';
|
||||
parent.innerHTML = repl('<a href="%(name)s.html">%(title)s</a>\
|
||||
<div class="comment">%(content)s</div><br>', data);
|
||||
|
||||
// adjust page height depending on sidebar height
|
||||
erpnext.blog.adjust_page_height(wrapper);
|
||||
},
|
||||
page_length: 5,
|
||||
});
|
||||
wrapper.recent_list.run();
|
||||
|
||||
wrapper.comment_list = new wn.ui.Listing({
|
||||
parent: $(wrapper).find('.blog-comments').get(0),
|
||||
no_toolbar: true,
|
||||
query: 'select comment, comment_by_fullname, creation\
|
||||
from `tabComment` where comment_doctype="Page"\
|
||||
and comment_docname="{{ name }}" order by creation desc',
|
||||
no_result_message: 'Be the first one to comment',
|
||||
render_row: function(parent, data) {
|
||||
data.comment_date = prettyDate(data.creation);
|
||||
$(parent).html(repl("<div style='color:#777'>\
|
||||
%(comment_by_fullname)s | %(comment_date)s:\
|
||||
</div>\
|
||||
<p style='margin-left: 20px;'>%(comment)s</p><br>", data))
|
||||
},
|
||||
hide_refresh: true,
|
||||
});
|
||||
wrapper.comment_list.run();
|
||||
|
||||
// add comment
|
||||
$(wrapper).find('.layout-main-section').append('<br><button class="btn add-comment">\
|
||||
Add Comment</button>');
|
||||
$(wrapper).find('button.add-comment').click(function(){
|
||||
d = new wn.widgets.Dialog({
|
||||
title: 'Add Comment',
|
||||
fields: [
|
||||
{fieldname:'comment_by_fullname', label:'Your Name', reqd:1, fieldtype:'Data'},
|
||||
{fieldname:'comment_by', label:'Email Id', reqd:1, fieldtype:'Data'},
|
||||
{fieldname:'comment', label:'Comment', reqd:1, fieldtype:'Text'},
|
||||
{fieldname:'post', label:'Post', fieldtype:'Button'}
|
||||
]
|
||||
});
|
||||
d.fields_dict.post.input.onclick = function() {
|
||||
var btn = this;
|
||||
var args = d.get_values();
|
||||
if(!args) return;
|
||||
args.comment_doctype = 'Page';
|
||||
args.comment_docname = '{{ name }}';
|
||||
$(btn).set_working();
|
||||
$c('webnotes.widgets.form.comments.add_comment', args, function(r) {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
wrapper.comment_list.refresh();
|
||||
})
|
||||
}
|
||||
d.show();
|
||||
})
|
||||
|
||||
erpnext.blog.adjust_page_height = function(wrapper) {
|
||||
if (!wrapper) { wrapper = erpnext.blog.wrapper; }
|
||||
if (!wrapper) { return; }
|
||||
|
||||
// adjust page height based on sidebar height
|
||||
var $main_page = $(wrapper).find('.layout-main-section');
|
||||
var $sidebar = $(wrapper).find('.layout-side-section');
|
||||
if ($sidebar.height() > $main_page.height()) {
|
||||
$main_page.height($sidebar.height());
|
||||
}
|
||||
}
|
||||
// wrapper.comment_list = new wn.ui.Listing({
|
||||
// parent: $(wrapper).find('.blog-comments').get(0),
|
||||
// no_toolbar: true,
|
||||
// query: 'select comment, comment_by_fullname, creation\
|
||||
// from `tabComment` where comment_doctype="Page"\
|
||||
// and comment_docname="{{ name }}" order by creation desc',
|
||||
// no_result_message: 'Be the first one to comment',
|
||||
// render_row: function(parent, data) {
|
||||
// data.comment_date = prettyDate(data.creation);
|
||||
// $(parent).html(repl("<div style='color:#777'>\
|
||||
// %(comment_by_fullname)s | %(comment_date)s:\
|
||||
// </div>\
|
||||
// <p style='margin-left: 20px;'>%(comment)s</p><br>", data))
|
||||
// },
|
||||
// hide_refresh: true,
|
||||
// });
|
||||
// wrapper.comment_list.run();
|
||||
//
|
||||
// // add comment
|
||||
// $(wrapper).find('.layout-main-section').append('<br><button class="btn add-comment">\
|
||||
// Add Comment</button>');
|
||||
// $(wrapper).find('button.add-comment').click(function(){
|
||||
// d = new wn.widgets.Dialog({
|
||||
// title: 'Add Comment',
|
||||
// fields: [
|
||||
// {fieldname:'comment_by_fullname', label:'Your Name', reqd:1, fieldtype:'Data'},
|
||||
// {fieldname:'comment_by', label:'Email Id', reqd:1, fieldtype:'Data'},
|
||||
// {fieldname:'comment', label:'Comment', reqd:1, fieldtype:'Text'},
|
||||
// {fieldname:'post', label:'Post', fieldtype:'Button'}
|
||||
// ]
|
||||
// });
|
||||
// d.fields_dict.post.input.onclick = function() {
|
||||
// var btn = this;
|
||||
// var args = d.get_values();
|
||||
// if(!args) return;
|
||||
// args.comment_doctype = 'Page';
|
||||
// args.comment_docname = '{{ name }}';
|
||||
// $(btn).set_working();
|
||||
// $c('webnotes.widgets.form.comments.add_comment', args, function(r) {
|
||||
// $(btn).done_working();
|
||||
// d.hide();
|
||||
// wrapper.comment_list.refresh();
|
||||
// })
|
||||
// }
|
||||
// d.show();
|
||||
// })
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,16 +1,7 @@
|
||||
{% extends "login/login.js" %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
#login_wrapper {
|
||||
width: 300px !important;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.login-banner {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
{% block title %}
|
||||
Login Page
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -51,3 +42,16 @@
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
#login_wrapper {
|
||||
width: 300px !important;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.login-banner {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
@ -25,18 +25,25 @@ wn.pages['{{ name }}'].onload = function(wrapper) {
|
||||
erpnext.products.make_similar_products(wrapper);
|
||||
|
||||
// if website image missing, autogenerate one
|
||||
var $img = $('.product-page-content').find('.img-area');
|
||||
var $img = $(wrapper).find('.product-page-content .img-area');
|
||||
if ($img && $img.length > 0) {
|
||||
$img.append(wn.dom.placeholder(160, "{{ item_name }}"));
|
||||
}
|
||||
|
||||
erpnext.products.adjust_page_height(wrapper);
|
||||
|
||||
}
|
||||
|
||||
erpnext.products.adjust_page_height = function(wrapper) {
|
||||
if (!wrapper) { wrapper = erpnext.products.wrapper; }
|
||||
if (!wrapper) { return; }
|
||||
|
||||
// adjust page height based on sidebar height
|
||||
var $main_page = $('.layout-main-section');
|
||||
var $sidebar = $('.layout-side-section');
|
||||
var $main_page = $(wrapper).find('.layout-main-section');
|
||||
var $sidebar = $(wrapper).find('.layout-side-section');
|
||||
if ($sidebar.height() > $main_page.height()) {
|
||||
$main_page.height($sidebar.height());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
erpnext.products.make_similar_products = function(wrapper) {
|
||||
@ -78,6 +85,9 @@ erpnext.products.make_similar_products = function(wrapper) {
|
||||
$(parent).find('.img-area').append(wn.dom.placeholder(55,
|
||||
data.item_name));
|
||||
}
|
||||
|
||||
// adjust page height, if sidebar height keeps increasing
|
||||
erpnext.products.adjust_page_height(wrapper);
|
||||
}
|
||||
});
|
||||
wrapper.similar.run();
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "product/product_list.js" %}
|
||||
|
||||
{% block title %}Products{% endblock %}
|
||||
{% block title %}
|
||||
Products
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
|
@ -73,17 +73,15 @@ def load_into_web_cache(page_name, template, doc_type, doc_name):
|
||||
args.update(outer_env_dict)
|
||||
|
||||
# decide template and update args
|
||||
if doc_type == 'Blog':
|
||||
template = 'blog/blog.html'
|
||||
args.update({ 'insert_code': 1 })
|
||||
elif doc_type == 'Item':
|
||||
template = 'product/product.html'
|
||||
args.update({ 'insert_code': 1 })
|
||||
elif doc_type == 'Web Page':
|
||||
if doc_type == 'Web Page':
|
||||
template = 'web_page.html'
|
||||
else:
|
||||
args.update({ 'insert_code': 1 })
|
||||
if page_name == 'blog':
|
||||
if doc_type == 'Blog':
|
||||
template = 'blog/blog.html'
|
||||
elif doc_type == 'Item':
|
||||
template = 'product/product.html'
|
||||
elif page_name == 'blog':
|
||||
template = 'blog/blog_list.html'
|
||||
elif page_name == 'products':
|
||||
template = 'product/product_list.html'
|
||||
@ -120,6 +118,7 @@ def get_outer_env():
|
||||
|
||||
'brand': webnotes.conn.get_value('Website Settings', None, 'brand_html'),
|
||||
'copyright': webnotes.conn.get_value('Website Settings', None, 'copyright'),
|
||||
'favicon': webnotes.conn.get_value('Website Settings', None, 'favicon')
|
||||
}
|
||||
|
||||
def get_index_page():
|
||||
|
Loading…
x
Reference in New Issue
Block a user