Enable track requests

This commit is contained in:
AEtherC0r3 2017-07-12 16:35:09 +03:00 committed by Stella Rouzi
parent 0f154d07c9
commit 2f9eb04219
14 changed files with 155 additions and 20 deletions

View file

@ -95,6 +95,14 @@ class Ability
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
can [:destroy], Openid
can [:new, :create], Track do |track|
track.new_record? && track.program.cfps.for_tracks.try(:open?)
end
can [:index, :show, :edit, :update], Track do |track|
user == track.submitter
end
end
# Abilities for users with roles wandering around in non-admin views.

View file

@ -1,9 +1,10 @@
# cannot delete program if there are events submitted
class Cfp < ActiveRecord::Base
TYPES = %w(events booths).freeze
TYPES = %w(events booths tracks).freeze
scope :for_events, (-> { find_by(cfp_type: 'events') })
scope :for_tracks, (-> { find_by(cfp_type: 'tracks') })
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
belongs_to :program