diff --git a/app/models/container.rb b/app/models/container.rb index 64a62442..2eb59abc 100644 --- a/app/models/container.rb +++ b/app/models/container.rb @@ -39,10 +39,10 @@ class Container < ApplicationRecord accepts_nested_attributes_for :contest_descriptions, allow_destroy: true validates :name, presence: true, uniqueness: true - validates :department_id, presence: { message: 'You must select a department' } - validates :visibility_id, presence: { message: 'You must select a visibility option' } - validates :contact_email, presence: { message: 'You must enter a contact email' } - validates :contact_email, format: { with: URI::MailTo::EMAIL_REGEXP, message: 'You must enter a valid email address' } + validates :department_id, presence: { message: 'selection required' } + validates :visibility_id, presence: { message: 'option required' } + validates :contact_email, presence: { message: 'must be present' } + validates :contact_email, format: { with: URI::MailTo::EMAIL_REGEXP, message: 'must be a valid email address' } scope :visible, -> { joins(:visibility).where(visibilities: { kind: 'Public' }) } # Only show containers with 'Public' visibility diff --git a/app/views/containers/_form.html.erb b/app/views/containers/_form.html.erb index b9bd7c12..a5371338 100644 --- a/app/views/containers/_form.html.erb +++ b/app/views/containers/_form.html.erb @@ -23,11 +23,16 @@ label: 'Dashboard Visibility', label_method: :kind, value_method: :id, - hint: safe_join([ - content_tag(:strong, "Public"), " visibility means that this collection of contests will be visible to all user's of LSA Evaluate.", - tag(:br), - content_tag(:strong, "Private"), " visibility requires you provide a special link to applicants in order for them to apply to this collection of contests, it will NOT be visible in the applicant's dashboard." - ]), + hint: safe_join( + Visibility.all.map.with_index do |v, i| + safe_join([ + content_tag(:strong, v.kind), + ': ', + v.description, + (tag(:br) unless i == Visibility.all.size - 1) + ].compact) + end + ), required: true %>