Move events index datatable row to a partial

- clean up columns
- tag unregistered submitters & speakers
- implement caching
This commit is contained in:
James Mason 2018-02-23 00:00:25 -08:00
parent 0d4c9e32cf
commit a2ed9c0074
7 changed files with 84 additions and 54 deletions

View file

@ -1,5 +1,5 @@
class DifficultyLevel < ApplicationRecord
belongs_to :program
belongs_to :program, touch: true
has_many :events, dependent: :nullify
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,5 +1,5 @@
class EventType < ApplicationRecord
belongs_to :program
belongs_to :program, touch: true
has_many :events, dependent: :restrict_with_error
has_paper_trail meta: { conference_id: :conference_id }

View file

@ -2,6 +2,6 @@ class EventUser < ApplicationRecord
# TODO: Do we need these roles?
ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator]]
belongs_to :event
belongs_to :event, touch: true
belongs_to :user
end

View file

@ -4,7 +4,7 @@ class Track < ApplicationRecord
resourcify :roles, dependent: :delete_all
belongs_to :program
belongs_to :program, touch: true
belongs_to :submitter, class_name: 'User'
belongs_to :room
belongs_to :selected_schedule, class_name: 'Schedule'

View file

@ -22,6 +22,8 @@ class User < ApplicationRecord
before_create :setup_role
after_save :touch_events
# add scope
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference.id)}
@ -231,6 +233,10 @@ class User < ApplicationRecord
end
end
def touch_events
event_users.each(&:touch)
end
##
# Check if biography has an allowed number of words. Used as validation.
#