ソースを参照

Fixed merge conflict

version-14
Nabin Hait 9年前
コミット
50d96413f9
3個のファイルの変更23行の追加16行の削除
  1. +10
    -11
      frappe/model/db_query.py
  2. +1
    -1
      frappe/public/js/frappe/ui/listing.html
  3. +12
    -4
      frappe/public/js/frappe/ui/listing.js

+ 10
- 11
frappe/model/db_query.py ファイルの表示

@@ -11,7 +11,7 @@ import frappe.permissions
from frappe.utils import flt, cint, getdate, get_datetime, get_time, make_filter_tuple, get_filter
from frappe import _
from frappe.model import optional_fields
from frappe.model.utils.list_settings import update_list_settings
from frappe.model.utils.list_settings import get_list_settings, update_list_settings

class DatabaseQuery(object):
def __init__(self, doctype):
@@ -488,14 +488,13 @@ class DatabaseQuery(object):

def update_list_settings(self):
# update list settings if new search
if not cint(self.limit_start) or cint(self.limit_page_length) != 20:
list_settings = {
'filters': self.filters,
'limit': self.limit_page_length,
'order_by': self.order_by
}
if self.save_list_settings_fields:
list_settings['fields'] = self.fields

update_list_settings(self.doctype, list_settings)
list_settings = json.loads(get_list_settings(self.doctype) or '{}')
list_settings['filters'] = self.filters
list_settings['limit'] = self.limit_page_length
list_settings['order_by'] = self.order_by

if self.save_list_settings_fields:
list_settings['fields'] = self.fields

update_list_settings(self.doctype, list_settings)


+ 1
- 1
frappe/public/js/frappe/ui/listing.html ファイルの表示

@@ -24,7 +24,7 @@
</div>
<div class="result-list"></div>
</div>
<div class="list-paging-area" style="display: none;">
<div class="list-paging-area">
<div class="row">
<div class="col-xs-6">
<button class="btn btn-default btn-more btn-sm">{%= _more %}...</button>


+ 12
- 4
frappe/public/js/frappe/ui/listing.js ファイルの表示

@@ -92,16 +92,24 @@ frappe.ui.Listing = Class.extend({

// next page
this.$w.find('.btn-more').click(function() {
me.run({append: true });
me.run(true);
});

this.$w.find(".btn-group-paging .btn").click(function() {
me.page_length = cint($(this).attr("data-value"));
me.$w.find(".btn-group-paging .btn-info").removeClass("btn-info");
$(this).addClass("btn-info");
me.run({append: true});

// always reset when changing list page length
me.run();
});

// select the correct page length
if(this.opts.page_length != 20) {
this.$w.find(".btn-group-paging .btn-info").removeClass("btn-info");
this.$w.find(".btn-group-paging .btn[data-value='"+ this.opts.page_length +"']").addClass('btn-info');
}

// title
if(this.title) {
this.$w.find('h3').html(this.title).toggle(true);
@@ -297,7 +305,7 @@ frappe.ui.Listing = Class.extend({
render_results: function(r) {
if(this.start===0) this.clear();

this.$w.find('.list-paging-area, .list-loading').toggle(false);
this.$w.find('.btn-more, .list-loading').toggle(false);

if(r.message) {
r.values = this.get_values_from_response(r.message);
@@ -394,7 +402,7 @@ frappe.ui.Listing = Class.extend({
},
update_paging: function(values) {
if(values.length >= this.page_length) {
this.$w.find('.list-paging-area').toggle(true);
this.$w.find('.btn-more').toggle(true);
this.start += this.page_length;
}
},


読み込み中…
キャンセル
保存