list blogs based on creation date
This commit is contained in:
parent
df914991c4
commit
03a26f2ed2
@ -22,7 +22,7 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) {
|
||||
parent: $(wrapper).find('.recent-posts'),
|
||||
no_toolbar: true,
|
||||
query: 'select name, title, left(content, 100) as content from tabBlog\
|
||||
where ifnull(published,0)=1 and name!="{{ doc.name }}" order by modified desc',
|
||||
where ifnull(published,0)=1 and name!="{{ doc.name }}" order by creation desc',
|
||||
hide_refresh: true,
|
||||
render_row: function(parent, data) {
|
||||
//console.log(data);
|
||||
@ -37,12 +37,12 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) {
|
||||
wrapper.comment_list = new wn.ui.Listing({
|
||||
parent: $(wrapper).find('.blog-comments').get(0),
|
||||
no_toolbar: true,
|
||||
query: 'select comment, comment_by_fullname, modified\
|
||||
query: 'select comment, comment_by_fullname, creation\
|
||||
from `tabComment` where comment_doctype="Page"\
|
||||
and comment_docname="{{ doc.name }}" order by modified desc',
|
||||
and comment_docname="{{ doc.name }}" order by creation desc',
|
||||
no_result_message: 'Be the first one to comment',
|
||||
render_row: function(parent, data) {
|
||||
data.comment_date = prettyDate(data.modified);
|
||||
data.comment_date = prettyDate(data.creation);
|
||||
$(parent).html(repl("<div style='color:#777'>\
|
||||
%(comment_by_fullname)s | %(comment_date)s:\
|
||||
</div>\
|
||||
|
@ -18,18 +18,18 @@
|
||||
pscript.onload_blog = function(wrapper) {
|
||||
wrapper.blog_list = new wn.ui.Listing({
|
||||
parent: $(wrapper).find('#blog-list').get(0),
|
||||
query: 'select tabBlog.name, title, left(content, 1000) as content, tabBlog.modified, \
|
||||
query: 'select tabBlog.name, title, left(content, 1000) as content, tabBlog.creation, \
|
||||
ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
|
||||
from tabProfile, tabBlog\
|
||||
where ifnull(published,0)=1 and tabBlog.owner = tabProfile.name \
|
||||
order by tabBlog.modified desc',
|
||||
order by tabBlog.creation desc',
|
||||
hide_refresh: true,
|
||||
no_toolbar: true,
|
||||
render_row: function(parent, data) {
|
||||
if(data.content && data.content.length==1000) data.content += '... (read on)';
|
||||
data.content = wn.markdown(data.content);
|
||||
if(data.last_name) data.last_name = ' ' + data.last_name;
|
||||
data.date = prettyDate(data.modified);
|
||||
data.date = prettyDate(data.creation);
|
||||
parent.innerHTML = repl('<h2>%(title)s</h2>\
|
||||
<p><div class="help">By %(first_name)s%(last_name)s, %(date)s</div></p>\
|
||||
<p>%(content)s</p>\
|
||||
|
Loading…
x
Reference in New Issue
Block a user