Add booths to non admin

This commit is contained in:
nasia 2017-07-20 14:20:46 +03:00 committed by Stella Rouzi
parent 033dbe4c40
commit 32c5af2a17
22 changed files with 426 additions and 86 deletions

View file

@ -75,6 +75,12 @@ class Ability
can [:new, :create], Payment, user_id: user.id
can [:index, :show], PhysicalTicket, user: user
can [:new, :create], Booth
can [:edit, :update, :index, :show], Booth do |booth|
booth.users.include?(user)
end
can [:create, :destroy], Subscription, user_id: user.id
can [:new, :create], Event do |event|

View file

@ -35,12 +35,16 @@ class Booth < ActiveRecord::Base
state :to_reject
state :rejected
state :canceled
state :confirmed
event :restart do
transitions to: :new, from: [:withdrawn, :to_accept, :to_reject, :canceled]
transitions to: :new, from: [:withdrawn, :rejected, :canceled]
end
event :withdraw do
transitions to: :withdrawn, from: [:new, :to_accept, :accepted, :to_reject, :rejected]
transitions to: :withdrawn, from: [:new, :to_accept, :accepted, :to_reject, :rejected, :confirmed]
end
event :confirm do
transitions to: :confirmed, from: [:accepted]
end
event :to_accept do
transitions to: :to_accept, from: [:new, :to_reject]
@ -55,7 +59,7 @@ class Booth < ActiveRecord::Base
transitions to: :rejected, from: [:new, :to_reject]
end
event :cancel do
transitions to: :canceled, from: [:accepted, :rejected, :to_accept, :to_reject]
transitions to: :canceled, from: [:accepted, :rejected, :to_accept, :to_reject, :confirmed]
end
end