From d561fd75a1b1039442a8dcc5ed02a7f1c8708b07 Mon Sep 17 00:00:00 2001 From: Chris Lowis Date: Wed, 10 Jan 2024 14:55:31 +0000 Subject: [PATCH] Replace api_users/application/index table with component This ensures the markup generated reflects the latest changes in the design system. I've decided to retain the `govuk-visually-hidden` Permissions header and to display an empty cell for the update permissions link, rather than the "Not set" default[1] when no link is required. [1] https://github.com/alphagov/govuk_publishing_components/blob/1df657ae5483552cf735396174c38eed134ba433/spec/components/table_spec.rb#L47 --- .../api_users/applications/index.html.erb | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/app/views/api_users/applications/index.html.erb b/app/views/api_users/applications/index.html.erb index e6f3d4f80..f47c20343 100644 --- a/app/views/api_users/applications/index.html.erb +++ b/app/views/api_users/applications/index.html.erb @@ -33,22 +33,18 @@ <% end %> <% end %> - - - - - - - - - - - <% @applications.each do |application| %> - - - - - - <% end %> - -
Apps <%= @api_user.name %> has access to
NameDescriptionPermissions
<%= application.name %><%= application.description %><%= update_permissions_link(application, @api_user) %>
+<%= render "govuk_publishing_components/components/table", { + caption: "Apps #{@api_user.name} has access to", + head: [ + { text: "Name" }, + { text: "Description" }, + { text: content_tag(:span, "Permissions", class: "govuk-visually-hidden") }, + ], + rows: @applications.map do |application| + [ + { text: application.name }, + { text: application.description }, + { text: update_permissions_link(application, @api_user) || "" } + ] + end, +} %>