Class: CollectionSelectInput

Inherits:
SimpleForm::Inputs::CollectionSelectInput
  • Object
show all
Defined in:
app/inputs/collection_select_input.rb

Overview

Overrides SimpleForm’s default CollectionSelectInput to add a class. This class is then used to initialise Select2 on all collection select inputs.

Instance Method Summary collapse

Instance Method Details

#input_html_classesObject



5
6
7
# File 'app/inputs/collection_select_input.rb', line 5

def input_html_classes
  super.push('pure-admin-select')
end

#input_html_optionsObject



9
10
11
12
13
14
15
16
# File 'app/inputs/collection_select_input.rb', line 9

def input_html_options
  super.deep_merge(
    style: 'width: 100%;',
    data: {
      tags: options[:create_when_no_match] || false
    }
  )
end