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
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def organization_params
:end_date,
:_destroy
],
comments_attributes: [ :id, :body ],
comments_attributes: [ :id, :body, :_destroy ],
addresses_attributes: [
:id,
:address_type,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def person_params
:end_date,
:_destroy
],
comments_attributes: [ :id, :body ],
comments_attributes: [ :id, :body, :_destroy ],
)
end
end
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def user_params
:phone, :phone2, :phone3, :birthday, :best_time_to_call, :notes, # legacy to remove later
#####

comments_attributes: [ :id, :body ],
comments_attributes: [ :id, :body, :_destroy ],
affiliations_attributes: [ :id, :organization_id, :position, :title, :inactive, :primary_contact, :start_date, :end_date, :_destroy ],
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/event_registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EventRegistration < ApplicationRecord

before_destroy :create_refund_payments

accepts_nested_attributes_for :comments, reject_if: proc { |attrs| attrs["body"].blank? }
accepts_nested_attributes_for :comments, allow_destroy: true, reject_if: proc { |attrs| attrs["body"].blank? }

before_create :generate_slug
after_create :snapshot_registrant_organizations
Expand Down
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Organization < ApplicationRecord
after_save :remove_duplicate_sectorable_items
accepts_nested_attributes_for :affiliations, allow_destroy: true,
reject_if: proc { |attrs| attrs["person_id"].blank? }
accepts_nested_attributes_for :comments, reject_if: proc { |attrs| attrs["body"].blank? }
accepts_nested_attributes_for :comments, allow_destroy: true, reject_if: proc { |attrs| attrs["body"].blank? }

# SearchCop
include SearchCop
Expand Down
2 changes: 1 addition & 1 deletion app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Person < ApplicationRecord
accepts_nested_attributes_for :user, update_only: true
accepts_nested_attributes_for :affiliations, allow_destroy: true,
reject_if: proc { |attrs| attrs["organization_id"].blank? }
accepts_nested_attributes_for :comments, reject_if: proc { |attrs| attrs["body"].blank? }
accepts_nested_attributes_for :comments, allow_destroy: true, reject_if: proc { |attrs| attrs["body"].blank? }

# Search Cop
include SearchCop
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class User < ApplicationRecord
has_many :user_form_form_fields, through: :user_forms, dependent: :destroy
# Nested attributes
accepts_nested_attributes_for :user_forms
accepts_nested_attributes_for :comments, reject_if: proc { |attrs| attrs["body"].blank? }
accepts_nested_attributes_for :comments, allow_destroy: true, reject_if: proc { |attrs| attrs["body"].blank? }


before_validation :strip_whitespace
Expand Down
2 changes: 2 additions & 0 deletions app/views/comments/_comment_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
as: :text,
input_html: { rows: 1, class: "w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200 text-sm" } %>
</div>
<%= link_to_remove_association "Remove", f,
class: "text-sm text-gray-400 hover:text-red-600 underline whitespace-nowrap mt-2 shrink-0" %>
</div>
<% else %>
<% current_first_name = current_user&.person&.first_name || current_user&.name.to_s.split.first %>
Expand Down