Setup basic Revision History page
Sets up paper_trail tracking in important models and add conference_id to versions for storing conference_id of conference related objects as metadata.This will help in querying for versions related to conferences. Fix issues with factories & event types initialization.Import paper_trail testing helpers Fix bug: Creating an event creates a useless version with event update Add revert and view changes features to revision history
This commit is contained in:
parent
60877e9593
commit
a45e537bac
49 changed files with 760 additions and 26 deletions
|
|
@ -114,6 +114,14 @@ class Ability
|
|||
# for admins
|
||||
can :manage, :all if user.is_admin
|
||||
|
||||
cannot :revert_object, PaperTrail::Version do |version|
|
||||
(version.event == 'create' && %w(Conference User Event).include?(version.item_type))
|
||||
end
|
||||
|
||||
cannot :revert_attribute, PaperTrail::Version do |version|
|
||||
version.event != 'update' || version.item.nil?
|
||||
end
|
||||
|
||||
cannot :destroy, Program
|
||||
# Do not delete venue, when there are rooms being used
|
||||
cannot :destroy, Venue do |venue|
|
||||
|
|
@ -168,6 +176,10 @@ class Ability
|
|||
can [:edit, :update, :toggle_user], Role do |role|
|
||||
role.resource_type == 'Conference' && (conf_ids_for_organizer.include? role.resource_id)
|
||||
end
|
||||
|
||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version do |version|
|
||||
version.item_type == 'User' || (conf_ids_for_organizer.include? version.conference_id)
|
||||
end
|
||||
end
|
||||
|
||||
def signed_in_with_cfp_role(user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue