Browse Source

Use simpler markup for table captions

pull/619/head
Paul Robert Lloyd 3 years ago committed by baarkerlounger
parent
commit
f74bb0aae1
  1. 1
      app/frontend/styles/application.scss
  2. 2
      app/views/case_logs/_log_list.html.erb
  3. 6
      app/views/organisations/_organisation_list.html.erb
  4. 6
      app/views/users/index.html.erb
  5. 2
      spec/requests/organisations_controller_spec.rb
  6. 8
      spec/requests/users_controller_spec.rb

1
app/frontend/styles/application.scss

@ -41,7 +41,6 @@ $govuk-breakpoints: (
@import "primary-navigation"; @import "primary-navigation";
@import "search"; @import "search";
@import "sub-navigation"; @import "sub-navigation";
@import "table"
// App utilities // App utilities
.app-\!-colour-muted { .app-\!-colour-muted {

2
app/views/case_logs/_log_list.html.erb

@ -1,6 +1,6 @@
<section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>"> <section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>">
<table class="govuk-table"> <table class="govuk-table">
<caption id="<%= title.dasherize %>" class="govuk-!-text-align-left govuk-!-margin-top-4 govuk-!-margin-bottom-4"> <caption id="<%= title.dasherize %>" class="govuk-!-font-size-19 govuk-!-font-weight-regular">
<span class="govuk-!-margin-right-4"> <span class="govuk-!-margin-right-4">
<strong><%= pagy.count %></strong> total <%= title.downcase %> <strong><%= pagy.count %></strong> total <%= title.downcase %>
</span> </span>

6
app/views/organisations/_organisation_list.html.erb

@ -1,10 +1,8 @@
<% content_for :title, title %> <% content_for :title, title %>
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<%= table.caption(size: "s", classes: %w[govuk-!-text-align-left govuk-!-margin-top-4 govuk-!-margin-bottom-4]) do |caption| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
<span class="govuk-!-margin-right-4"> <strong><%= @pagy.count %></strong> total <%= title.downcase %>.
<strong><%= @pagy.count %></strong><span style="font-weight: normal"> total <%= title.downcase %></span>
</span>
<% end %> <% end %>
<%= table.head do |head| %> <%= table.head do |head| %>
<%= head.row do |row| %> <%= head.row do |row| %>

6
app/views/users/index.html.erb

@ -11,12 +11,12 @@
<%= render SearchComponent.new(current_user:, label: "Search by name or email address") %> <%= render SearchComponent.new(current_user:, label: "Search by name or email address") %>
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<%= table.caption(classes: %w[app-table__caption]) do |caption| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
<span class="govuk-!-margin-right-4"> <span class="govuk-!-margin-right-4">
<% if @searched %> <% if @searched %>
<strong>Matches <%= @pagy.count %> of <%= User.count %> total users</strong> Matches <strong><%= @pagy.count %></strong> of <strong><%= User.count %></strong> total users.
<% else %> <% else %>
<strong><%= @pagy.count %></strong> total users <strong><%= @pagy.count %></strong> total users.
<% end %> <% end %>
</span> </span>
<% if current_user.support? %> <% if current_user.support? %>

2
spec/requests/organisations_controller_spec.rb

@ -460,7 +460,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "shows the total organisations count" do it "shows the total organisations count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{total_organisations_count}</strong><span style=\"font-weight: normal\"> total organisations</span>") expect(CGI.unescape_html(response.body)).to match("<strong>#{total_organisations_count}</strong> total organisations.")
end end
it "has pagination links" do it "has pagination links" do

8
spec/requests/users_controller_spec.rb

@ -381,7 +381,7 @@ RSpec.describe UsersController, type: :request do
end end
it "updates the table caption" do it "updates the table caption" do
expect(page).to have_content("Matches 1 of 5 total users") expect(page).to have_content("Matches 1 of 5 total users.")
end end
end end
@ -417,7 +417,7 @@ RSpec.describe UsersController, type: :request do
end end
it "updates the table caption" do it "updates the table caption" do
expect(page).to have_content("Matches 2 of 5 total users") expect(page).to have_content("Matches 2 of 5 total users.")
end end
end end
end end
@ -842,7 +842,7 @@ RSpec.describe UsersController, type: :request do
end end
it "updates the table caption" do it "updates the table caption" do
expect(page).to have_content("Matches 1 of 4 total users") expect(page).to have_content("Matches 1 of 4 total users.")
end end
end end
@ -881,7 +881,7 @@ RSpec.describe UsersController, type: :request do
end end
it "updates the table caption" do it "updates the table caption" do
expect(page).to have_content("Matches 2 of 4 total users") expect(page).to have_content("Matches 2 of 4 total users.")
end end
end end
end end

Loading…
Cancel
Save