Class: SimpleListItemSelector::MainController

Inherits:
Volt::ModelController
  • Object
show all
Defined in:
app/simple_list_item_selector/controllers/main_controller.rb

Instance Method Summary collapse

Instance Method Details

#option_class(option) ⇒ Object



14
15
16
17
18
19
20
# File 'app/simple_list_item_selector/controllers/main_controller.rb', line 14

def option_class(option)
  if attrs.use_option_as_class
    option
  else
    ''
  end
end

#select(option) ⇒ Object



4
5
6
# File 'app/simple_list_item_selector/controllers/main_controller.rb', line 4

def select(option)
  attrs.selected_option = option
end

#selected_class(option) ⇒ Object



8
9
10
11
12
# File 'app/simple_list_item_selector/controllers/main_controller.rb', line 8

def selected_class(option)
  if option == attrs.selected_option
    attrs.selected_class || 'selected'
  end
end