Browse Source

assorted cleanup and v7.1 fixes

version-14
robert schouten 8 years ago
committed by Rushabh Mehta
parent
commit
01a4845ce7
9 changed files with 32 additions and 42 deletions
  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 View File

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


+ 1
- 1
frappe/custom/doctype/custom_field/custom_field.json View File

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


+ 1
- 1
frappe/custom/doctype/customize_form_field/customize_form_field.json View File

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


+ 5
- 5
frappe/desk/reportview.py View File

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


@frappe.whitelist() @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 cat_tags = frappe.db.sql("""select tag.parent as category, tag.tag_name as tag
from `tabTag Doc Category` as docCat from `tabTag Doc Category` as docCat
INNER JOIN tabTag as tag on tag.parent = docCat.parent INNER JOIN tabTag as tag on tag.parent = docCat.parent
where docCat.tagdoc=%s where docCat.tagdoc=%s
ORDER BY tag.parent asc,tag.idx""",doctype,as_dict=1) 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() @frappe.whitelist()
def get_stats(stats, doctype,filters=[]):
def get_stats(stats, doctype, filters=[]):
"""get tag info""" """get tag info"""
import json import json
tags = json.loads(stats) tags = json.loads(stats)
@@ -165,14 +165,14 @@ def get_stats(stats, doctype,filters=[]):


if tag=='_user_tags': if tag=='_user_tags':
stats[tag] = scrub_user_tags(tagcount) 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: else:
stats[tag] = tagcount stats[tag] = tagcount


return stats return stats


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


+ 1
- 1
frappe/desk/tags.py View File

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




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


+ 9
- 20
frappe/public/js/frappe/list/doclistview.js View File

@@ -844,27 +844,16 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
}, },
refresh_sidebar: function() { refresh_sidebar: function() {
var me = this; 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) { call_for_selected_items: function(method, args) {


+ 8
- 7
frappe/public/js/frappe/list/list_sidebar.js View File

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


+ 5
- 5
frappe/public/js/frappe/ui/filters/filters.js View File

@@ -14,7 +14,7 @@ frappe.ui.FilterList = Class.extend({
var me = this; var me = this;
$(frappe.render_template("filter_dash", {})).appendTo(this.wrapper.find('.show_filters')); $(frappe.render_template("filter_dash", {})).appendTo(this.wrapper.find('.show_filters'));
//show filter dashboard //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).closest('.show_filters').find('.dashboard-box').toggle();
$(this).prop('title',($(this).prop('title')===__("Hide Standard Filters"))?__("Show Standard Filters") : __("Hide Standard Filters")) $(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 type:field.type
}; };
var sidebar_stat = $(frappe.render_template("filter_dash_stat_head", context)) 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 //adjust width for horizontal scrolling
var width = (me.stats.length)*180+30 var width = (me.stats.length)*180+30
@@ -139,9 +139,9 @@ frappe.ui.FilterList = Class.extend({
var noduplicate = true var noduplicate = true
} }
if (label=="No Data"){ if (label=="No Data"){
me.listobj.set_filter(fieldname, '',false,noduplicate);
me.listobj.set_filter(fieldname, '', false, noduplicate);
}else{ }else{
me.listobj.set_filter(fieldname, label,false,noduplicate);
me.listobj.set_filter(fieldname, label, false, noduplicate);
} }
return false; return false;
}) })
@@ -623,7 +623,7 @@ frappe.ui.Filter = Class.extend({
title="'+__("Remove Filter")+'">\ title="'+__("Remove Filter")+'">\
<i class="icon-remove text-muted"></i>\ <i class="icon-remove text-muted"></i>\
</button></div>') </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(); this.set_filter_button_text();




+ 1
- 1
frappe/public/js/frappe/ui/listing.js View File

@@ -408,7 +408,7 @@ frappe.ui.Listing = Class.extend({
query += ' LIMIT ' + this.start + ',' + (this.page_length+1); query += ' LIMIT ' + this.start + ',' + (this.page_length+1);
return query 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); var filter = this.filter_list.get_filter(fieldname);
if(filter) { if(filter) {
var v = cstr(filter.field.get_parsed_value()); var v = cstr(filter.field.get_parsed_value());


Loading…
Cancel
Save