Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
feat: add paper_trail system test and styling
Browse files Browse the repository at this point in the history
Papertrail system test and styling
  • Loading branch information
LindseySaari authored Feb 16, 2022
2 parents 1853e45 + 9ff0072 commit e0f130b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
22 changes: 9 additions & 13 deletions app/views/audits/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,15 @@
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<%= audit.created_at %>
</td>
<td class="max-w-7xl text-sm font-medium text-gray-900">
<% if audit.object.present? %>
<div data-controller="toggle" data-toggle-hidden-class="hidden">
<%= button_tag "Show/Hide", data: {controller: "toggle", action: "click->toggle#toggleTargets", class: "hidden" } do %>
<div data-toggle-target="item" class="hidden text-left">
<span style="float:left;" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-900 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">Hide Details</span>
<br/><br/>
<span><%= audit.object %></span>
</div>
<div data-toggle-target="item" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-900 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">Details</div>
<% end %>
</div>
<% end %>
<td class="px-6 py-4 max-w-7xl text-sm font-medium text-gray-900">
<% if audit.object.present? %>
<div data-controller="toggle">
<button data-toggle-target="item" data-action="click->toggle#toggleTargets" data-toggle-target="sidebar-1" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-900 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" id="show-button">Show</button>
<button data-toggle-target="item" data-action="click->toggle#toggleTargets" data-toggle-target="sidebar-1" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-900 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 hidden">Hide</button>
<br/><br/>
<span data-toggle-target="item" class="hidden text-left"><%= audit.object %></span>
</div>
<% end %>
</td>
</tr>
<% end %>
Expand Down
20 changes: 10 additions & 10 deletions test/system/audits_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
class AuditsTest < ApplicationSystemTestCase
setup do
login_as :john
apps(:one)
teams(:one)

(1..3).each do |t|
new_app = apps(:one).dup
new_app.name = "App #{t}"
new_app.save
app = App.first
app.name = 'App name update'
app.save

new_team = teams(:one).dup
new_team.name = "Team #{t}"
new_team.save
end
team = Team.first
team.name = 'Team name update'
team.save
end

test 'visiting the index' do
Expand All @@ -25,7 +25,7 @@ class AuditsTest < ApplicationSystemTestCase
assert_selector 'td', text: 'Team'
assert_selector 'div', text: 'DETAILS'

# click_on 'DETAILS', match: :first
# assert_selector 'span', text: 'Hide Details'
click_on 'Show', match: :first
assert_selector 'button', text: 'Hide'
end
end

0 comments on commit e0f130b

Please sign in to comment.