Browse Source

location validations

juris_katrina_test
JG 2 years ago
parent
commit
eacf2b5cf9
  1. 1
      app/models/location.rb
  2. 2
      app/views/locations/new.html.erb
  3. 8
      config/locales/en.yml

1
app/models/location.rb

@ -1,5 +1,6 @@
class Location < ApplicationRecord class Location < ApplicationRecord
validate :validate_postcode validate :validate_postcode
validates :total_units, :type_of_unit, :wheelchair_adaptation, presence: true
belongs_to :scheme belongs_to :scheme
attr_accessor :add_another_location attr_accessor :add_another_location

2
app/views/locations/new.html.erb

@ -35,7 +35,7 @@
type_of_units_selection, type_of_units_selection,
:id, :id,
:name, :name,
legend: { text: "What is this type of scheme?", size: "m" } %> legend: { text: "What is the most common type of unit at this location?", size: "m" } %>
<% wheelchair_user_selection = Location.wheelchair_adaptations.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> <% wheelchair_user_selection = Location.wheelchair_adaptations.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %>

8
config/locales/en.yml

@ -68,6 +68,14 @@ en:
invalid: "Select if this scheme provides for another client group" invalid: "Select if this scheme provides for another client group"
support_services_provider: support_services_provider:
invalid: "Select who provides the support services used by this scheme" invalid: "Select who provides the support services used by this scheme"
location:
attributes:
wheelchair_adaptation:
blank: "Enter the existing organisation’s name"
total_units:
blank: "Enter the existing organisation’s name"
type_of_unit:
blank: "Enter the existing organisation’s name"
validations: validations:

Loading…
Cancel
Save