many style fixes

This commit is contained in:
Rushabh Mehta
2012-02-08 12:33:13 +05:30
parent a685379d6b
commit b8d6497818
13 changed files with 102 additions and 94 deletions

View File

@@ -42,11 +42,12 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
"makes a new Feed record" "makes a new Feed record"
#msgprint(subject) #msgprint(subject)
from webnotes.model.doc import Document 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 # delete old login, comment feed
webnotes.conn.sql("""delete from tabFeed where 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: else:
# one feed per item # one feed per item
webnotes.conn.sql("""delete from tabFeed webnotes.conn.sql("""delete from tabFeed
@@ -60,6 +61,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
f.doc_name = name f.doc_name = name
f.subject = subject f.subject = subject
f.color = color f.color = color
f.full_name = get_full_name(owner)
f.save() f.save()
def update_feed(doc, method=None): def update_feed(doc, method=None):

View File

@@ -5,77 +5,85 @@
{ {
'creation': '2011-04-06 18:11:38', 'creation': '2011-04-06 18:11:38',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-02-03 11:28:16', 'modified': '2012-02-08 11:35:40',
'modified_by': 'Administrator', 'modified_by': u'Administrator',
'owner': 'Administrator' 'owner': u'Administrator'
}, },
# These values are common for all DocType # These values are common for all DocType
{ {
'autoname': '_FEED.#####', 'autoname': u'_FEED.#####',
'colour': 'White:FFF', 'colour': u'White:FFF',
'default_print_format': 'Standard', 'default_print_format': u'Standard',
'doctype': 'DocType', 'doctype': 'DocType',
'module': 'Home', 'module': u'Home',
'name': '__common__', 'name': '__common__',
'section_style': 'Simple', 'section_style': u'Simple',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 2 'version': 3
}, },
# These values are common for all DocField # These values are common for all DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'name': '__common__', 'name': '__common__',
'parent': 'Feed', 'parent': u'Feed',
'parentfield': 'fields', 'parentfield': u'fields',
'parenttype': 'DocType', 'parenttype': u'DocType',
'permlevel': 0 'permlevel': 0
}, },
# DocType, Feed # DocType, Feed
{ {
'doctype': 'DocType', 'doctype': 'DocType',
'name': 'Feed' 'name': u'Feed'
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'feed_type', 'fieldname': u'feed_type',
'fieldtype': 'Select', 'fieldtype': u'Select',
'label': 'Feed Type' 'label': u'Feed Type'
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'doc_type', 'fieldname': u'doc_type',
'fieldtype': 'Data', 'fieldtype': u'Data',
'label': 'Doc Type' 'label': u'Doc Type'
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'doc_name', 'fieldname': u'doc_name',
'fieldtype': 'Data', 'fieldtype': u'Data',
'label': 'Doc Name' 'label': u'Doc Name'
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'subject', 'fieldname': u'subject',
'fieldtype': 'Data', 'fieldtype': u'Data',
'label': 'Subject' 'label': u'Subject'
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'color', 'fieldname': u'color',
'fieldtype': 'Data', 'fieldtype': u'Data',
'label': 'Color' 'label': u'Color'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'full_name',
'fieldtype': u'Data',
'label': u'Full Name'
} }
] ]

View File

@@ -457,11 +457,10 @@ FeedList.prototype.make_list = function() {
parent: this.list_area, parent: this.list_area,
query: repl('select \ query: repl('select \
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \ 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 \ 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 \ where t1.doc_type = t4.parent \
and t2.name = t1.owner \
and t3.parent = "%(user)s" \ and t3.parent = "%(user)s" \
and t4.role = t3.role \ and t4.role = t3.role \
and ifnull(t4.`read`,0) = 1 \ and ifnull(t4.`read`,0) = 1 \

View File

@@ -38,7 +38,6 @@ def on_login_post_session(login_manager):
def comment_added(doc): def comment_added(doc):
"""add comment to feed""" """add comment to feed"""
import json
home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by, home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
'<i>"' + doc.comment + '"</i>', '#6B24B3') '<i>"' + doc.comment + '"</i>', '#6B24B3')

View File

@@ -15,10 +15,6 @@ pscript.startup_make_sidebar = function() {
new SidebarItem(ml[m]); 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); }}); nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
// select current // select current
@@ -352,33 +348,3 @@ SidebarModuleItem = function(si, det) {
si.show_section(me.det.doc_type); 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)
}

View File

@@ -61,6 +61,27 @@ header .topbar .container {
overflow-x: hidden; 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 { footer {
color: #777; color: #777;
} }

View File

@@ -23,8 +23,11 @@ class DocType():
from jinja2 import Template from jinja2 import Template
import markdown2 import markdown2
import os import os
from webnotes.utils import global_date_format, get_full_name
self.doc.content_html = markdown2.markdown(self.doc.content or '') 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: with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
p.content = Template(f.read()).render(doc=self.doc) p.content = Template(f.read()).render(doc=self.doc)
@@ -35,5 +38,11 @@ class DocType():
p.save() p.save()
website.utils.add_guest_access_to_page(p.name) 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]

View File

@@ -25,14 +25,14 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) {
wrapper.comment_list = new wn.widgets.Listing({ wrapper.comment_list = new wn.widgets.Listing({
parent: $(wrapper).find('.web-main-section').get(0), 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"\ from `tabComment Widget Record` where comment_doctype="Page"\
and comment_docname="{{ doc.name }}"', and comment_docname="{{ doc.name }}"',
no_result_message: 'Be the first one to comment', no_result_message: 'Be the first one to comment',
render_row: function(parent, data) { 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'>\ $(parent).html(repl("<div style='color:#777'>\
On %(comment_date)s %(comment_by_fullname)s said:\ %(comment_by_fullname)s | %(comment_date)s:\
</div>\ </div>\
<p style='margin-left: 20px;'>%(comment)s</p><br>", data)) <p style='margin-left: 20px;'>%(comment)s</p><br>", data))
}, },

View File

@@ -2,7 +2,8 @@
<div class="web-content" id="blog-{{ doc.name }}"> <div class="web-content" id="blog-{{ doc.name }}">
<h1>Blog</h1> <h1>Blog</h1>
<div class="web-main-section"> <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> <br>
{{ doc.content_html }} {{ doc.content_html }}
</div> </div>

View File

@@ -14,11 +14,15 @@
<div class="web-side-section"> <div class="web-side-section">
{{ doc.side_section_html }} {{ doc.side_section_html }}
{% if doc.see_also %} {% if doc.see_also %}
<div class="info-box">
<h4>See Also</h4> <h4>See Also</h4>
{{ doc.see_also }} {{ doc.see_also }}
</div>
{% endif %} {% endif %}
</div> </div>
<div style="clear: both"> <div style="clear: both"></div>
</div>
</div> </div>
</div> </div>
<div class="web-page-status">
Last Modified: {{ doc.updated }} <a href="#contact">Feedback</a>
</div>

View File

@@ -14,8 +14,10 @@ class DocType:
p = website.utils.add_page(self.doc.title) p = website.utils.add_page(self.doc.title)
from jinja2 import Template from jinja2 import Template
from webnotes.utils import global_date_format
import os import os
self.doc.updated = global_date_format(self.doc.modified)
website.utils.markdown(self.doc, ['head_section','main_section', 'side_section']) website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
self.add_page_links() self.add_page_links()
@@ -31,24 +33,21 @@ class DocType:
def add_page_links(self): def add_page_links(self):
"""add links for next_page and see_also""" """add links for next_page and see_also"""
if self.doc.next_page: if self.doc.next_page:
self.doc.next_page_html = """<div class="info-box round"> self.doc.next_page_html = """<div class="info-box round" style="text-align: right">
<p style="text-align: right"><b>Next:</b> <b>Next:</b>
<a href="#!%(name)s">%(title)s</a></p></div>""" % {"name":self.doc.next_page, \ <a href="#!%(name)s">%(title)s</a></div>""" % {"name":self.doc.next_page, \
"title": webnotes.conn.get_value("Page", self.doc.next_page, "title")} "title": webnotes.conn.get_value("Page", self.doc.next_page, "title")}
self.doc.see_also = '' self.doc.see_also = ''
for d in self.doclist: for d in self.doclist:
if d.doctype=='Related Page': if d.doctype=='Related Page':
tmp = {"page":d.page, "title":webnotes.conn.get_value('Page', d.page, 'title')} 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 self.doc.see_also += """<div><a href="#!%(page)s">%(title)s</a></div>""" % tmp
if self.doc.see_also:
self.doc.see_also = '<ul>%s</ul>' % self.doc.see_also
def cleanup_temp(self): def cleanup_temp(self):
"""cleanup temp fields""" """cleanup temp fields"""
fl = ['main_section_html', 'side_section_html', 'see_also', \ 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: for f in fl:
if f in self.doc.fields: if f in self.doc.fields:
del self.doc.fields[f] del self.doc.fields[f]

View File

@@ -10,9 +10,9 @@ pscript.onload_blog = function(wrapper) {
render_row: function(parent, data) { render_row: function(parent, data) {
if(data.content.length==300) data.content += '...'; if(data.content.length==300) data.content += '...';
data.date = prettyDate(data.modified); data.date = prettyDate(data.modified);
parent.innerHTML = repl('<h4><a href="#!%(name)s">%(title)s</a></h4>\ parent.innerHTML = repl('<h3><a href="#!%(name)s">%(title)s</a></h3>\
<div class="help">By %(first_name)s %(last_name)s on %(date)s</div>\ <p><div class="help">By %(first_name)s %(last_name)s on %(date)s</div></p>\
<p><div class="comment">%(content)s</div></p><br>', data); <div class="comment">%(content)s</div><br>', data);
}, },
page_length: 10 page_length: 10
}); });

View File

@@ -1 +1 @@
367 382