<% title = "Applications" title = "This application" unless ENV["MAIN_COMPONENT_GUIDE"] %> <%= render "govuk_publishing_components/components/heading", { text: title, font_size: "l", margin_bottom: 6 } %> <% if @applications.any? %> <%= render "govuk_publishing_components/components/details", { title: "How to use this information" } do %>

This page shows information about component use on GOV.UK. This information has been cross referenced with the components in the gem to produce warnings where e.g. a print stylesheet for a component exists but has not been included in an application.

Warnings should be investigated, although there may be a reason why the application has been configured as it is. Note that 'code' can refer to templates or ruby code.

<% end %> <% accordion_content = nil summary = nil %> <% application_items = @applications.map do |application| %> <% summary = 'Application not found' if application[:application_found] summary = "Warnings: 0" summary = "Warnings: #{application[:warning_count]}" if application[:warning_count] > 0 end %> <% accordion_content = capture do %> <% if application[:application_found] %> <% application[:warnings].each do |warning| %>

Warn <%= warning[:component] %> - <%= warning[:message] %>

<% end %> <%= render "govuk_publishing_components/components/heading", { text: "Components used", font_size: "m", margin_bottom: 4, heading_level: 3, } %>
<% application[:summary].each do |item| %>
<%= item[:name] %>
<% if item[:value].length > 0 %> <%= item[:value] %> <% else %> None <% end %>
<% end %>
<% if application[:gem_style_references].any? %> <%= render "govuk_publishing_components/components/heading", { text: "Component references", font_size: "m", margin_bottom: 4, heading_level: 3, } %>

This shows instances of `gem-c-` classes found in the application. If a reference is found in a stylesheet or in code a warning is created, as this could be a style override or hard coded component markup.

<% end %> <% if application[:jquery_references].any? %> <%= render "govuk_publishing_components/components/heading", { text: "jQuery references", font_size: "m", margin_bottom: 4, heading_level: 3, } %>

This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.

<% end %> <% else %>

This application was not found. This could be because you do not have this repository checked out locally.

<% end %> <% end %> <% { heading: { text: application[:name] }, summary: { text: sanitize(summary) }, content: { html: sanitize(accordion_content) }, } %> <% end %> <% if ENV["MAIN_COMPONENT_GUIDE"] %> <%= render "govuk_publishing_components/components/accordion", { items: application_items } %> <% else %>

<%= sanitize(summary) %>

<%= accordion_content %> <% end %> <% else %>

No applications found.

<% end %>