many style fixes
This commit is contained in:
parent
a685379d6b
commit
b8d6497818
@ -42,11 +42,12 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
|
||||
"makes a new Feed record"
|
||||
#msgprint(subject)
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.utils import get_full_name
|
||||
|
||||
if feedtype in ('Login', 'Comment'):
|
||||
if feedtype in ('Login', 'Comment', 'Assignment'):
|
||||
# delete old login, comment feed
|
||||
webnotes.conn.sql("""delete from tabFeed where
|
||||
datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login')""")
|
||||
datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login', 'Assignment')""")
|
||||
else:
|
||||
# one feed per item
|
||||
webnotes.conn.sql("""delete from tabFeed
|
||||
@ -60,6 +61,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
|
||||
f.doc_name = name
|
||||
f.subject = subject
|
||||
f.color = color
|
||||
f.full_name = get_full_name(owner)
|
||||
f.save()
|
||||
|
||||
def update_feed(doc, method=None):
|
||||
|
@ -5,77 +5,85 @@
|
||||
{
|
||||
'creation': '2011-04-06 18:11:38',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-03 11:28:16',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-02-08 11:35:40',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': '_FEED.#####',
|
||||
'colour': 'White:FFF',
|
||||
'default_print_format': 'Standard',
|
||||
'autoname': u'_FEED.#####',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Home',
|
||||
'module': u'Home',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 2
|
||||
'version': 3
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Feed',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'parent': u'Feed',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Feed
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Feed'
|
||||
'name': u'Feed'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'feed_type',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Feed Type'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'feed_type',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Feed Type'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'doc_type',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Doc Type'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'doc_type',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Doc Type'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'doc_name',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Doc Name'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'doc_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Doc Name'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'subject',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Subject'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'subject',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Subject'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'color',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Color'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'color',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Color'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'full_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Full Name'
|
||||
}
|
||||
]
|
@ -457,11 +457,10 @@ FeedList.prototype.make_list = function() {
|
||||
parent: this.list_area,
|
||||
query: repl('select \
|
||||
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
|
||||
concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")) as full_name, \
|
||||
if(ifnull(t1.full_name,"")="", t1.owner, t1.full_name) as full_name, \
|
||||
t1.modified, t1.color \
|
||||
from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \
|
||||
from tabFeed t1, tabUserRole t3, tabDocPerm t4 \
|
||||
where t1.doc_type = t4.parent \
|
||||
and t2.name = t1.owner \
|
||||
and t3.parent = "%(user)s" \
|
||||
and t4.role = t3.role \
|
||||
and ifnull(t4.`read`,0) = 1 \
|
||||
|
@ -38,7 +38,6 @@ def on_login_post_session(login_manager):
|
||||
|
||||
def comment_added(doc):
|
||||
"""add comment to feed"""
|
||||
import json
|
||||
home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
|
||||
'<i>"' + doc.comment + '"</i>', '#6B24B3')
|
||||
|
||||
|
@ -15,10 +15,6 @@ pscript.startup_make_sidebar = function() {
|
||||
new SidebarItem(ml[m]);
|
||||
}
|
||||
}
|
||||
if(in_list(user_roles, 'System Manager')) {
|
||||
var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
|
||||
$(div).html('[edit]').click(pscript.startup_set_module_order)
|
||||
}
|
||||
nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
|
||||
|
||||
// select current
|
||||
@ -352,33 +348,3 @@ SidebarModuleItem = function(si, det) {
|
||||
si.show_section(me.det.doc_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Drag & Drop order selection
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_set_module_order = function() {
|
||||
var update_order= function(ml) {
|
||||
mdict = {};
|
||||
for(var i=0; i<ml.length; i++) {
|
||||
mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
|
||||
}
|
||||
$c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
|
||||
}
|
||||
|
||||
var callback = function(r, rt) {
|
||||
var ml = [];
|
||||
for(var i=0; i<r.message.length; i++) {
|
||||
var det = r.message[i];
|
||||
ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
|
||||
}
|
||||
new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
|
||||
'<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
|
||||
}
|
||||
$c_obj('Home Control', 'get_module_order', '', callback)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -61,6 +61,27 @@ header .topbar .container {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.web-page-status {
|
||||
background-color: #DDD;
|
||||
padding: 7px;
|
||||
color: #777;
|
||||
clear: both;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.web-page-status a,
|
||||
.web-page-status a:hover,
|
||||
.web-page-status a:visited {
|
||||
padding: 2px;
|
||||
background-color: #777;
|
||||
color: #FFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.web-page-status a:hover {
|
||||
background-color: #444;
|
||||
}
|
||||
|
||||
footer {
|
||||
color: #777;
|
||||
}
|
||||
|
@ -23,8 +23,11 @@ class DocType():
|
||||
from jinja2 import Template
|
||||
import markdown2
|
||||
import os
|
||||
from webnotes.utils import global_date_format, get_full_name
|
||||
|
||||
self.doc.content_html = markdown2.markdown(self.doc.content or '')
|
||||
self.doc.full_name = get_full_name(self.doc.owner)
|
||||
self.doc.updated = global_date_format(self.doc.modified)
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
|
||||
p.content = Template(f.read()).render(doc=self.doc)
|
||||
@ -35,5 +38,11 @@ class DocType():
|
||||
p.save()
|
||||
|
||||
website.utils.add_guest_access_to_page(p.name)
|
||||
|
||||
# cleanup
|
||||
for f in ['content_html', 'full_name', 'updated']:
|
||||
if f in self.doc.fields:
|
||||
del self.doc.fields[f]
|
||||
|
||||
|
||||
|
@ -25,14 +25,14 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) {
|
||||
|
||||
wrapper.comment_list = new wn.widgets.Listing({
|
||||
parent: $(wrapper).find('.web-main-section').get(0),
|
||||
query: 'select comment, comment_by_fullname, comment_date\
|
||||
query: 'select comment, comment_by_fullname, modified\
|
||||
from `tabComment Widget Record` where comment_doctype="Page"\
|
||||
and comment_docname="{{ doc.name }}"',
|
||||
no_result_message: 'Be the first one to comment',
|
||||
render_row: function(parent, data) {
|
||||
data.comment_date = dateutil.str_to_user(data.comment_date);
|
||||
data.comment_date = prettyDate(data.modified);
|
||||
$(parent).html(repl("<div style='color:#777'>\
|
||||
On %(comment_date)s %(comment_by_fullname)s said:\
|
||||
%(comment_by_fullname)s | %(comment_date)s:\
|
||||
</div>\
|
||||
<p style='margin-left: 20px;'>%(comment)s</p><br>", data))
|
||||
},
|
||||
|
@ -2,7 +2,8 @@
|
||||
<div class="web-content" id="blog-{{ doc.name }}">
|
||||
<h1>Blog</h1>
|
||||
<div class="web-main-section">
|
||||
<h2>{{ doc.title }}</h2>
|
||||
<h3>{{ doc.title }}</h3>
|
||||
<div class="help">By {{ doc.full_name }} on {{ doc.updated }}</div>
|
||||
<br>
|
||||
{{ doc.content_html }}
|
||||
</div>
|
||||
|
@ -14,11 +14,15 @@
|
||||
<div class="web-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
{% if doc.see_also %}
|
||||
<div class="info-box">
|
||||
<h4>See Also</h4>
|
||||
{{ doc.see_also }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="clear: both">
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="web-page-status">
|
||||
Last Modified: {{ doc.updated }} <a href="#contact">Feedback</a>
|
||||
</div>
|
||||
|
@ -14,8 +14,10 @@ class DocType:
|
||||
p = website.utils.add_page(self.doc.title)
|
||||
|
||||
from jinja2 import Template
|
||||
from webnotes.utils import global_date_format
|
||||
import os
|
||||
|
||||
self.doc.updated = global_date_format(self.doc.modified)
|
||||
website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
|
||||
|
||||
self.add_page_links()
|
||||
@ -31,24 +33,21 @@ class DocType:
|
||||
def add_page_links(self):
|
||||
"""add links for next_page and see_also"""
|
||||
if self.doc.next_page:
|
||||
self.doc.next_page_html = """<div class="info-box round">
|
||||
<p style="text-align: right"><b>Next:</b>
|
||||
<a href="#!%(name)s">%(title)s</a></p></div>""" % {"name":self.doc.next_page, \
|
||||
self.doc.next_page_html = """<div class="info-box round" style="text-align: right">
|
||||
<b>Next:</b>
|
||||
<a href="#!%(name)s">%(title)s</a></div>""" % {"name":self.doc.next_page, \
|
||||
"title": webnotes.conn.get_value("Page", self.doc.next_page, "title")}
|
||||
|
||||
self.doc.see_also = ''
|
||||
for d in self.doclist:
|
||||
if d.doctype=='Related Page':
|
||||
tmp = {"page":d.page, "title":webnotes.conn.get_value('Page', d.page, 'title')}
|
||||
self.doc.see_also += """<li><a href="#!%(page)s">%(title)s</a></li>""" % tmp
|
||||
|
||||
if self.doc.see_also:
|
||||
self.doc.see_also = '<ul>%s</ul>' % self.doc.see_also
|
||||
|
||||
self.doc.see_also += """<div><a href="#!%(page)s">%(title)s</a></div>""" % tmp
|
||||
|
||||
def cleanup_temp(self):
|
||||
"""cleanup temp fields"""
|
||||
fl = ['main_section_html', 'side_section_html', 'see_also', \
|
||||
'next_page_html', 'head_section_html']
|
||||
'next_page_html', 'head_section_html', 'updated']
|
||||
for f in fl:
|
||||
if f in self.doc.fields:
|
||||
del self.doc.fields[f]
|
||||
|
@ -10,9 +10,9 @@ pscript.onload_blog = function(wrapper) {
|
||||
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);
|
||||
parent.innerHTML = repl('<h3><a href="#!%(name)s">%(title)s</a></h3>\
|
||||
<p><div class="help">By %(first_name)s %(last_name)s on %(date)s</div></p>\
|
||||
<div class="comment">%(content)s</div><br>', data);
|
||||
},
|
||||
page_length: 10
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
367
|
||||
382
|
Loading…
x
Reference in New Issue
Block a user