fixes to listview

This commit is contained in:
Rushabh Mehta 2012-05-09 16:15:51 +05:30
parent 81dba76699
commit 078867c411
17 changed files with 38 additions and 48 deletions

View File

@ -21,7 +21,7 @@ wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({
{width: '3%', content:'docstatus'},
{width: '12%', content:'name'},
{width: '15%', content:'voucher_type'},
{width: '38%', content:'tags+remark', css: {'color':'#aaa'}},
{width: '38%', content:'tags+remark', css: {'color':'#222'}},
{
width: '18%',
content: function(parent, data) {

View File

@ -23,7 +23,7 @@ wn.doclistviews['Purchase Invoice'] = wn.views.ListView.extend({
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '15%', content: 'name'},
{width: '37%', content: 'tags+supplier_name', css: {color: '#aaa'}},
{width: '37%', content: 'tags+supplier_name', css: {color: '#222'}},
{
width: '18%',
content: function(parent, data) {

View File

@ -18,7 +18,7 @@ wn.doclistviews['Sales Invoice'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '37%', content:'tags+customer_name', css: {color:'#aaa'}},
{width: '37%', content:'tags+customer_name', css: {color:'#222'}},
{
width: '18%',
content: function(parent, data) {

View File

@ -16,7 +16,7 @@ wn.doclistviews['Purchase Order'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '35%', content:'tags+supplier_name', css: {color:'#aaa'}},
{width: '35%', content:'tags+supplier_name', css: {color:'#222'}},
{
width: '18%',
content: function(parent, data) {

View File

@ -25,7 +25,7 @@ wn.doclistviews['Purchase Request'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '17%', content:'name'},
{width: '53%', content:'status_html+tags+remark', css: {'color': '#aaa'}},
{width: '53%', content:'status_html+tags+remark', css: {'color': '#222'}},
{width: '10%', content: 'per_ordered', type:'bar-graph', label:'Ordered'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]

View File

@ -26,7 +26,7 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
columns: [
{width: '20%', content:'name'},
{width: '12%', content:'status_html'},
{width: '55%', content:'tags+lead_name', css: {color:'#aaa'}},
{width: '55%', content:'tags+lead_name', css: {color:'#222'}},
{width: '13%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
})

View File

@ -31,7 +31,7 @@ wn.doclistviews['Opportunity'] = wn.views.ListView.extend({
columns: [
{width: '15%', content:'name'},
{width: '18%', content:'status_html'},
{width: '55%', content:'tags+enquiry_name', css: {color:'#aaa'}},
{width: '55%', content:'tags+enquiry_name', css: {color:'#222'}},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
})

View File

@ -25,7 +25,7 @@ wn.doclistviews['Quotation'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '47%', content:'tags+quotation_name', css: {color:'#aaa'}},
{width: '47%', content:'tags+quotation_name', css: {color:'#222'}},
{
width: '18%',
content: function(parent, data) {

View File

@ -16,7 +16,7 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '35%', content:'tags+customer_name', css: {color:'#aaa'}},
{width: '35%', content:'tags+customer_name', css: {color:'#222'}},
{
width: '18%',
content: function(parent, data) {

View File

@ -11,7 +11,7 @@ wn.doclistviews['Delivery Note'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '50%', content:'tags+customer_name', css: {color:'#aaa'}},
{width: '50%', content:'tags+customer_name', css: {color:'#222'}},
{width: '15%', content:'sales_order_no', type:'link', doctype:'Sales Order'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]

View File

@ -17,7 +17,7 @@ wn.doclistviews['Item'] = wn.views.ListView.extend({
columns: [
{width: '5%', content:'avatar'},
{width: '20%', content:'name'},
{width: '63%', content:'tags+description', css: {'color': '#aaa'}},
{width: '63%', content:'tags+description', css: {'color': '#222'}},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -11,7 +11,7 @@ wn.doclistviews['Purchase Receipt'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '50%', content:'tags+supplier_name', css: {color:'#aaa'}},
{width: '50%', content:'tags+supplier_name', css: {color:'#222'}},
{width: '15%', content:'purchase_order_no', type:'link', doctype:'Purchase Order Order'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]

View File

@ -12,7 +12,7 @@ wn.doclistviews['Stock Entry'] = wn.views.ListView.extend({
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '18%', content:'tags+purpose', css: {color:'#aaa'}},
{width: '18%', content:'tags+purpose', css: {color:'#222'}},
{width: '18%', content:'from_warehouse', template: 'From %(from_warehouse)s'},
{width: '18%', content:'to_warehouse', template: 'To %(to_warehouse)s'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}

View File

@ -47,7 +47,7 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
{width: '3%', content:'check'},
{width: '20%', content:'name'},
{width: '10%', content:'status_html'},
{width: '53%', content:'tags+description', css: {color:'#aaa'}},
{width: '53%', content:'tags+description', css: {color:'#222'}},
{width: '14%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]

View File

@ -3575,7 +3575,7 @@ div.psidebar div.section-item, div.psidebar .section-link {
/* list-row */
div.list-row {
border-bottom: 1px solid #eee;
border-bottom: 1px solid #ddd;
padding: 5px 0px;
}
@ -3663,15 +3663,11 @@ span.bar-empty {
/* stats */
div.stat-wrapper {
margin-bottom: 19px;
margin-bottom: 19px;
}
div.stat-grid {
border: 2px solid #bbb;
background-color: white;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
margin-top: 9px;
overflow: hidden;
}
@ -3686,24 +3682,23 @@ div.stat-label, div.stat-label a {
div.stat-item {
position: relative;
border-bottom: 1px solid #ddd;
}
div.stat-item:last-child {
border-bottom: 0px solid #ddd;
margin-bottom: 7px;
background-color: #fff;
height: 22px;
border: 2px solid #aaa;
border-radius: 11px;
overflow: hidden;
}
div.stat-bar {
position: absolute;
left: 0px;
background-color: #def;
background-color: #DEF9A7;
border-radius: 11px 0px 0px 11px;
height: 100%;
z-index: 0;
}
/*
* lib/css/ui/views.css
*/

View File

@ -2327,7 +2327,7 @@ div.dialog_row table td textarea {
/* list-row */
div.list-row {
border-bottom: 1px solid #eee;
border-bottom: 1px solid #ddd;
padding: 5px 0px;
}
@ -2415,15 +2415,11 @@ span.bar-empty {
/* stats */
div.stat-wrapper {
margin-bottom: 19px;
margin-bottom: 19px;
}
div.stat-grid {
border: 2px solid #bbb;
background-color: white;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
margin-top: 9px;
overflow: hidden;
}
@ -2438,24 +2434,23 @@ div.stat-label, div.stat-label a {
div.stat-item {
position: relative;
border-bottom: 1px solid #ddd;
}
div.stat-item:last-child {
border-bottom: 0px solid #ddd;
margin-bottom: 7px;
background-color: #fff;
height: 22px;
border: 2px solid #aaa;
border-radius: 11px;
overflow: hidden;
}
div.stat-bar {
position: absolute;
left: 0px;
background-color: #def;
background-color: #DEF9A7;
border-radius: 11px 0px 0px 11px;
height: 100%;
z-index: 0;
}
/*
* lib/css/ui/views.css
*/

View File

@ -991,7 +991,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i
%(label)s</a> \
(%(count)s)</div>\
</div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#222'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
if(typeof opts.content=='function'){opts.content(parent,data);}
else if(opts.content=='name'){$(parent).append(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
@ -1011,7 +1011,7 @@ $(parent).append(repl('<span class="bar-outer" style="width: 30px; float: right"
else if(opts.type=='link'&&opts.doctype){$(parent).append(repl('<a href="#!Form/'+opts.doctype+'/'
+data[opts.content]+'">'+data[opts.content]+'</a>',data));}
else if(opts.template){$(parent).append(repl(opts.template,data));}
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];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when='Today'}
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];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when=dateutil.comment_when(data.modified);}
if(diff==1){data.when='Yesterday'}
if(diff==2){data.when='2 days ago'}
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';}