fixes in communication doctype
This commit is contained in:
parent
a8ce3129b9
commit
4872c65beb
3 changed files with 9 additions and 8 deletions
6
js/core.min.js
vendored
6
js/core.min.js
vendored
|
|
@ -183,9 +183,9 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
|
|||
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
||||
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype);},'icon-plus');}
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){me.make_new_doc(me.new_doctype);},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_new_doc:function(new_doctype){new_doc(new_doctype);},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
this.onrun=a0;if(a0&&a0.callback)
|
||||
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
|
|
@ -199,7 +199,7 @@ if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:funct
|
|||
* lib/js/wn/ui/filters.js
|
||||
*/
|
||||
wn.ui.FilterList=Class.extend({init:function(opts){wn.require('js/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});this.$w.find('.search-btn').bind('click',function(){me.listobj.run();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length)
|
||||
this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').toggle(true);}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
|
||||
this.add_filter();},add_filter:function(fieldname,condition,value){this.push_new_filter(fieldname,condition,value);if(fieldname){this.$w.find('.show_filters').toggle(true);}},push_new_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
|
||||
values.push(f.get_value());})
|
||||
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
|
||||
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
|
||||
|
|
|
|||
|
|
@ -172,10 +172,8 @@ wn.ui.Listing = Class.extend({
|
|||
|
||||
// new
|
||||
if(this.new_doctype) {
|
||||
this.add_button('New ' + this.new_doctype, function() {
|
||||
me.new_doc_constructor
|
||||
? me.new_doc_constructor(me.new_doctype)
|
||||
: newdoc(me.new_doctype);
|
||||
this.add_button('New ' + this.new_doctype, function() {
|
||||
me.make_new_doc(me.new_doctype);
|
||||
}, 'icon-plus');
|
||||
}
|
||||
|
||||
|
|
@ -190,6 +188,10 @@ wn.ui.Listing = Class.extend({
|
|||
me.$w.find('.list-toolbar-wrapper').toggle(false);
|
||||
}
|
||||
},
|
||||
|
||||
make_new_doc: function(new_doctype) {
|
||||
new_doc(new_doctype);
|
||||
},
|
||||
|
||||
make_filters: function() {
|
||||
this.filter_list = new wn.ui.FilterList({
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
show_filters: true,
|
||||
show_grid: true,
|
||||
new_doctype: this.doctype,
|
||||
new_doc_constructor: this.new_doc_constructor || null,
|
||||
allow_delete: this.allow_delete,
|
||||
no_result_message: this.make_no_result(),
|
||||
columns: this.listview.fields
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue