diff --git a/Gemfile.lock b/Gemfile.lock
index bfc51257..daf162a5 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -317,7 +317,7 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
racc (1.8.1)
- rack (3.1.14)
+ rack (3.1.16)
rack-accept (0.4.5)
rack (>= 0.4)
rack-protection (4.1.1)
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index af7c1e83..6ca25811 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -28,8 +28,6 @@ def new
Rails.logger.debug { "^^^^^^^^^^^^^^^^ Profile is nil for user: #{current_user.inspect}" }
else
authorize @profile
- @profile.build_home_address
- @profile.build_campus_address
end
end
@@ -86,8 +84,6 @@ def profile_params
:major,
:department, :grad_date, :degree, :receiving_financial_aid,
:accepted_financial_aid_notice, :financial_aid_description,
- :hometown_publication, :pen_name,
- home_address_attributes: %i[id address1 address2 city state zip country address_type_id],
- campus_address_attributes: %i[id address1 address2 city state zip country address_type_id])
+ :hometown_publication, :pen_name)
end
end
diff --git a/app/helpers/containers_helper.rb b/app/helpers/containers_helper.rb
index 7fa7bcf9..ed112856 100644
--- a/app/helpers/containers_helper.rb
+++ b/app/helpers/containers_helper.rb
@@ -18,8 +18,8 @@ def render_eligibility_rules(description)
eligibility_plain = description.eligibility_rules.to_plain_text
if eligibility_plain.length > 100
content_tag(:div) do
- truncate(eligibility_plain, length: 100, omission: '') +
- link_to('...more', '#',
+ truncate(eligibility_plain, length: 60, omission: '') +
+ link_to(' ...more', '#',
data: {
action: 'click->modal#open',
url: eligibility_rules_container_contest_description_path(description.container, description),
diff --git a/app/helpers/contest_descriptions_helper.rb b/app/helpers/contest_descriptions_helper.rb
index 44b1ee76..5e53842d 100644
--- a/app/helpers/contest_descriptions_helper.rb
+++ b/app/helpers/contest_descriptions_helper.rb
@@ -6,9 +6,8 @@ def contest_description_summary(description)
if active_instances.any?
first_active = active_instances.first
entry_count = first_active.entries.where(deleted: false).count
- summary += 'Active instance
'
- summary += link_to(pluralize(entry_count, 'entry'),
- container_contest_description_contest_instance_path(description.container, description, first_active), class: 'btn btn-sm btn-primary')
+ summary += link_to("Active: #{pluralize(entry_count, 'entry')}",
+ container_contest_description_contest_instance_path(description.container, description, first_active), class: 'btn btn-sm btn-primary small')
summary += '
'
end
summary += "#{pluralize(total_instances, 'instance')}"
diff --git a/app/javascript/controllers/address_copy_controller.js b/app/javascript/controllers/address_copy_controller.js
deleted file mode 100644
index e09b4301..00000000
--- a/app/javascript/controllers/address_copy_controller.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Controller } from "@hotwired/stimulus"
-
-export default class extends Controller {
- static targets = [
- "homeAddress1", "homeAddress2", "homeCity", "homeState", "homeZip", "homeCountry",
- "campusAddress1", "campusAddress2", "campusCity", "campusState", "campusZip", "campusCountry"
- ]
-
- copy() {
- this.homeAddress1Target.value = this.campusAddress1Target.value
- this.homeAddress2Target.value = this.campusAddress2Target.value
- this.homeCityTarget.value = this.campusCityTarget.value
- this.homeStateTarget.value = this.campusStateTarget.value
- this.homeZipTarget.value = this.campusZipTarget.value
- this.homeCountryTarget.value = this.campusCountryTarget.value
- }
-}
\ No newline at end of file
diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js
index d4b7e30a..896a70fa 100644
--- a/app/javascript/controllers/index.js
+++ b/app/javascript/controllers/index.js
@@ -4,9 +4,6 @@
import { application } from "./application"
-import AddressCopyController from "./address_copy_controller"
-application.register("address-copy", AddressCopyController)
-
import CharacterCounterController from "./character_counter_controller"
application.register("character-counter", CharacterCounterController)
diff --git a/app/models/address.rb b/app/models/address.rb
deleted file mode 100644
index d24098fc..00000000
--- a/app/models/address.rb
+++ /dev/null
@@ -1,108 +0,0 @@
-# frozen_string_literal: true
-
-# == Schema Information
-#
-# Table name: addresses
-#
-# id :bigint not null, primary key
-# address1 :string(255)
-# address2 :string(255)
-# city :string(255)
-# country :string(255)
-# state :string(255)
-# zip :string(255)
-# created_at :datetime not null
-# updated_at :datetime not null
-# address_type_id :bigint
-#
-# Indexes
-#
-# address_type_id_idx (address_type_id)
-# id_unq_idx (id) UNIQUE
-# index_addresses_on_address_type_id (address_type_id)
-#
-# Foreign Keys
-#
-# fk_rails_... (address_type_id => address_types.id)
-#
-
-class Address < ApplicationRecord
- belongs_to :address_type
- has_many :home_profiles, class_name: 'Profile', foreign_key: 'home_address_id', dependent: :restrict_with_exception
- has_many :campus_profiles, class_name: 'Profile', foreign_key: 'campus_address_id', dependent: :restrict_with_exception
-
- validates :address1, :city, :state, :zip, :country, presence: true
-
- STATES =
- [
- [ 'Alabama', 'AL' ],
- [ 'Alaska', 'AK' ],
- [ 'Arizona', 'AZ' ],
- [ 'Arkansas', 'AR' ],
- [ 'California', 'CA' ],
- [ 'Colorado', 'CO' ],
- [ 'Connecticut', 'CT' ],
- [ 'Delaware', 'DE' ],
- [ 'District of Columbia', 'DC' ],
- [ 'Florida', 'FL' ],
- [ 'Georgia', 'GA' ],
- [ 'Hawaii', 'HI' ],
- [ 'Idaho', 'ID' ],
- [ 'Illinois', 'IL' ],
- [ 'Indiana', 'IN' ],
- [ 'Iowa', 'IA' ],
- [ 'Kansas', 'KS' ],
- [ 'Kentucky', 'KY' ],
- [ 'Louisiana', 'LA' ],
- [ 'Maine', 'ME' ],
- [ 'Maryland', 'MD' ],
- [ 'Massachusetts', 'MA' ],
- [ 'Michigan', 'MI' ],
- [ 'Minnesota', 'MN' ],
- [ 'Mississippi', 'MS' ],
- [ 'Missouri', 'MO' ],
- [ 'Montana', 'MT' ],
- [ 'Nebraska', 'NE' ],
- [ 'Nevada', 'NV' ],
- [ 'New Hampshire', 'NH' ],
- [ 'New Jersey', 'NJ' ],
- [ 'New Mexico', 'NM' ],
- [ 'New York', 'NY' ],
- [ 'North Carolina', 'NC' ],
- [ 'North Dakota', 'ND' ],
- [ 'Ohio', 'OH' ],
- [ 'Oklahoma', 'OK' ],
- [ 'Oregon', 'OR' ],
- [ 'Pennsylvania', 'PA' ],
- [ 'Puerto Rico', 'PR' ],
- [ 'Rhode Island', 'RI' ],
- [ 'South Carolina', 'SC' ],
- [ 'South Dakota', 'SD' ],
- [ 'Tennessee', 'TN' ],
- [ 'Texas', 'TX' ],
- [ 'Utah', 'UT' ],
- [ 'Vermont', 'VT' ],
- [ 'Virginia', 'VA' ],
- [ 'Washington', 'WA' ],
- [ 'West Virginia', 'WV' ],
- [ 'Wisconsin', 'WI' ],
- [ 'Wyoming', 'WY' ]
- ].freeze
-
- # def full_address
- # "#{address1} #{address2} #{city}, #{state} #{zip}"
- # end
- def full_address
- "#{address1}\n#{address2.present? ? "#{address2}\n" : ''}#{city}, #{state} #{zip}\n#{country_abbreviation}"
- end
-
- def country_name
- country_data = ISO3166::Country[country]
- country_data.translations[I18n.locale.to_s] || country_data.name if country_data
- end
-
- def country_abbreviation
- country_data = ISO3166::Country[country]
- country_data.alpha2 if country_data
- end
-end
diff --git a/app/models/address_type.rb b/app/models/address_type.rb
deleted file mode 100644
index d869c3a3..00000000
--- a/app/models/address_type.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# == Schema Information
-#
-# Table name: address_types
-#
-# id :bigint not null, primary key
-# description :text(65535)
-# kind :string(255) not null
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-# Indexes
-#
-# id_unq_idx (id) UNIQUE
-# index_address_types_on_kind (kind) UNIQUE
-#
-class AddressType < ApplicationRecord
- has_many :addresses
- validates :kind, presence: true, uniqueness: true
-end
diff --git a/app/models/profile.rb b/app/models/profile.rb
index 6c7b5e7e..20520d2c 100644
--- a/app/models/profile.rb
+++ b/app/models/profile.rb
@@ -20,34 +20,28 @@
# umid :string(255)
# created_at :datetime not null
# updated_at :datetime not null
-# campus_address_id :bigint
# campus_id :bigint
# class_level_id :bigint
-# home_address_id :bigint
# school_id :bigint
# user_id :bigint not null
#
# Indexes
#
-# campus_id_idx (campus_id)
-# class_level_id_idx (class_level_id)
-# id_unq_idx (id) UNIQUE
-# index_profiles_on_campus_address_id (campus_address_id)
-# index_profiles_on_campus_id (campus_id)
-# index_profiles_on_class_level_id (class_level_id)
-# index_profiles_on_home_address_id (home_address_id)
-# index_profiles_on_school_id (school_id)
-# index_profiles_on_umid (umid) UNIQUE
-# index_profiles_on_user_id (user_id)
-# school_id_idx (school_id)
-# user_id_idx (user_id)
+# campus_id_idx (campus_id)
+# class_level_id_idx (class_level_id)
+# id_unq_idx (id) UNIQUE
+# index_profiles_on_campus_id (campus_id)
+# index_profiles_on_class_level_id (class_level_id)
+# index_profiles_on_school_id (school_id)
+# index_profiles_on_umid (umid) UNIQUE
+# index_profiles_on_user_id (user_id)
+# school_id_idx (school_id)
+# user_id_idx (user_id)
#
# Foreign Keys
#
-# fk_rails_... (campus_address_id => addresses.id)
# fk_rails_... (campus_id => campuses.id)
# fk_rails_... (class_level_id => class_levels.id)
-# fk_rails_... (home_address_id => addresses.id)
# fk_rails_... (school_id => schools.id)
# fk_rails_... (user_id => users.id)
#
@@ -60,17 +54,11 @@ class Profile < ApplicationRecord
belongs_to :campus, optional: true
has_many :entries, dependent: :restrict_with_error
- belongs_to :home_address, class_name: 'Address', optional: true
- belongs_to :campus_address, class_name: 'Address', optional: true
-
- accepts_nested_attributes_for :home_address, allow_destroy: true
- accepts_nested_attributes_for :campus_address, allow_destroy: true
-
validates :preferred_first_name, presence: true, length: { in: 1..255 }
validates :preferred_last_name, presence: true, length: { in: 1..255 }
- validates :umid,
- presence: true,
- uniqueness: true,
+ validates :umid,
+ presence: true,
+ uniqueness: true,
length: { is: 8 },
format: { with: /\A\d{8}\z/, message: "must be exactly 8 digits" }
validates :grad_date, presence: true
@@ -79,9 +67,6 @@ class Profile < ApplicationRecord
validates :class_level_id, presence: true
validates :campus_id, presence: true
validates :school_id, presence: true
- validates :home_address, presence: true
- validates :campus_address, presence: true
-
def display_name
"#{preferred_first_name} #{preferred_last_name}"
diff --git a/app/policies/address_policy.rb b/app/policies/address_policy.rb
deleted file mode 100644
index cac3e2a1..00000000
--- a/app/policies/address_policy.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# app/policies/address_policy.rb
-class AddressPolicy < ApplicationPolicy
- def index?
- axis_mundi?
- end
-
- def show?
- axis_mundi? || owner?
- end
-
- def create?
- axis_mundi? || owner?
- end
-
- def new?
- create?
- end
-
- def update?
- axis_mundi? || owner?
- end
-
- def edit?
- update?
- end
-
- def destroy?
- axis_mundi?
- end
-
- private
-
- # Checks if the user owns the address via their profile
- def owner?
- user && (
- record == user.profile&.home_address ||
- record == user.profile&.campus_address
- )
- end
-
- class Scope < Scope
- def resolve
- if user&.axis_mundi?
- scope.all
- else
- scope.none
- end
- end
- end
-end
diff --git a/app/views/containers/_contest_descriptions_table.html.erb b/app/views/containers/_contest_descriptions_table.html.erb
index 69cb9ca0..2c8a6d84 100644
--- a/app/views/containers/_contest_descriptions_table.html.erb
+++ b/app/views/containers/_contest_descriptions_table.html.erb
@@ -1,41 +1,56 @@
<%# app/views/containers/_contest_descriptions_table.html.erb %>
| Name | -Summary | -Short Name | -Eligibility Rules | -Notes | -Active | -Actions | +Name | +Status | +Short Name | +Eligibility | +Notes | +Active | +Actions |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <%= description.name %> | -<%= contest_description_summary(description) %> | -<%= description.short_name %> | -- <%= render_eligibility_rules(description) %> + | + + <%= description.name %> + + | ++ <%= contest_description_summary(description) %> | -+ | + + <%= description.short_name %> + + | ++ + <%# <% if description.notes.present? %> - <%= link_to "view", container_contest_description_contest_instances_path(container, description) %> + <%= link_to "view", container_contest_description_contest_instances_path(container, description), class: "btn btn-link btn-sm p-0", title: "View notes", aria: { label: "View notes for #{description.name}" } %> <% end %> | -<%= boolean_to_yes_no(description.active) %> | -
-
+
+ <%= boolean_to_yes_no(description.active) %>
+ |
+
+ |
<% contest_description_action_links(container, description).each do |action, config| %>
<%= link_to config[:path],
- class: 'd-block',
+ class: 'btn btn-link btn-sm p-0',
data: config[:data]&.merge('bs-toggle': 'tooltip'),
title: config[:title],
aria: { label: config[:title] } do %>
-
+
<%= config[:title] %>
<% end %>
<% end %>
diff --git a/app/views/profiles/_form.html.erb b/app/views/profiles/_form.html.erb
index b55288be..56c07f25 100644
--- a/app/views/profiles/_form.html.erb
+++ b/app/views/profiles/_form.html.erb
@@ -5,7 +5,7 @@
<%= f.error_notification %>
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
-
@@ -31,55 +29,65 @@
+
Contact Information
@@ -29,69 +29,6 @@
<%= f.input :pen_name, label: "Default pen name (optional)", hint: "Set a default pen name to use for future contest entries that require one. You can leave this blank if you prefer to enter a pen name each time. The pen name should bear no resemblance to your real name or any other personal information." %>
-
Local (campus) Address- (Please provide your current campus address) - <%= f.simple_fields_for :campus_address do |address_form| %> -
-
-
- <%= address_form.input :address1, input_html: { data: { target: "address-copy.campusAddress1" } } %>
-
-
- <%= address_form.input :address2, input_html: { data: { target: "address-copy.campusAddress2" } } %>
-
-
-
-
- <%= address_form.input :city, input_html: { data: { target: "address-copy.campusCity" } } %>
-
-
- <%= address_form.input :state, collection: Address::STATES, input_html: { data: { target: "address-copy.campusState" } } %>
-
-
-
- <% end %>
-
-
-
-
- <%= address_form.input :zip, input_html: { data: { target: "address-copy.campusZip" } } %>
-
-
- <%= address_form.input :country, priority: ["United States"], input_html: { data: { target: "address-copy.campusCountry" } } %>
- <%= address_form.input :address_type_id, as: :hidden, input_html: { value: AddressType.find_by(kind: 'Campus').id } %>
-
- Hometown Address- <%= f.simple_fields_for :home_address do |address_form| %> -
-
-
- <%= address_form.input :address1, input_html: { data: { target: "address-copy.homeAddress1" } } %>
-
-
- <%= address_form.input :address2, input_html: { data: { target: "address-copy.homeAddress2" } } %>
-
-
-
-
- <%= address_form.input :city, input_html: { data: { target: "address-copy.homeCity" } } %>
-
-
- <%= address_form.input :state, collection: Address::STATES, input_html: { data: { target: "address-copy.homeState" } } %>
-
-
-
- <% end %>
-
- <%= address_form.input :zip, input_html: { data: { target: "address-copy.homeZip" } } %>
-
-
- <%= address_form.input :country, priority: ["United States"], input_html: { data: { target: "address-copy.homeCountry" } } %>
- <%= address_form.input :address_type_id, as: :hidden, input_html: { value: AddressType.find_by(kind: 'Home').id } %>
-
- Academic Information@@ -117,13 +54,11 @@Publicity
-
-
- <%= f.input :hometown_publication, label: "Name of your hometown newspaper or preferred media outlet:", hint: "For some contests, if your manuscript earns an award, the award’s committee will forward a press release to your local newspaper or media outlet." %>
-
+
+ <%= f.input :hometown_publication, label: "Name of your hometown newspaper or preferred media outlet:", hint: "For some contests, if your manuscript earns an award, the award's committee will forward a press release to your local newspaper or media outlet." %>
+
<% if (content = render_editable_content('profiles', 'information')) %>
diff --git a/app/views/profiles/_profile.html.erb b/app/views/profiles/_profile.html.erb
index 6630c186..01698a72 100644
--- a/app/views/profiles/_profile.html.erb
+++ b/app/views/profiles/_profile.html.erb
@@ -16,12 +16,10 @@
-
- <% if profile.pen_name.present? %>
- Local(campus) Address:<%= simple_format(profile.campus_address.full_address, {class:"fw-light"}) if profile.campus_address %>
- Hometown Address:<%= simple_format(profile.home_address.full_address, {class:"fw-light"}) if profile.home_address %>
+ <% if profile.pen_name.present? %>
+ Default pen name: <%= simple_format(profile.pen_name, {class:"fw-light"}) %> Default pen name: <%= simple_format(profile.pen_name, {class:"fw-light"}) %> Academic Information
-
-
- <% if @profile.receiving_financial_aid && @profile.financial_aid_description.present? %>
-
-
Class Level: School or College: Primary Campus Class Location: Major (if undergraduate): Department (if graduate): Expected Graduation Date: Degree:
+
+
+
Class Level: <%= simple_format(profile.class_level.name, {class:"fw-light"}) %> +School or College: <%= simple_format(profile.school.name, {class:"fw-light"}) %> +Primary Campus Class Location: <%= simple_format(profile.campus.campus_descr, {class:"fw-light"}) %> + <% if profile.major.present? %> +Major: <%= simple_format(profile.major, {class:"fw-light"}) %> + <% end %> + <% if profile.department.present? %> +Department: <%= simple_format(profile.department, {class:"fw-light"}) %> + <% end %> +Expected Graduation Date: <%= simple_format(profile.grad_date.strftime("%B %Y"), {class:"fw-light"}) %> +Degree: <%= simple_format(profile.degree, {class:"fw-light"}) %> +
-
-
- Financial Aid-
+
+
+
+ Publicity+
+
- <% end %>
+
-
Financial Aid: Financial Aid Description: + (This is the name you entered as your preferred name.) + <%= simple_format(profile.display_name, {class:"fw-light"}) %>
+
+ <% end %>
+ Hometown newspaper or preferred media outlet:
+ + <%= simple_format(profile.hometown_publication, {class:"fw-light"}) %> +
-
Publicity+Financial Aid
-
-
-
-
- Entrant’s name as it will appear in publicity:
diff --git a/app/views/profiles/_profile_summary.html.erb b/app/views/profiles/_profile_summary.html.erb
index cf628eae..c8764e6b 100644
--- a/app/views/profiles/_profile_summary.html.erb
+++ b/app/views/profiles/_profile_summary.html.erb
@@ -7,31 +7,10 @@
- (This is the name you entered as your preferred name.) - <%= simple_format(profile.display_name, {class:"fw-light"}) %> - <% if profile.hometown_publication.present? %> - Name of your hometown newspaper or preferred media outlet:
+
+
+ Receiving financial aid: <%= simple_format(profile.receiving_financial_aid ? "Yes" : "No", {class:"fw-light"}) %>
+ <% if profile.receiving_financial_aid && profile.financial_aid_description.present? %>
+
+ Description: <%= simple_format(profile.financial_aid_description, {class:"fw-light"}) %> + <% end %> + Welcome
|