From 9e90ef4ebcdc1b759b722db43ddc4e9dccc4bcc9 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Mon, 25 Mar 2019 13:38:49 +0100 Subject: [PATCH] more tag abstraction --- app/helpers/additionals_tag_helper.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/helpers/additionals_tag_helper.rb b/app/helpers/additionals_tag_helper.rb index cd61f513..1e2c80de 100644 --- a/app/helpers/additionals_tag_helper.rb +++ b/app/helpers/additionals_tag_helper.rb @@ -72,12 +72,12 @@ module AdditionalsTagHelper if options[:tags_without_color] content_tag('span', - link_to(safe_join(tag_name), additionals_tag_url(tag.name)), + link_to(safe_join(tag_name), additionals_tag_url(tag.name, options)), class: 'tag-label') else content_tag('span', link_to(safe_join(tag_name), - additionals_tag_url(tag.name), + additionals_tag_url(tag.name, options), style: tag_style), class: 'additionals-tag-label-color', style: tag_style) @@ -85,13 +85,15 @@ module AdditionalsTagHelper end def additionals_tag_url(tag_name, options = {}) - { controller: controller_name, - action: controller_name == 'hrm_user_resources' ? 'show' : 'index', + action = options[:tag_action].presence || (controller_name == 'hrm_user_resources' ? 'show' : 'index') + + { controller: options[:tag_controller].presence || controller_name, + action: action, set_filter: 1, project_id: @project, fields: [:tags], values: { tags: [tag_name] }, - operators: { tags: '=' } }.merge(options) + operators: { tags: '=' } } end private