Show changes to event commercials in event changelog
This commit is contained in:
parent
da1c8fc691
commit
e2659ae907
5 changed files with 24 additions and 10 deletions
|
|
@ -86,6 +86,7 @@ module Admin
|
||||||
@comment_count = @event.comment_threads.count
|
@comment_count = @event.comment_threads.count
|
||||||
@ratings = @event.votes.includes(:user)
|
@ratings = @event.votes.includes(:user)
|
||||||
@difficulty_levels = @program.difficulty_levels
|
@difficulty_levels = @program.difficulty_levels
|
||||||
|
@versions = @event.versions | PaperTrail::Version.where(item_type: 'Commercial', item_id: @event.commercials.pluck(:id))
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
||||||
|
|
@ -491,4 +491,14 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def general_change_description(version)
|
||||||
|
if version.event == 'create'
|
||||||
|
'created new'
|
||||||
|
elsif version.event == 'update'
|
||||||
|
"updated #{updated_attributes(version)} of"
|
||||||
|
else
|
||||||
|
'deleted'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ class Ability
|
||||||
end
|
end
|
||||||
|
|
||||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version do |version|
|
can [:index, :revert_object, :revert_attribute], PaperTrail::Version do |version|
|
||||||
version.item_type == 'Event' && (conf_ids_for_cfp.include? version.conference_id)
|
%w(Event Commercial).include?(version.item_type) && (conf_ids_for_cfp.include? version.conference_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,23 @@
|
||||||
%th Description
|
%th Description
|
||||||
%th Actions
|
%th Actions
|
||||||
%tbody
|
%tbody
|
||||||
- @event.versions.each do |version|
|
- @versions.each do |version|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= version.id
|
= version.id
|
||||||
%td
|
%td
|
||||||
%p
|
%p
|
||||||
= change_creator_link(version.whodunnit)
|
= change_creator_link(version.whodunnit)
|
||||||
= event_change_description(version)
|
|
||||||
= "event #{@event.title}"
|
- if version.item_type == 'Event'
|
||||||
|
= event_change_description(version)
|
||||||
|
= "event #{@event.title}"
|
||||||
|
|
||||||
|
- else
|
||||||
|
= general_change_description(version)
|
||||||
|
= link_to 'commercial',
|
||||||
|
edit_admin_conference_program_event_path(conference_id: @conference.short_title,
|
||||||
|
id: @event.id, anchor: 'commercials-content')
|
||||||
|
|
||||||
%small.text-muted
|
%small.text-muted
|
||||||
= distance_of_time_in_words(Time.now,version.created_at) + ' ago'
|
= distance_of_time_in_words(Time.now,version.created_at) + ' ago'
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,7 @@
|
||||||
= user_change_description(version)
|
= user_change_description(version)
|
||||||
|
|
||||||
- else
|
- else
|
||||||
- if version.event == 'create'
|
= general_change_description(version)
|
||||||
= 'created new'
|
|
||||||
- elsif version.event == 'update'
|
|
||||||
= "updated #{updated_attributes(version)} of"
|
|
||||||
- else
|
|
||||||
= 'deleted'
|
|
||||||
|
|
||||||
= render partial: 'object_desc_and_link', locals: { version: version }
|
= render partial: 'object_desc_and_link', locals: { version: version }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue