more tag abstraction
This commit is contained in:
parent
1824de6a3b
commit
9e90ef4ebc
@ -72,12 +72,12 @@ module AdditionalsTagHelper
|
|||||||
|
|
||||||
if options[:tags_without_color]
|
if options[:tags_without_color]
|
||||||
content_tag('span',
|
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')
|
class: 'tag-label')
|
||||||
else
|
else
|
||||||
content_tag('span',
|
content_tag('span',
|
||||||
link_to(safe_join(tag_name),
|
link_to(safe_join(tag_name),
|
||||||
additionals_tag_url(tag.name),
|
additionals_tag_url(tag.name, options),
|
||||||
style: tag_style),
|
style: tag_style),
|
||||||
class: 'additionals-tag-label-color',
|
class: 'additionals-tag-label-color',
|
||||||
style: tag_style)
|
style: tag_style)
|
||||||
@ -85,13 +85,15 @@ module AdditionalsTagHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def additionals_tag_url(tag_name, options = {})
|
def additionals_tag_url(tag_name, options = {})
|
||||||
{ controller: controller_name,
|
action = options[:tag_action].presence || (controller_name == 'hrm_user_resources' ? 'show' : 'index')
|
||||||
action: controller_name == 'hrm_user_resources' ? 'show' : 'index',
|
|
||||||
|
{ controller: options[:tag_controller].presence || controller_name,
|
||||||
|
action: action,
|
||||||
set_filter: 1,
|
set_filter: 1,
|
||||||
project_id: @project,
|
project_id: @project,
|
||||||
fields: [:tags],
|
fields: [:tags],
|
||||||
values: { tags: [tag_name] },
|
values: { tags: [tag_name] },
|
||||||
operators: { tags: '=' } }.merge(options)
|
operators: { tags: '=' } }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
Loading…
x
Reference in New Issue
Block a user