diff --git a/frappe/core/doctype/docfield/docfield.json b/frappe/core/doctype/docfield/docfield.json index 60af0742eb..6f8d8a3aad 100644 --- a/frappe/core/doctype/docfield/docfield.json +++ b/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", diff --git a/frappe/custom/doctype/custom_field/custom_field.json b/frappe/custom/doctype/custom_field/custom_field.json index a4bbf51f7b..1d8b112104 100644 --- a/frappe/custom/doctype/custom_field/custom_field.json +++ b/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", diff --git a/frappe/custom/doctype/customize_form_field/customize_form_field.json b/frappe/custom/doctype/customize_form_field/customize_form_field.json index 0a43f28e88..b5e04565f5 100644 --- a/frappe/custom/doctype/customize_form_field/customize_form_field.json +++ b/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", diff --git a/frappe/desk/reportview.py b/frappe/desk/reportview.py index 0112dfd2fc..e5d7f1d2e2 100644 --- a/frappe/desk/reportview.py +++ b/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) diff --git a/frappe/desk/tags.py b/frappe/desk/tags.py index 89451946de..b26cef82be 100644 --- a/frappe/desk/tags.py +++ b/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` diff --git a/frappe/public/js/frappe/list/doclistview.js b/frappe/public/js/frappe/list/doclistview.js index 832baf55c2..4872d3e61f 100644 --- a/frappe/public/js/frappe/list/doclistview.js +++ b/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) { diff --git a/frappe/public/js/frappe/list/list_sidebar.js b/frappe/public/js/frappe/list/list_sidebar.js index 774da675bf..b6352dcebf 100644 --- a/frappe/public/js/frappe/list/list_sidebar.js +++ b/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 = [] diff --git a/frappe/public/js/frappe/ui/filters/filters.js b/frappe/public/js/frappe/ui/filters/filters.js index 7f3c3bc8ef..583992def1 100644 --- a/frappe/public/js/frappe/ui/filters/filters.js +++ b/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")+'">\ \ ') - .insertAfter(this.flist.wrapper.find(".set-filters .new-filter")); + .insertAfter(this.flist.wrapper.find(".set-filters .clear-filter")); this.set_filter_button_text(); diff --git a/frappe/public/js/frappe/ui/listing.js b/frappe/public/js/frappe/ui/listing.js index 3199922c9a..db7a236422 100644 --- a/frappe/public/js/frappe/ui/listing.js +++ b/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());