2014-02-13 09:08:26 -05:00
|
|
|
module SelectsHelper
|
|
|
|
def users_select_tag(id, opts = {})
|
|
|
|
css_class = "ajax-users-select "
|
|
|
|
css_class << "multiselect " if opts[:multiple]
|
|
|
|
css_class << (opts[:class] || '')
|
|
|
|
value = opts[:selected] || ''
|
|
|
|
|
|
|
|
hidden_field_tag(id, value, class: css_class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def project_users_select_tag(id, opts = {})
|
|
|
|
css_class = "ajax-project-users-select "
|
|
|
|
css_class << "multiselect " if opts[:multiple]
|
|
|
|
css_class << (opts[:class] || '')
|
|
|
|
value = opts[:selected] || ''
|
2014-02-13 09:16:23 -05:00
|
|
|
placeholder = opts[:placeholder] || 'Select user'
|
2014-05-08 08:52:59 -04:00
|
|
|
project_id = opts[:project_id] || @project.id
|
|
|
|
hidden_field_tag(id, value, class: css_class, 'data-placeholder' => placeholder, 'data-project-id' => project_id)
|
2014-02-13 09:08:26 -05:00
|
|
|
end
|
|
|
|
end
|