Merge pull request #1128 from nishanthvijayan/event-changelog
Improve event history page
This commit is contained in:
commit
99992750bb
8 changed files with 69 additions and 47 deletions
|
|
@ -9,29 +9,36 @@
|
|||
= render 'proposal'
|
||||
#history-content.tab-pane
|
||||
.col-md-12
|
||||
%table.table
|
||||
%table.table.table-striped.table-bordered.table-hover.datatable
|
||||
%thead
|
||||
%th
|
||||
%b Who
|
||||
%th
|
||||
%b Timestamp
|
||||
%th
|
||||
%b Modification Type
|
||||
%th
|
||||
%b Changes
|
||||
%th ID
|
||||
%th Description
|
||||
%th Actions
|
||||
%tbody
|
||||
- @event.versions.each do |version|
|
||||
%tr
|
||||
%td
|
||||
- unless version.whodunnit.nil?
|
||||
= User.find(version.whodunnit).name
|
||||
- else
|
||||
No user (probably via the console)
|
||||
%td
|
||||
= version.created_at
|
||||
%td
|
||||
= version.event
|
||||
%td
|
||||
- version.changeset.each_key do |key|
|
||||
= "#{key}: #{version.changeset[key][0]} -> #{version.changeset[key][1]}"
|
||||
- @versions.each do |version|
|
||||
%tr
|
||||
%td
|
||||
= version.id
|
||||
%td
|
||||
%p
|
||||
= change_creator_link(version.whodunnit)
|
||||
|
||||
- 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'
|
||||
%br
|
||||
= "(#{version.created_at.strftime('%B %-d, %Y %H:%M')})"
|
||||
|
||||
%br
|
||||
= render partial: 'shared/object_changes', locals: { version: version }
|
||||
%td
|
||||
= render partial: 'shared/changelog_actions', locals: { version: version }
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
.col-md-10.col-md-offset-1.changeset{id: "changeset-#{version.id}"}
|
||||
%br
|
||||
%br
|
||||
%table.table.table-bordered.table-hover
|
||||
%thead
|
||||
%tr
|
||||
%th Updated Attribute
|
||||
- if version.event != 'create'
|
||||
%th Previous Value
|
||||
- if version.event != 'destroy'
|
||||
%th New Value
|
||||
- if can? :revert_attribute, version
|
||||
%th Action
|
||||
%tbody
|
||||
- if version.event!= 'destroy'
|
||||
- version.changeset.reject{ |_, values| values[0].blank? && values[1].blank? }.each do |attribute, values|
|
||||
%tr
|
||||
%td= attribute
|
||||
- if version.event != 'create'
|
||||
%td= values[0].blank? ? '-' : values[0]
|
||||
%td= values[1].blank? ? '-' : values[1]
|
||||
- if can? :revert_attribute, version
|
||||
%td= link_to 'Revert', admin_revision_history_revert_attribute_path(id: version.id, attribute: attribute), class: 'btn btn-sm btn-primary', data: { confirm: "Are you sure you want to revert #{attribute}?" }
|
||||
- else
|
||||
- version.reify.attributes.each do |attribute, value|
|
||||
%tr
|
||||
%td= attribute
|
||||
%td= value.blank? ? '-' : value
|
||||
|
|
@ -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 }
|
||||
|
||||
|
|
@ -57,21 +52,7 @@
|
|||
= "(#{version.created_at.strftime('%B %-d, %Y %H:%M')})"
|
||||
|
||||
%br
|
||||
= render partial: 'object_changes', locals: { version: version }
|
||||
= render partial: 'shared/object_changes', locals: { version: version }
|
||||
|
||||
%td.col-md-2
|
||||
.btn-group{role: 'group'}
|
||||
%a.btn.btn-success.btn-sm.show-changeset{id: version.id} View Changes
|
||||
- if can? :revert_object, version
|
||||
%button.btn.btn-default.dropdown-toggle.btn-sm.btn-primary{'data-toggle' => 'dropdown', type: 'button'}
|
||||
Revert
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to 'All Changes', admin_revision_history_revert_object_path(id: version.id), data: { confirm: 'Are you sure you want to revert this change?' }
|
||||
|
||||
- if can? :revert_attribute, version
|
||||
%li.divider{role: 'separator'}
|
||||
- version.changeset.reject{ |_, values| values[0].blank? && values[1].blank? }.each do |attribute, values|
|
||||
%li= link_to attribute, admin_revision_history_revert_attribute_path(id: version.id, attribute: attribute), data: { confirm: "Are you sure you want to revert #{attribute}?" }
|
||||
- else
|
||||
%button.btn.btn-sm.btn-primary.disabled Revert
|
||||
= render partial: 'shared/changelog_actions', locals: { version: version }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue