浏览代码

assorted cleanup and v7.1 fixes

version-14
robert schouten 8 年前
committed by Rushabh Mehta
父节点
当前提交
01a4845ce7
共有 9 个文件被更改,包括 32 次插入42 次删除
  1. +1
    -1
      frappe/core/doctype/docfield/docfield.json
  2. +1
    -1
      frappe/custom/doctype/custom_field/custom_field.json
  3. +1
    -1
      frappe/custom/doctype/customize_form_field/customize_form_field.json
  4. +5
    -5
      frappe/desk/reportview.py
  5. +1
    -1
      frappe/desk/tags.py
  6. +9
    -20
      frappe/public/js/frappe/list/doclistview.js
  7. +8
    -7
      frappe/public/js/frappe/list/list_sidebar.js
  8. +5
    -5
      frappe/public/js/frappe/ui/filters/filters.js
  9. +1
    -1
      frappe/public/js/frappe/ui/listing.js

+ 1
- 1
frappe/core/doctype/docfield/docfield.json 查看文件

@@ -1146,7 +1146,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-08-23 11:59:07.036627",
"modified": "2016-10-18 11:59:07.036627",
"modified_by": "Administrator",
"module": "Core",
"name": "DocField",


+ 1
- 1
frappe/custom/doctype/custom_field/custom_field.json 查看文件

@@ -956,7 +956,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-07-06 05:34:23.557083",
"modified": "2016-10-18 05:34:23.557083",
"modified_by": "Administrator",
"module": "Custom",
"name": "Custom Field",


+ 1
- 1
frappe/custom/doctype/customize_form_field/customize_form_field.json 查看文件

@@ -974,7 +974,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-08-23 12:03:07.126339",
"modified": "2016-10-18 12:03:07.126339",
"modified_by": "Administrator",
"module": "Custom",
"name": "Customize Form Field",


+ 5
- 5
frappe/desk/reportview.py 查看文件

@@ -138,17 +138,17 @@ def delete_items():
frappe.delete_doc(doctype, d)

@frappe.whitelist()
def get_tag_catagories(doctype):
def get_sidebar_stats(stats, doctype, filters=[]):
cat_tags = frappe.db.sql("""select tag.parent as category, tag.tag_name as tag
from `tabTag Doc Category` as docCat
INNER JOIN tabTag as tag on tag.parent = docCat.parent
where docCat.tagdoc=%s
ORDER BY tag.parent asc,tag.idx""",doctype,as_dict=1)

return cat_tags
return {"defined_cat":cat_tags, "stats":get_stats(stats, doctype, filters)}

@frappe.whitelist()
def get_stats(stats, doctype,filters=[]):
def get_stats(stats, doctype, filters=[]):
"""get tag info"""
import json
tags = json.loads(stats)
@@ -165,14 +165,14 @@ def get_stats(stats, doctype,filters=[]):

if tag=='_user_tags':
stats[tag] = scrub_user_tags(tagcount)
stats[tag].append(["No Tags",execute(doctype, fields=[tag, "count(*)"], filters=filters +["({0} = ',' or {0} is null)".format(tag)], as_list=True)[0][1]])
stats[tag].append(["No Tags",execute(doctype, fields=[tag, "count(*)"], filters=filters +["({0} = ',' or {0} is null)".format(tag)], as_list=True)[0][1]])
else:
stats[tag] = tagcount

return stats

@frappe.whitelist()
def get_dash(stats, doctype,filters=[]):
def get_dash(stats, doctype, filters=[]):
"""get tag info"""
import json
tags = json.loads(stats)


+ 1
- 1
frappe/desk/tags.py 查看文件

@@ -49,7 +49,7 @@ def remove_tag(tag, dt, dn):


@frappe.whitelist()
def get_tags(doctype, txt,cat_tags):
def get_tags(doctype, txt, cat_tags):
tags = json.loads(cat_tags)
try:
for _user_tags in frappe.db.sql_list("""select DISTINCT `_user_tags`


+ 9
- 20
frappe/public/js/frappe/list/doclistview.js 查看文件

@@ -844,27 +844,16 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
},
refresh_sidebar: function() {
var me = this;
frappe.call({
method: 'frappe.desk.reportview.get_tag_catagories',
args: {
doctype: me.doctype,
me.list_sidebar = new frappe.views.ListSidebar({
doctype: me.doctype,
stats: me.listview.stats,
parent: me.$page.find('.layout-side-section'),
set_filter: function(fieldname, label, norun, noduplicates) {
me.set_filter(fieldname, label, norun, noduplicates);
},
callback: function(r) {
me.defined_category = r.message;

me.list_sidebar = new frappe.views.ListSidebar({
doctype: me.doctype,
stats: me.listview.stats,
defined_category : me.defined_category,
parent: me.$page.find('.layout-side-section'),
set_filter: function(fieldname, label,norun,noduplicates) {
me.set_filter(fieldname, label,norun,noduplicates);
},
default_filters:me.listview.settings.default_filters,
page: me.page,
doclistview: me
})
}
default_filters:me.listview.settings.default_filters,
page: me.page,
doclistview: me
})
},
call_for_selected_items: function(method, args) {


+ 8
- 7
frappe/public/js/frappe/list/list_sidebar.js 查看文件

@@ -110,16 +110,17 @@ frappe.views.ListSidebar = Class.extend({
},
get_stats: function() {
var me = this
return frappe.call({
type: "GET",
method: 'frappe.desk.reportview.get_stats',
frappe.call({
method: 'frappe.desk.reportview.get_sidebar_stats',
args: {
stats: me.stats,
doctype: me.doctype,
filters:me.default_filters
},
callback: function(r) {
if (me.defined_category ){
me.defined_category = r.message;
if (r.message.defined_cat ){
me.defined_category = r.message.defined_cat
me.cats = {};
//structure the tag categories
for (i in me.defined_category){
@@ -130,7 +131,7 @@ frappe.views.ListSidebar = Class.extend({
}
me.cat_tags[i]=me.defined_category[i].tag
}
me.tempstats = r.message;
me.tempstats =r.message.stats
var len = me.cats.length;
$.each(me.cats, function (i, v) {
me.render_stat(i, (me.tempstats || {})["_user_tags"],v);
@@ -140,13 +141,13 @@ frappe.views.ListSidebar = Class.extend({
else
{
//render normal stats
me.render_stat("_user_tags", (r.message|| {})["_user_tags"]);
me.render_stat("_user_tags", (r.message.stats|| {})["_user_tags"]);
}
me.doclistview.set_sidebar_height();
}
});
},
render_stat: function(field, stat,tags) {
render_stat: function(field, stat, tags) {
var me = this;
var sum = 0;
var stats = []


+ 5
- 5
frappe/public/js/frappe/ui/filters/filters.js 查看文件

@@ -14,7 +14,7 @@ frappe.ui.FilterList = Class.extend({
var me = this;
$(frappe.render_template("filter_dash", {})).appendTo(this.wrapper.find('.show_filters'));
//show filter dashboard
this.$w.find('.show-filter-dashboard').click(function() {
this.wrapper.find('.show-filter-dashboard').click(function() {
$(this).closest('.show_filters').find('.dashboard-box').toggle();
$(this).prop('title',($(this).prop('title')===__("Hide Standard Filters"))?__("Show Standard Filters") : __("Hide Standard Filters"))
});
@@ -45,7 +45,7 @@ frappe.ui.FilterList = Class.extend({
type:field.type
};
var sidebar_stat = $(frappe.render_template("filter_dash_stat_head", context))
.appendTo(this.$w.find(".filter-dashboard-items"));
.appendTo(this.wrapper.find(".filter-dashboard-items"));

//adjust width for horizontal scrolling
var width = (me.stats.length)*180+30
@@ -139,9 +139,9 @@ frappe.ui.FilterList = Class.extend({
var noduplicate = true
}
if (label=="No Data"){
me.listobj.set_filter(fieldname, '',false,noduplicate);
me.listobj.set_filter(fieldname, '', false, noduplicate);
}else{
me.listobj.set_filter(fieldname, label,false,noduplicate);
me.listobj.set_filter(fieldname, label, false, noduplicate);
}
return false;
})
@@ -623,7 +623,7 @@ frappe.ui.Filter = Class.extend({
title="'+__("Remove Filter")+'">\
<i class="icon-remove text-muted"></i>\
</button></div>')
.insertAfter(this.flist.wrapper.find(".set-filters .new-filter"));
.insertAfter(this.flist.wrapper.find(".set-filters .clear-filter"));

this.set_filter_button_text();



+ 1
- 1
frappe/public/js/frappe/ui/listing.js 查看文件

@@ -408,7 +408,7 @@ frappe.ui.Listing = Class.extend({
query += ' LIMIT ' + this.start + ',' + (this.page_length+1);
return query
},
set_filter: function(fieldname, label, no_run,no_duplicate) {
set_filter: function(fieldname, label, no_run, no_duplicate) {
var filter = this.filter_list.get_filter(fieldname);
if(filter) {
var v = cstr(filter.field.get_parsed_value());


正在加载...
取消
保存