From eacf2b5cf9e97e2a340f1e5de26d5536d2b8834b Mon Sep 17 00:00:00 2001 From: JG Date: Wed, 13 Jul 2022 09:16:52 +0100 Subject: [PATCH] location validations --- app/models/location.rb | 1 + app/views/locations/new.html.erb | 2 +- config/locales/en.yml | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/location.rb b/app/models/location.rb index ca5063215..1661ab01f 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -1,5 +1,6 @@ class Location < ApplicationRecord validate :validate_postcode + validates :total_units, :type_of_unit, :wheelchair_adaptation, presence: true belongs_to :scheme attr_accessor :add_another_location diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb index 8d964d07c..031636ed0 100644 --- a/app/views/locations/new.html.erb +++ b/app/views/locations/new.html.erb @@ -35,7 +35,7 @@ type_of_units_selection, :id, :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) } %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 75f3156ce..f5d55806e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -68,6 +68,14 @@ en: invalid: "Select if this scheme provides for another client group" support_services_provider: 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: