Skip to content

Commit

Permalink
Move method from view into cell. [#47]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Apr 12, 2020
1 parent c41273a commit 3430f70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/cells/state_selector/show.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
= form_with url: url, local: true, class: 'state-selector' do |form|
%p
= label_tag :states, _('Choose one or more states:')
- locale_state_options = states_for_menu.sort_by {|state| _(state.name)}.map {|state| [_(state.name), state.abbr]}
= select_tag :states, options_for_select(locale_state_options, @states&.map(&:abbr)), multiple: true
%p
= submit_tag _('Go')
4 changes: 4 additions & 0 deletions app/cells/state_selector_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def show

private

def locale_state_options
@locale_state_options ||= states_for_menu.sort_by {|state| _(state.name)}.map {|state| [_(state.name), state.abbr]}
end

def states_for_menu
@states_for_menu ||= State.all
end
Expand Down

0 comments on commit 3430f70

Please sign in to comment.