Change look of event history page similar to changelog
This commit is contained in:
parent
86ba2d005e
commit
c80f37f3ff
4 changed files with 40 additions and 40 deletions
|
|
@ -29,7 +29,7 @@ module Admin
|
|||
flash[:error] = 'Revert failed. Attribute missing or invalid'
|
||||
end
|
||||
|
||||
redirect_to admin_revision_history_path
|
||||
redirect_back_or_to admin_revision_history_path
|
||||
end
|
||||
|
||||
def revert_object
|
||||
|
|
@ -52,7 +52,7 @@ module Admin
|
|||
flash[:error] = 'The item is already in the state that you are trying to revert it back to'
|
||||
end
|
||||
|
||||
redirect_to admin_revision_history_path
|
||||
redirect_back_or_to admin_revision_history_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,29 +9,28 @@
|
|||
= 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]}"
|
||||
- @event.versions.each do |version|
|
||||
%tr
|
||||
%td
|
||||
= version.id
|
||||
%td
|
||||
%p
|
||||
= change_creator_link(version.whodunnit)
|
||||
= event_change_description(version)
|
||||
= "event #{@event.title}"
|
||||
|
||||
%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: 'admin/versions/object_changes', locals: { version: version }
|
||||
%td
|
||||
= render partial: 'admin/versions/changelog_actions', locals: { version: version }
|
||||
15
app/views/admin/versions/_changelog_actions.haml
Normal file
15
app/views/admin/versions/_changelog_actions.haml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
.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
|
||||
|
|
@ -60,18 +60,4 @@
|
|||
= render partial: '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: 'changelog_actions', locals: { version: version }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue