Module: Decidim::UserGroupHelper
- Defined in:
- app/helpers/decidim/user_group_helper.rb
Instance Method Summary collapse
-
#user_group_select_field(form, name, options = {}) ⇒ Object
Renders a user_group select field in a form.
Instance Method Details
#user_group_select_field(form, name, options = {}) ⇒ Object
Renders a user_group select field in a form. form - FormBuilder object name - attribute user_group_id options - A hash used to modify the behavior of the select field.
Returns nothing.
11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/decidim/user_group_helper.rb', line 11 def user_group_select_field(form, name, = {}) user_groups = Decidim::UserGroups::ManageableUserGroups.for(current_user).verified form.select( name, user_groups.map { |g| [g.name, g.id] }, selected: @form.user_group_id.presence, include_blank: current_user.name, label: .has_key?(:label) ? [:label] : true ) end |