Skip to content

Commit 4ac097d

Browse files
Added agency_types_for_selection function to provide sorted agency types for dropdown
1 parent 761195b commit 4ac097d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

app/models/partners/profile.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ def county_list_by_region
174174
counties.order(%w(lower(region) lower(name))).pluck(:name).join("; ")
175175
end
176176

177+
def self.agency_types_for_selection
178+
# alphabetize based on the translated version, as that is the text users will actually read
179+
agency_types.keys.map(&:to_sym).sort_by { |sym| I18n.t(sym, scope: :partners_profile) }.partition { |v| v != :other }.flatten
180+
end
181+
177182
private
178183

179184
def check_social_media

app/views/partners/profiles/edit/_agency_information.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<%= profile_form.input :agency_type,
1212
# Symbolize keys, because simple_form will only do a I18n lookup for
1313
# symbols
14-
collection: Partners::Profile.agency_types.keys.map(&:to_sym),
14+
collection: Partners::Profile.agency_types_for_selection,
1515
label: "Agency Type",
1616
class: "form-control",
1717
wrapper: :input_group %>

app/views/partners/profiles/step/_agency_information_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<%= pf.input :agency_type,
88
# Symbolize keys, because simple_form will only do a I18n lookup for
99
# symbols
10-
collection: Partners::Profile.agency_types.keys.map(&:to_sym),
10+
collection: Partners::Profile.agency_types_for_selection,
1111
label: "Agency Type",
1212
class: "form-control",
1313
wrapper: :input_group %>

0 commit comments

Comments
 (0)