fix: list filters for tags

This commit is contained in:
Himanshu Warekar 2019-10-06 16:09:30 +05:30
parent b100b59ee0
commit 014c0360dd
7 changed files with 11 additions and 9 deletions

View file

@ -152,7 +152,7 @@ def get_deleted_tags(new_tags, existing_tags):
return list(set(existing_tags) - set(new_tags))
def delete_tag_for_document(dt, dn, tag):
frappe.db.sql("""DELETE FROM `tabTag Link` WHERE `document_type`=%s, `document_name`=%s, tag=%s""", (dt, dn, tag))
frappe.db.sql("""DELETE FROM `tabTag Link` WHERE `document_type`=%s AND `document_name`=%s AND tag=%s""", (dt, dn, tag))
@frappe.whitelist()
def get_documents_for_tag(tag):

View file

@ -186,7 +186,7 @@
"public/js/frappe/ui/toolbar/awesome_bar.js",
"public/js/frappe/ui/toolbar/energy_points_notifications.js",
"public/js/frappe/ui/toolbar/search.js",
"public/js/frappe/ui/toolbar/tags.js",
"public/js/frappe/ui/toolbar/tag_utils.js",
"public/js/frappe/ui/toolbar/search.html",
"public/js/frappe/ui/toolbar/search_header.html",
"public/js/frappe/ui/toolbar/search_utils.js",

View file

@ -603,7 +603,7 @@ frappe.Application = Class.extend({
},
fetch_tags() {
frappe.tags.utils.set_tags();
frappe.tags.utils.fetch_tags();
}
});

View file

@ -432,7 +432,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
tag_editor.wrapper.on('click', '.tagit-label', (e) => {
const $this = $(e.currentTarget);
this.filter_area.add(this.doctype, '_user_tags', '=', $this.text());
this.filter_area.add('Tag Link', 'tag', '=', $this.text());
});
});
}

View file

@ -174,8 +174,10 @@ frappe.ui.Filter = class {
let original_docfield = (this.fieldselect.fields_by_name[doctype] || {})[fieldname];
if (doctype === "Tag Link") {
original_docfield = {fieldname: "tag", fieldtype: "Data", label: "Tags", parent: doctype};
if (doctype === "Tag Link" || fieldname === "_user_tags") {
original_docfield = {fieldname: "tag", fieldtype: "Data", label: "Tags", parent: "Tag Link"};
doctype = "Tag Link";
condition = "=";
}
if(!original_docfield) {

View file

@ -42,7 +42,7 @@ frappe.ui.TagEditor = Class.extend({
user_tags.push(tag)
me.user_tags = user_tags.join(",");
me.on_change && me.on_change(me.user_tags);
frappe.tags.utils.set_tags();
frappe.tags.utils.fetch_tags();
}
});
}
@ -57,7 +57,7 @@ frappe.ui.TagEditor = Class.extend({
user_tags.splice(user_tags.indexOf(tag), 1);
me.user_tags = user_tags.join(",");
me.on_change && me.on_change(me.user_tags);
frappe.tags.utils.set_tags();
frappe.tags.utils.fetch_tags();
}
});
}

View file

@ -29,7 +29,7 @@ frappe.tags.utils = {
return out;
},
set_tags() {
fetch_tags() {
frappe.call({
method: "frappe.desk.doctype.tag.tag.get_tags_list_for_awesomebar",
callback: function(r) {