From c40f51a4b60a1d7fd4cbb8f6d6b9a9c89b0397f8 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Tue, 4 Apr 2017 00:31:39 +0000 Subject: [PATCH] Added 'match all' value to filter --- config/locales/bg.yml | 1 + config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/locales/fr.yml | 1 + config/locales/it.yml | 1 + config/locales/pt.yml | 1 + config/locales/ru.yml | 1 + config/locales/tr.yml | 1 + config/locales/zh-TW.yml | 1 + config/locales/zh.yml | 1 + lib/redmine_tags/patches/issue_patch.rb | 4 ++++ lib/redmine_tags/patches/issue_query_patch.rb | 2 ++ 12 files changed, 16 insertions(+) diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 2be8e8e..0df1236 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -20,3 +20,4 @@ bg: issues_sort_order_desc: Намаляване auto_complete_new_tag: Добавяне на нов... + match_all: match all diff --git a/config/locales/de.yml b/config/locales/de.yml index 44acc74..83a3919 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -20,3 +20,4 @@ de: auto_complete_new_tag: Hinzufügen... issue_tags_label_add_tag: + Tag hinzufügen + match_all: match all diff --git a/config/locales/en.yml b/config/locales/en.yml index 3a78682..e37b116 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -26,3 +26,4 @@ en: issue_tags_tag: Tag issue_tags_button_merge: Merge issue_tags_label_merge: Merge selected tags + match_all: match all diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 59d2c6c..a492745 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -18,3 +18,4 @@ fr: issues_sort_order_desc: (en) Descending auto_complete_new_tag: Nouveau... + match_all: match all diff --git a/config/locales/it.yml b/config/locales/it.yml index 9efd53e..7fec843 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -20,3 +20,4 @@ it: issues_sort_order_desc: Discendente auto_complete_new_tag: Aggiungi nuovo... + match_all: match all diff --git a/config/locales/pt.yml b/config/locales/pt.yml index b3bbd8c..b17e6c2 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -20,3 +20,4 @@ pt: issues_sort_order_desc: Descendente auto_complete_new_tag: Adicionar nova... + match_all: match all diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 705fdf0..e9292c3 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -21,3 +21,4 @@ ru: auto_complete_new_tag: Добавить... issue_tags_label_add_tag: + добавить метку + match_all: match all diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 3270c6a..cdc9c51 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -26,3 +26,4 @@ tr: issue_tags_tag: Etiket issue_tags_button_merge: Birleştir issue_tags_label_merge: Seçili etiketleri birleştir + match_all: match all diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index ea4729c..07d97ff 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -25,3 +25,4 @@ zh-TW: issue_tags_tag: 標籤 issue_tags_button_merge: 合併 issue_tags_label_merge: 合併選擇的標籤 + match_all: match all diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 51550d8..203d608 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -18,3 +18,4 @@ zh: issues_sort_order_desc: 倒序 auto_complete_new_tag: 添加新标签 ... ... + match_all: match all diff --git a/lib/redmine_tags/patches/issue_patch.rb b/lib/redmine_tags/patches/issue_patch.rb index d917d10..ce4aa68 100644 --- a/lib/redmine_tags/patches/issue_patch.rb +++ b/lib/redmine_tags/patches/issue_patch.rb @@ -33,6 +33,10 @@ def self.included(base) project = Project.find(project) unless project.is_a? Project where("#{project.project_condition(Setting.display_subprojects_issues?)}") } + + Query.operators = Query.operators.merge("&" => :match_all) + Query.operators_by_filter_type[:list_optional] << "&" + end end diff --git a/lib/redmine_tags/patches/issue_query_patch.rb b/lib/redmine_tags/patches/issue_query_patch.rb index a3903fe..6de9054 100644 --- a/lib/redmine_tags/patches/issue_query_patch.rb +++ b/lib/redmine_tags/patches/issue_query_patch.rb @@ -24,6 +24,8 @@ def statement_extended case op when '=', '!' issues = Issue.tagged_with(values_for('tags'), any: true) + when '&' + issues = Issue.tagged_with(values_for('tags'), match_all: true) when '!*' issues = Issue.tagged_with ActsAsTaggableOn::Tag.all.map(&:to_s), exclude: true else