Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap 5 followup: fix show views #3491

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions app/views/rails_admin/main/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
<%= fieldset.help %>
</p>
<% end %>
<dl>
<div class="list-group">
<% fields.each_with_index do |field, index| %>
<dt>
<span class="<%= field.type_css_class %> <%= field.css_class %> label label-info">
<%= field.label %>
</span>
</dt>
<dd class="well">
<%= field.pretty_value %>
</dd>
<div class="list-group-item border-0 <%= field.type_css_class %> <%= field.css_class %>">
<div class="card">
<h5 class="card-header bg-light">
<%= field.label %>
</h5>
<div class="card-body">
<%= field.pretty_value %>
</div>
</div>
</div>
<% end %>
</dl>
</div>
Expand Down
42 changes: 21 additions & 21 deletions spec/integration/actions/show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@

visit show_path(model_name: 'team', id: team.id)

is_expected.to have_selector('dt .name_field.string_type')
is_expected.to have_selector('div .name_field.string_type')
end
end

describe 'css hooks' do
it 'is present' do
visit show_path(model_name: 'team', id: team.id)

is_expected.to have_selector('dt .name_field.string_type')
is_expected.to have_selector('div .name_field.string_type')
end
end

Expand Down Expand Up @@ -225,11 +225,11 @@

visit show_path(model_name: 'team', id: team.id)

is_expected.to have_selector('.label', text: 'Name')
is_expected.to have_selector('.label', text: 'Logo url')
is_expected.to have_selector('.label', text: 'Division')
is_expected.to have_selector('.label', text: 'Manager (STRING)')
is_expected.to have_selector('.label', text: 'Ballpark (STRING)')
is_expected.to have_selector('.card-header', text: 'Name')
is_expected.to have_selector('.card-header', text: 'Logo url')
is_expected.to have_selector('.card-header', text: 'Division')
is_expected.to have_selector('.card-header', text: 'Manager (STRING)')
is_expected.to have_selector('.card-header', text: 'Ballpark (STRING)')
end
end

Expand Down Expand Up @@ -278,8 +278,8 @@

visit show_path(model_name: 'team', id: team.id)

is_expected.to have_selector('.label', text: 'Team Manager')
is_expected.to have_selector('.label', text: 'Some Fans')
is_expected.to have_selector('.card-header', text: 'Team Manager')
is_expected.to have_selector('.card-header', text: 'Some Fans')
end

it 'is renameable' do
Expand All @@ -295,9 +295,9 @@

visit show_path(model_name: 'team', id: team.id)

is_expected.to have_selector('.label', text: 'Renamed field')
is_expected.to have_selector('.label', text: 'Division')
is_expected.to have_selector('.label', text: 'Name')
is_expected.to have_selector('.card-header', text: 'Renamed field')
is_expected.to have_selector('.card-header', text: 'Division')
is_expected.to have_selector('.card-header', text: 'Name')
end

it 'is renameable by type' do
Expand All @@ -316,7 +316,7 @@
'Ballpark (STRING)', 'Mascot (STRING)', 'Founded', 'Wins', 'Losses',
'Win percentage', 'Revenue', 'Players', 'Fans'
].each do |text|
is_expected.to have_selector('.label', text: text)
is_expected.to have_selector('.card-header', text: text)
end
end

Expand All @@ -336,7 +336,7 @@
'Ballpark (STRING)', 'Mascot (STRING)', 'Founded', 'Wins', 'Losses',
'Win percentage', 'Revenue', 'Players', 'Fans'
].each do |text|
is_expected.to have_selector('.label', text: text)
is_expected.to have_selector('.card-header', text: text)
end
end

Expand Down Expand Up @@ -369,11 +369,11 @@
visit show_path(model_name: 'team', id: team.id)

['Name', 'Logo url', 'Manager', 'Ballpark', 'Mascot'].each do |text|
is_expected.not_to have_selector('.label', text: text)
is_expected.not_to have_selector('.card-header', text: text)
end

['Division', 'Founded', 'Wins', 'Losses', 'Win percentage', 'Revenue', 'Players', 'Fans'].each do |text|
is_expected.to have_selector('.label', text: text)
is_expected.to have_selector('.card-header', text: text)
end
end

Expand All @@ -389,11 +389,11 @@
visit show_path(model_name: 'team', id: team.id)

['Name', 'Logo url', 'Manager', 'Ballpark', 'Mascot'].each do |text|
is_expected.not_to have_selector('.label', text: text)
is_expected.not_to have_selector('.card-header', text: text)
end

['Division', 'Founded', 'Wins', 'Losses', 'Win percentage', 'Revenue', 'Players', 'Fans'].each do |text|
is_expected.to have_selector('.label', text: text)
is_expected.to have_selector('.card-header', text: text)
end
end
end
Expand All @@ -417,7 +417,7 @@
visit show_path(model_name: 'team', id: team.id)

is_expected.to have_selector('.truncated_name_field')
is_expected.to have_selector('dd', text: 'fo...')
is_expected.to have_selector('.card', text: 'fo...')
end
end

Expand Down Expand Up @@ -452,9 +452,9 @@

it 'overrides default_scope' do
visit show_path(model_name: 'comment~confirmed', id: comments[0].id)
is_expected.to have_selector('dd', text: 'something')
is_expected.to have_selector('.card-body', text: 'something')
visit show_path(model_name: 'comment~confirmed', id: comments[1].id)
is_expected.to have_selector('dd', text: 'anything')
is_expected.to have_selector('.card-body', text: 'anything')
end
end
end