Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/models/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 10 additions & 5 deletions app/views/containers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %> <!-- Required visibility -->
</div>

Expand Down
Loading