@@ -197,7 +197,7 @@ wn.pages.todo.onload = function(wrapper) { | |||||
<div class="todo-content"></div>\ | <div class="todo-content"></div>\ | ||||
</div>'); | </div>'); | ||||
wrapper.appframe.add_breadcrumb(wn.modules["To Do"].icon); | |||||
wrapper.appframe.add_module_icon("To Do"); | |||||
wrapper.appframe.add_button('Refresh', erpnext.todo.refresh, 'icon-refresh'); | wrapper.appframe.add_button('Refresh', erpnext.todo.refresh, 'icon-refresh'); | ||||
wrapper.appframe.add_button('Add', function() { | wrapper.appframe.add_button('Add', function() { | ||||
erpnext.todo.make_dialog({ | erpnext.todo.make_dialog({ | ||||
@@ -16,7 +16,8 @@ wn.ui.AppFrame = Class.extend({ | |||||
<div class="title-button-area-1 btn-group pull-right" \ | <div class="title-button-area-1 btn-group pull-right" \ | ||||
style="margin-top: 10px;"></div>\ | style="margin-top: 10px;"></div>\ | ||||
<div class="title-area"><h2 style="display: inline-block">\ | <div class="title-area"><h2 style="display: inline-block">\ | ||||
<span class="title-icon"></span><span class="title-text"></span></h2></div>\ | |||||
<span class="title-icon" style="display: none"></span>\ | |||||
<span class="title-text"></span></h2></div>\ | |||||
<div class="sub-title-area text-muted small" \ | <div class="sub-title-area text-muted small" \ | ||||
style="margin-top: -10px;"></div>\ | style="margin-top: -10px;"></div>\ | ||||
<div class="status-bar"></div>\ | <div class="status-bar"></div>\ | ||||
@@ -69,9 +70,10 @@ wn.ui.AppFrame = Class.extend({ | |||||
add_module_icon: function(module) { | add_module_icon: function(module) { | ||||
var module_info = wn.modules[module]; | var module_info = wn.modules[module]; | ||||
if(module_info) { | |||||
if(module_info && module_info.icon) { | |||||
this.$w.find(".title-icon").html('<i class="' | this.$w.find(".title-icon").html('<i class="' | ||||
+module_info.icon+'"></i> ') | +module_info.icon+'"></i> ') | ||||
.toggle(true) | |||||
.css({ | .css({ | ||||
"background-color": module_info.color, | "background-color": module_info.color, | ||||
}) | }) | ||||
@@ -209,25 +209,20 @@ wn.ui.Listing = Class.extend({ | |||||
this.$w.find('.no-result').toggle(false); | this.$w.find('.no-result').toggle(false); | ||||
this.start = 0; | this.start = 0; | ||||
}, | }, | ||||
run: function() { | |||||
// in old - arguments: 0 = callback, 1 = append | |||||
run: function(more) { | |||||
var me = this; | 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)) | |||||
if(!more) { | |||||
this.start = 0; | this.start = 0; | ||||
if(this.onreset) this.onreset(); | |||||
} | |||||
if(!me.opts.no_loading) | if(!me.opts.no_loading) | ||||
me.set_working(true); | me.set_working(true); | ||||
wn.call({ | wn.call({ | ||||
method: this.opts.method || 'webnotes.widgets.query_builder.runquery', | method: this.opts.method || 'webnotes.widgets.query_builder.runquery', | ||||
type: "GET", | type: "GET", | ||||
args: this.get_call_args(a0), | |||||
args: this.get_call_args(), | |||||
callback: function(r) { | callback: function(r) { | ||||
if(!me.opts.no_loading) | if(!me.opts.no_loading) | ||||
me.set_working(false); | me.set_working(false); | ||||
@@ -240,7 +235,7 @@ wn.ui.Listing = Class.extend({ | |||||
set_working: function(flag) { | set_working: function(flag) { | ||||
this.$w.find('.img-load').toggle(flag); | this.$w.find('.img-load').toggle(flag); | ||||
}, | }, | ||||
get_call_args: function(opts) { | |||||
get_call_args: function() { | |||||
// load query | // load query | ||||
if(!this.method) { | if(!this.method) { | ||||
var query = this.get_query ? this.get_query() : this.query; | var query = this.get_query ? this.get_query() : this.query; | ||||
@@ -262,12 +257,12 @@ wn.ui.Listing = Class.extend({ | |||||
$.extend(args, this.args) | $.extend(args, this.args) | ||||
if(this.get_args) { | if(this.get_args) { | ||||
$.extend(args, this.get_args(opts)); | |||||
$.extend(args, this.get_args()); | |||||
} | } | ||||
return args; | return args; | ||||
}, | }, | ||||
render_results: function(r) { | render_results: function(r) { | ||||
if(this.start==0) this.clear(); | |||||
if(this.start===0) this.clear(); | |||||
this.$w.find('.btn-more').toggle(false); | this.$w.find('.btn-more').toggle(false); | ||||
@@ -280,7 +275,7 @@ wn.ui.Listing = Class.extend({ | |||||
this.render_list(r.values); | this.render_list(r.values); | ||||
this.update_paging(r.values); | this.update_paging(r.values); | ||||
} else { | } else { | ||||
if(this.start==0) { | |||||
if(this.start===0) { | |||||
this.$w.find('.result').toggle(false); | this.$w.find('.result').toggle(false); | ||||
var msg = this.get_no_result_message | var msg = this.get_no_result_message | ||||
@@ -166,7 +166,7 @@ wn.views.DocListView = wn.ui.Listing.extend({ | |||||
if((auto_run !== false) && (auto_run !== 0)) this.run(); | if((auto_run !== false) && (auto_run !== 0)) this.run(); | ||||
}, | }, | ||||
run: function() { | |||||
run: function(more) { | |||||
// set filter from route | // set filter from route | ||||
var route = wn.get_route(); | var route = wn.get_route(); | ||||
var me = this; | var me = this; | ||||
@@ -175,8 +175,7 @@ wn.views.DocListView = wn.ui.Listing.extend({ | |||||
me.set_filter(key, val, true); | me.set_filter(key, val, true); | ||||
}); | }); | ||||
} | } | ||||
this.listview && this.listview.run(); | |||||
this._super(arguments[0], arguments[1]); | |||||
this._super(more); | |||||
}, | }, | ||||
make_no_result: function() { | make_no_result: function() { | ||||
@@ -22,10 +22,11 @@ wn.views.ListView = Class.extend({ | |||||
this.set_columns(); | this.set_columns(); | ||||
if(this.settings.group_by) | if(this.settings.group_by) | ||||
this.group_by = this.settings.group_by; | this.group_by = this.settings.group_by; | ||||
}, | |||||
run: function() { | |||||
if(this.doclistview.start===0) | |||||
this.id_list = []; | |||||
var me = this; | |||||
this.doclistview.onreset = function() { | |||||
me.id_list = []; | |||||
} | |||||
}, | }, | ||||
set_fields: function() { | set_fields: function() { | ||||
var me = this; | var me = this; | ||||