mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
|
||||
@ratings = @event.votes.includes(:user)
|
||||
@difficulty_levels = @program.difficulty_levels
|
||||
@versions = @event.versions | PaperTrail::Version.where(item_type: 'Commercial', item_id: @event.commercials.pluck(:id))
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
|||
|
|
@ -491,4 +491,14 @@ module ApplicationHelper
|
|||
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
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ class Ability
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,23 @@
|
|||
%th Description
|
||||
%th Actions
|
||||
%tbody
|
||||
- @event.versions.each do |version|
|
||||
- @versions.each do |version|
|
||||
%tr
|
||||
%td
|
||||
= version.id
|
||||
%td
|
||||
%p
|
||||
= 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
|
||||
= distance_of_time_in_words(Time.now,version.created_at) + ' ago'
|
||||
|
|
|
|||
|
|
@ -42,12 +42,7 @@
|
|||
= user_change_description(version)
|
||||
|
||||
- else
|
||||
- if version.event == 'create'
|
||||
= 'created new'
|
||||
- elsif version.event == 'update'
|
||||
= "updated #{updated_attributes(version)} of"
|
||||
- else
|
||||
= 'deleted'
|
||||
= general_change_description(version)
|
||||
|
||||
= render partial: 'object_desc_and_link', locals: { version: version }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue