Class: GovukPublishingComponents::Presenters::SelectWithSearchHelper

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::FormOptionsHelper
Defined in:
lib/govuk_publishing_components/presenters/select_with_search_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_assigns) ⇒ SelectWithSearchHelper

Returns a new instance of SelectWithSearchHelper.



21
22
23
24
25
26
27
28
29
# File 'lib/govuk_publishing_components/presenters/select_with_search_helper.rb', line 21

def initialize(local_assigns)
  @select_helper = SelectHelper.new(local_assigns.except(:options, :grouped_options))
  @options = local_assigns[:options]
  @grouped_options = local_assigns[:grouped_options]
  @include_blank = local_assigns[:include_blank]
  @selected_options = []
  @options_markup = get_options
  @local_assigns = local_assigns
end

Instance Attribute Details

#ariaObject (readonly)

Returns the value of attribute aria.



10
11
12
# File 'lib/govuk_publishing_components/presenters/select_with_search_helper.rb', line 10

def aria
  @aria
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/govuk_publishing_components/presenters/select_with_search_helper.rb', line 10

def options
  @options
end

#options_markupObject (readonly)

Returns the value of attribute options_markup.



10
11
12
# File 'lib/govuk_publishing_components/presenters/select_with_search_helper.rb', line 10

def options_markup
  @options_markup
end

#selected_optionsObject (readonly)

Returns the value of attribute selected_options.



10
11
12
# File 'lib/govuk_publishing_components/presenters/select_with_search_helper.rb', line 10

def selected_options
  @selected_options
end

Instance Method Details

#css_classesObject



31
32
33
34
35
# File 'lib/govuk_publishing_components/presenters/select_with_search_helper.rb', line 31

def css_classes
  classes = @select_helper.css_classes
  classes << "gem-c-select-with-search"
  classes
end