Refactor select2 tags
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
da26fd3fc2
commit
adec8c7768
2 changed files with 14 additions and 11 deletions
|
@ -17,15 +17,6 @@ module NamespacesHelper
|
|||
grouped_options_for_select(options, selected)
|
||||
end
|
||||
|
||||
def namespace_select_tag(id, opts = {})
|
||||
css_class = "ajax-namespace-select "
|
||||
css_class << "multiselect " if opts[:multiple]
|
||||
css_class << (opts[:class] || '')
|
||||
value = opts[:selected] || ''
|
||||
|
||||
hidden_field_tag(id, value, class: css_class)
|
||||
end
|
||||
|
||||
def namespace_icon(namespace, size = 40)
|
||||
if namespace.kind_of?(Group)
|
||||
group_icon(namespace)
|
||||
|
|
|
@ -35,8 +35,20 @@ module SelectsHelper
|
|||
end
|
||||
|
||||
def groups_select_tag(id, opts = {})
|
||||
css_class = "ajax-groups-select "
|
||||
css_class << "multiselect " if opts[:multiple]
|
||||
opts[:class] ||= ''
|
||||
opts[:class] << ' ajax-groups-select'
|
||||
select2_tag(id, opts)
|
||||
end
|
||||
|
||||
def namespace_select_tag(id, opts = {})
|
||||
opts[:class] ||= ''
|
||||
opts[:class] << ' ajax-namespace-select'
|
||||
select2_tag(id, opts)
|
||||
end
|
||||
|
||||
def select2_tag(id, opts = {})
|
||||
css_class = ''
|
||||
css_class << 'multiselect ' if opts[:multiple]
|
||||
css_class << (opts[:class] || '')
|
||||
value = opts[:selected] || ''
|
||||
|
||||
|
|
Loading…
Reference in a new issue