Sha256: b821a88435ffb296b132185d9f0b267ad9f27feec051509345f733e592302bca

Contents?: true

Size: 701 Bytes

Versions: 44

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module UserGroupHelper
    # 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.
    def user_group_select_field(form, name, options = {})
      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: options.has_key?(:label) ? options[:label] : true
      )
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.4 app/helpers/decidim/user_group_helper.rb
decidim-core-0.27.9 app/helpers/decidim/user_group_helper.rb
decidim-core-0.29.0 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.3 app/helpers/decidim/user_group_helper.rb
decidim-core-0.27.8 app/helpers/decidim/user_group_helper.rb
decidim-core-0.29.0.rc4 app/helpers/decidim/user_group_helper.rb
decidim-core-0.29.0.rc3 app/helpers/decidim/user_group_helper.rb
decidim-core-0.29.0.rc2 app/helpers/decidim/user_group_helper.rb
decidim-core-0.29.0.rc1 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.2 app/helpers/decidim/user_group_helper.rb
decidim-core-0.27.7 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.1 app/helpers/decidim/user_group_helper.rb
decidim-core-0.27.6 app/helpers/decidim/user_group_helper.rb
decidim-core-0.26.10 app/helpers/decidim/user_group_helper.rb
decidim-core-0.26.9 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.0 app/helpers/decidim/user_group_helper.rb
decidim-core-0.27.5 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.0.rc5 app/helpers/decidim/user_group_helper.rb
decidim-core-0.28.0.rc4 app/helpers/decidim/user_group_helper.rb