From c29ea240ea53674ea47c37ebc8f87cb23580c177 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 24 Jun 2025 18:15:19 -0400 Subject: [PATCH 1/2] Refactor validation messages in Container model for improved clarity - Updated validation messages for department_id, visibility_id, and contact_email to be more concise and user-friendly. - This change enhances the user experience by providing clearer guidance on required fields. --- app/models/container.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From 76f7eed8da0c164e33d792aa9733b0e003abbd5c Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 24 Jun 2025 18:15:32 -0400 Subject: [PATCH 2/2] Refactor visibility hint in container form for improved clarity - Updated the hint for dashboard visibility in the container form to dynamically display visibility options and their descriptions. - This change enhances the user interface by providing clearer guidance on visibility settings, improving user understanding of public and private options. --- app/views/containers/_form.html.erb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 %>