Sha256: f1f194e5446cc849e7a70e5f6a8cf43775cf43f33c88741f944a758c5540ddc3
Contents?: true
Size: 653 Bytes
Versions: 38
Compression:
Stored size: 653 Bytes
Contents
class BootstrapForm::FormBuilder def role_select(opts = {}) collection = Chaltron.roles.map { |role| [role, I18n.translate("roles.#{role}")] } checked = @object.nil?? false : @object.roles html = inputs_collection(:roles, collection, :first, :last, checked: checked) do |name, value, options| options[:multiple] = true options[:inline] = true if value == opts[:disabled] options[:disabled] = true options[:checked] = true end check_box(name, options, value, nil) end hidden = opts[:disabled] || '' hidden_field(:roles, { value: hidden, multiple: true }).concat(html) end end
Version data entries
38 entries across 38 versions & 1 rubygems