stylefixes and listviews

This commit is contained in:
Rushabh Mehta 2012-03-21 11:48:06 +05:30
parent 412588d193
commit e6647f2eca
13 changed files with 54 additions and 58 deletions

View file

@ -25,7 +25,7 @@ select, input, textarea {
border: 1px solid #ccc;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
font-size: 13px;
font-size: inherit;
padding: 4px;
color: #444;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
@ -37,7 +37,7 @@ textarea {
font-family: inherit;
height: 120px;
width: 90%;
font-size: 12px;
font-size: inherit;
white-space: normal;
}
@ -100,6 +100,15 @@ div.fix_ff_cursor { overflow: auto; }
div.comment { color: #444; }
.small {
font-size: 11px;
}
.help {
margin: 3px 0px;
color: #888;
}
div#body_div {
position: relative;
display: none;
@ -181,7 +190,6 @@ div.loading_div {
display: none;
text-align: center;
padding: 2px;
font-size: 12px;
border: 1px solid #FF4;
}

View file

@ -152,7 +152,6 @@ div.cal_event {
width: 100%;
height: 12px;
overflow: hidden;
font-size: 11px;
color: #00B;
margin-bottom: 2px;
text-decoration: underline;

View file

@ -46,24 +46,6 @@ div.grid_tbarlinks {
}
div.frm_tip_box {
margin: 0px;
padding: 8px;
background-color: #FFC;
display: none;
font-size: 11px;
border: 1px solid #FFB;
}
div.frm_tip_box table {
border-collapse: collapse;
vertical-align: top;
}
td.frm_tray_area {
width: 122px;
}
div.dialog_frm {
position: relative;
margin: 10px;
@ -160,12 +142,6 @@ div.time_field select{
.datainputcell { padding: 2px 0px; }
.field_description, .help {
margin: 3px 0px;
font-size: 11px;
color: #888;
}
.help ol {
padding-left: 19px;
}
@ -174,9 +150,6 @@ div.time_field select{
margin-bottom: 3px;
}
.field_label {
font-size:11px;
}
.input_area input, select, textarea {
font-size: 14px;
padding: 2px;
@ -227,7 +200,6 @@ div.sidebar-comment-wrapper input {
}
div.sidebar-comment-message {
margin-top: 8px;
font-size: 11px;
color: #777;
}
@ -238,6 +210,5 @@ div.sidebar-comment-text {
color: #444;
}
div.sidebar-comment-info {
font-size: 10px;
color: #777;
}

View file

@ -15,7 +15,7 @@ div.psidebar div.section {
div.psidebar div.section-head {
padding: 5px 11px;
border-bottom: 2px solid #777;
border-bottom: 1px solid #aaa;
}
div.psidebar div.section-body {
@ -27,6 +27,5 @@ div.psidebar div.section-item {
}
div.psidebar div.section-item, div.psidebar .section-link {
font-size: 11px;
color: #666;
}

View file

@ -1,7 +1,7 @@
@font-face {
font-family: 'Pontano Sans';
font-style: normal;
font-weight: 400;
font-weight: 800;
src: url('../lib/css/fonts/pontanosans.woff') format('woff');
}

14
js/core.min.js vendored
View file

@ -228,11 +228,11 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
</div>',{label:this.label}));},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,columns:this.listview.fields});this.run();},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('<a class="btn btn-small btn-delete">\
<i class="icon-remove"></i> Delete</a>',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-check :checked'),function(e){return $(e).data('name');});if(!dl.length)
<i class="icon-remove"></i> Delete</a>',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(r.message,function(field,stat){me.render_stat(field,stat);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
<div class="help"><i>No records tagged.</i><br><br> \
<div class="help small"><i>No records tagged.</i><br><br> \
To add a tag, open the document and click on \
"Add Tag" on the sidebar</div></div>');}
return;}
@ -255,12 +255,18 @@ if(typeof opts.content=='function'){opts.content(parent,data);}
else if(opts.content=='name'){$(parent).html(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
else if(opts.content=='avatar'){$(parent).html(repl('<span class="avatar-small"><img src="%(avatar)s" \
title="%(fullname)s"/></span>',data));}
else if(opts.content=='check'){$(parent).html('<input type="checkbox">');$(parent).find('input').data('name',data.name);}
else if(opts.content=='check'){$(parent).html('<input class="list-delete" type="checkbox">');$(parent).find('input').data('name',data.name);}
else if(opts.content=='docstatus'){$(parent).html(repl('<span class="docstatus"><i class="%(docstatus_icon)s" \
title="%(docstatus_title)s"></i></span>',data));}
else if(opts.content=='tags'){this.add_user_tags(parent,data);}
else if(opts.content=='modified'){$(parent).append(data.when);}
else if(data[opts.content]){$(parent).append(data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
else if(opts.type=='bar-graph'){args={percent:data[opts.content],fully_delivered:(data[opts.content]>99?'bar-complete':''),label:opts.label}
$(parent).html(repl('<span class="bar-outer" style="width: 30px; float: right" \
title="%(percent)s% %(label)s">\
<span class="bar-inner %(fully_delivered)s" \
style="width: %(percent)s%;"></span>\
</span>',args));}
else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}})
/*
* lib/js/wn/views/pageview.js

View file

@ -56,7 +56,7 @@ Field.prototype.make_body = function() {
// label
if(this.with_label) {
this.label_span = $a(this.label_area, 'span', 'field_label')
this.label_span = $a(this.label_area, 'span', 'small')
// error icon
this.label_icon = $a(this.label_area,'img','',{margin:'-3px 4px -3px 4px'}); $dh(this.label_icon);
@ -115,11 +115,11 @@ Field.prototype.set_description = function() {
if(this.df.description) {
// parent
var p = in_list(['Text Editor', 'Code', 'Check'], this.df.fieldtype) ? this.label_area : this.wrapper;
this.desc_area = $a(p, 'div', 'help', '', this.df.description)
this.desc_area = $a(p, 'div', 'help small', '', this.df.description)
// padding on the bottom
if(in_list(['Text Editor', 'Code'], this.df.fieldtype))
$(this.desc_area).addClass('field_description_top');
$(this.desc_area).addClass('help small');
}
}
@ -936,7 +936,7 @@ function make_text_dialog() {
this.widgets['Enter Text'].focus();
this.widgets['Description'].innerHTML = ''
if(this.field.df.description)
$a(this.widgets['Description'], 'div', 'field_description', '', this.field.df.description);
$a(this.widgets['Description'], 'div', 'help small', '', this.field.df.description);
}
d.onhide = function() {
if(_f.cur_grid_cell)

View file

@ -84,7 +84,7 @@ _f.SectionBreak.prototype.make_body = function() {
this.df.description = '';
$(this.row.main_head).html(repl('<div class="form-section-head" style="cursor: pointer">\
<div class="head">%(label)s</h3>\
<div class="help">%(description)s</div>\
<div class="help small">%(description)s</div>\
</div>', this.df));
this.$expand = $(this.row.main_head).find('.head').click(function() {
@ -246,7 +246,7 @@ _f.TableField.prototype.make_body = function() {
if(this.perm[this.df.permlevel] && this.perm[this.df.permlevel][READ]) {
// add comment area
if(this.df.description) {
this.desc_area = $a(this.parent, 'div', 'field_description', '', this.df.description)
this.desc_area = $a(this.parent, 'div', 'help small', '', this.df.description)
}
this.grid = new _f.FormGrid(this);
if(this.frm)this.frm.grids[this.frm.grids.length] = this;

View file

@ -115,7 +115,7 @@ wn.widgets.form.sidebar.Attachment = function(parent, filedet, frm) {
var display_name = this.fileid;
if(this.fileid.substr(0,8)=='FileData')
display_name = this.filename;
this.ln = $a(this.wrapper, 'a', 'link_type', {fontSize:'11px'}, display_name);
this.ln = $a(this.wrapper, 'a', 'link_type small', {}, display_name);
this.ln.href = 'files/'+this.fileid;
this.ln.target = '_blank';

View file

@ -45,12 +45,13 @@ wn.widgets.form.sidebar.Comments = function(parent, sidebar, doctype, docname) {
this.render_comments = function() {
var f = wn.widgets.form.comments;
var cl = f.comment_list[me.docname]
this.msg = $a(this.wrapper, 'div', 'sidebar-comment-message');
this.msg = $a(this.wrapper, 'div', 'help small');
if(cl) {
this.msg.innerHTML = cl.length + ' out of ' + f.n_comments[me.docname] + ' comments';
if(f.n_comments[me.docname] > cl.length) {
this.msg.innerHTML += ' <span class="link_type" onclick="cur_frm.show_comments()">Show all</span>'
this.msg.innerHTML += ' <span class="link_type" \
onclick="cur_frm.show_comments()">Show all</span>'
}
for(var i=0; i< cl.length; i++) {
this.render_one_comment(cl[i]);

View file

@ -147,10 +147,10 @@ wn.widgets.form.sidebar = { Sidebar: function(form) {
$(wrapper).html(repl('<p>Created:<br> <span class="avatar-small">\
<img title="%(created_by)s" src="%(avatar_created)s" /></span> \
<span class="help">%(creation)s</span></p>\
<span class="help small">%(creation)s</span></p>\
<p>Modified:<br> <span class="avatar-small">\
<img title="%(modified_by)s" src="%(avatar_modified)s" /></span> \
<span class="help">%(modified)s</span></p>', {
<span class="help small">%(modified)s</span></p>', {
created_by: wn.user_info(doc.owner).fullname,
avatar_created: wn.user_info(doc.owner).image,
creation: scrub_date(doc.creation),
@ -170,7 +170,7 @@ wn.widgets.form.sidebar = { Sidebar: function(form) {
wn.md2html = new Showdown.converter();
}
$a(wrapper, 'div', 'help', {},
$a(wrapper, 'div', 'help small', {},
wn.md2html.makeHtml(me.form.meta.description));
},
display: function() { return me.form.meta.description }

View file

@ -82,7 +82,7 @@ wn.widgets.PageSidebarSection = function(sidebar, opts) {
var item = this.opts.items[i];
if((item.display && item.display()) || !item.display) {
var div = $a(this.body, 'div', 'section-item');
var div = $a(this.body, 'div', 'section-item small');
this.make_one_item(item, div);
}
@ -131,7 +131,7 @@ wn.widgets.PageSidebarLink = function(section, opts, wrapper) {
if(opts.icon) {
section.add_icon(this.wrapper, opts.icon);
}
this.ln = $a(this.wrapper, 'span', 'link_type section-link', opts.style, opts.label);
this.ln = $a(this.wrapper, 'span', 'link_type section-link small', opts.style, opts.label);
this.ln.onclick = function() { me.opts.onclick(me) };
}

View file

@ -147,7 +147,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
},
delete_items: function() {
var me = this;
var dl = $.map(me.$page.find('.list-check :checked'), function(e) {
var dl = $.map(me.$page.find('.list-delete:checked'), function(e) {
return $(e).data('name');
});
if(!dl.length)
@ -191,7 +191,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
if(field=='_user_tags') {
this.$page.find('.layout-side-section')
.append('<div class="stat-wrapper"><h4>Tags</h4>\
<div class="help"><i>No records tagged.</i><br><br> \
<div class="help small"><i>No records tagged.</i><br><br> \
To add a tag, open the document and click on \
"Add Tag" on the sidebar</div></div>');
}
@ -329,7 +329,7 @@ wn.views.ListView = Class.extend({
data));
}
else if(opts.content=='check') {
$(parent).html('<input type="checkbox">');
$(parent).html('<input class="list-delete" type="checkbox">');
$(parent).find('input').data('name', data.name);
}
else if(opts.content=='docstatus') {
@ -342,8 +342,20 @@ wn.views.ListView = Class.extend({
else if(opts.content=='modified') {
$(parent).append(data.when);
}
else if(opts.type=='bar-graph') {
args = {
percent: data[opts.content],
fully_delivered: (data[opts.content] > 99 ? 'bar-complete' : ''),
label: opts.label
}
$(parent).html(repl('<span class="bar-outer" style="width: 30px; float: right" \
title="%(percent)s% %(label)s">\
<span class="bar-inner %(fully_delivered)s" \
style="width: %(percent)s%;"></span>\
</span>', args));
}
else if(data[opts.content]) {
$(parent).append(data[opts.content]);
$(parent).append(' ' + data[opts.content]);
}
},