You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
887 B
25 lines
887 B
module LocationsHelper |
|
def mobility_type_selection |
|
mobility_types_to_display = Location.mobility_types.excluding("Property designed to accessible general standard", "Missing") |
|
mobility_types_to_display.map { |key, value| OpenStruct.new(id: key, name: key.to_s.humanize, description: I18n.t("questions.descriptions.location.mobility_type.#{value}")) } |
|
end |
|
|
|
def another_location_selection |
|
selection_options(%w[Yes No]) |
|
end |
|
|
|
def type_of_units_selection |
|
selection_options(Location.type_of_units) |
|
end |
|
|
|
def local_authorities_selection |
|
null_option = [OpenStruct.new(id: "", name: "Select an option")] |
|
null_option + Location.local_authorities.map { |code, name| OpenStruct.new(code:, name:) } |
|
end |
|
|
|
def selection_options(resource) |
|
return [] if resource.blank? |
|
|
|
resource.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } |
|
end |
|
end
|
|
|