소스 검색

[listview] fix, [ui] show module icon if exists

version-14
Rushabh Mehta 12 년 전
부모
커밋
b98b3ab723
5개의 변경된 파일22개의 추가작업 그리고 25개의 파일을 삭제
  1. +1
    -1
      core/page/todo/todo.js
  2. +4
    -2
      public/js/wn/ui/appframe.js
  3. +10
    -15
      public/js/wn/ui/listing.js
  4. +2
    -3
      public/js/wn/views/doclistview.js
  5. +5
    -4
      public/js/wn/views/listview.js

+ 1
- 1
core/page/todo/todo.js 파일 보기

@@ -197,7 +197,7 @@ wn.pages.todo.onload = function(wrapper) {
<div class="todo-content"></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('Add', function() {
erpnext.todo.make_dialog({


+ 4
- 2
public/js/wn/ui/appframe.js 파일 보기

@@ -16,7 +16,8 @@ wn.ui.AppFrame = Class.extend({
<div class="title-button-area-1 btn-group pull-right" \
style="margin-top: 10px;"></div>\
<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" \
style="margin-top: -10px;"></div>\
<div class="status-bar"></div>\
@@ -69,9 +70,10 @@ wn.ui.AppFrame = Class.extend({
add_module_icon: function(module) {
var module_info = wn.modules[module];
if(module_info) {
if(module_info && module_info.icon) {
this.$w.find(".title-icon").html('<i class="'
+module_info.icon+'"></i> ')
.toggle(true)
.css({
"background-color": module_info.color,
})


+ 10
- 15
public/js/wn/ui/listing.js 파일 보기

@@ -209,25 +209,20 @@ wn.ui.Listing = Class.extend({
this.$w.find('.no-result').toggle(false);
this.start = 0;
},
run: function() {
// in old - arguments: 0 = callback, 1 = append
run: function(more) {
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;

if(this.onreset) this.onreset();
}
if(!me.opts.no_loading)
me.set_working(true);
wn.call({
method: this.opts.method || 'webnotes.widgets.query_builder.runquery',
type: "GET",
args: this.get_call_args(a0),
args: this.get_call_args(),
callback: function(r) {
if(!me.opts.no_loading)
me.set_working(false);
@@ -240,7 +235,7 @@ wn.ui.Listing = Class.extend({
set_working: function(flag) {
this.$w.find('.img-load').toggle(flag);
},
get_call_args: function(opts) {
get_call_args: function() {
// load query
if(!this.method) {
var query = this.get_query ? this.get_query() : this.query;
@@ -262,12 +257,12 @@ wn.ui.Listing = Class.extend({
$.extend(args, this.args)
if(this.get_args) {
$.extend(args, this.get_args(opts));
$.extend(args, this.get_args());
}
return args;
},
render_results: function(r) {
if(this.start==0) this.clear();
if(this.start===0) this.clear();
this.$w.find('.btn-more').toggle(false);

@@ -280,7 +275,7 @@ wn.ui.Listing = Class.extend({
this.render_list(r.values);
this.update_paging(r.values);
} else {
if(this.start==0) {
if(this.start===0) {
this.$w.find('.result').toggle(false);

var msg = this.get_no_result_message


+ 2
- 3
public/js/wn/views/doclistview.js 파일 보기

@@ -166,7 +166,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
if((auto_run !== false) && (auto_run !== 0)) this.run();
},
run: function() {
run: function(more) {
// set filter from route
var route = wn.get_route();
var me = this;
@@ -175,8 +175,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
me.set_filter(key, val, true);
});
}
this.listview && this.listview.run();
this._super(arguments[0], arguments[1]);
this._super(more);
},
make_no_result: function() {


+ 5
- 4
public/js/wn/views/listview.js 파일 보기

@@ -22,10 +22,11 @@ wn.views.ListView = Class.extend({
this.set_columns();
if(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() {
var me = this;


불러오는 중...
취소
저장