Skip to content

Commit fe96e8f

Browse files
committed
add version history table dialog
1 parent c89ab77 commit fe96e8f

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/controllers/concerns/versionable.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module Versionable
44
def self.extended(base)
55
base.instance_eval do
66
sidebar :version_info, partial: "version_sidebar", only: :show
7-
sidebar :version_history, partial: "version_history_sidebar", only: :show
87

98
controller do
109
helper_method :versions, :create_version

app/views/active_admin/resource/_version_history_sidebar.html.arb renamed to app/views/active_admin/resource/_version_history_dialog.html.arb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
dialog id: "version_history_modal", title: I18n.t("active_admin.versionate.version_history"), class: "version_history" do
22
render "version_history"
33
end
4-
5-
button t("active_admin.view"), "javascript:void(0)", class: "button", onclick: "document.querySelector('#version_history_modal').showModal()"

app/views/active_admin/resource/_version_sidebar.html.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
<% end %>
2828
<% end %>
2929

30+
<% if [@create_version, *@versions].compact.length > 1 %>
31+
<%= render 'version_history_dialog' %>
32+
<%= link_to t("active_admin.versionate.view_history_table"), "javascript:void(0)", style: "margin-top: 10px; width: 100%; text-align: center;", class: "button", onclick: "document.querySelector('#version_history_modal').showModal()" %>
33+
<% end %>
34+
35+
3036
<% if last_version_number > 0 %>
3137
<div style="display: flex; justify-content: space-between; margin-top: 10px;">
3238
<% if params[:version].to_i > 0 || !params[:version] %>

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ en:
147147
preview: 'Preview'
148148
view: 'View'
149149
version_history: 'Version History'
150+
view_history_table: 'View History Table'
150151
shared:
151152
translated_fields: 'Translated Fields'
152153
monitor_details: 'Monitor Details'

0 commit comments

Comments
 (0)