Class: Kadmin::Select2

Inherits:
Object
  • Object
show all
Includes:
Presentable
Defined in:
app/components/kadmin/select2.rb,
app/components/kadmin/select2/form_tag.rb,
app/components/kadmin/select2/presenter.rb

Defined Under Namespace

Classes: FormTag, Presenter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Presentable

#present

Constructor Details

#initialize(options = {}) ⇒ Select2

Returns a new instance of Select2.



23
24
25
26
# File 'app/components/kadmin/select2.rb', line 23

def initialize(options = {})
  @placeholder = options[:placeholder].to_s.freeze
  extract_ajax_options!(options).freeze unless options.blank?
end

Instance Attribute Details

#data_urlString (readonly)

NOTE: using this assumes the backend URL uses a Finder object

Returns:

  • (String)

    if given, will set up remote fetching to this URL

See Also:



12
13
14
# File 'app/components/kadmin/select2.rb', line 12

def data_url
  @data_url
end

#display_propertyString (readonly)

Returns the name of the display property for the model (if doing remote fetching).

Returns:

  • (String)

    the name of the display property for the model (if doing remote fetching)



18
19
20
# File 'app/components/kadmin/select2.rb', line 18

def display_property
  @display_property
end

#filter_paramString (readonly)

Returns the name of the filter param when doing remote fetching.

Returns:

  • (String)

    the name of the filter param when doing remote fetching



15
16
17
# File 'app/components/kadmin/select2.rb', line 15

def filter_param
  @filter_param
end

#placeholderString (readonly)

Returns will be used as a placeholder if given.

Returns:

  • (String)

    will be used as a placeholder if given



7
8
9
# File 'app/components/kadmin/select2.rb', line 7

def placeholder
  @placeholder
end

#value_propertyString (readonly)

Returns the name of the property used as the selected value.

Returns:

  • (String)

    the name of the property used as the selected value



21
22
23
# File 'app/components/kadmin/select2.rb', line 21

def value_property
  @value_property
end