Skip to content

Commit

Permalink
Merge pull request #3477 from alphagov/details-tracking
Browse files Browse the repository at this point in the history
Details component tracking
  • Loading branch information
andysellick authored Jan 8, 2024
2 parents dfabc4f + 0b35c23 commit a45d0d5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ GEM
govuk_personalisation (0.15.0)
plek (>= 1.9.0)
rails (>= 6, < 8)
govuk_publishing_components (37.1.1)
govuk_publishing_components (37.2.1)
govuk_app_config
govuk_personalisation (>= 0.7.0)
kramdown
Expand Down Expand Up @@ -286,14 +286,14 @@ GEM
multi_test (1.1.0)
multi_xml (0.6.0)
mutex_m (0.2.0)
net-imap (0.4.9)
net-imap (0.4.9.1)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
netrc (0.11.0)
nio4r (2.7.0)
Expand Down Expand Up @@ -530,7 +530,7 @@ GEM
racc
parslet (2.0.0)
plek (5.0.0)
prometheus_exporter (2.0.8)
prometheus_exporter (2.1.0)
webrick
pry (0.14.1)
coderay (~> 1.1)
Expand All @@ -541,7 +541,7 @@ GEM
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.1)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.8)
Expand Down Expand Up @@ -600,7 +600,7 @@ GEM
rdoc (6.6.2)
psych (>= 4.0.0)
regexp_parser (2.8.3)
reline (0.4.1)
reline (0.4.2)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
Expand Down
10 changes: 10 additions & 0 deletions app/presenters/organisations/index_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ def all_organisations
}
end

def organisations_with_works_with_statement
count = 0
all_organisations.each do |_organisation_type, organisations|
organisations.each do |organisation|
count += 1 if works_with_statement(organisation)
end
end
count
end

def filter_not_joining(organisations)
organisations.filter do |organisation|
organisation["govuk_status"] != "joining"
Expand Down
4 changes: 4 additions & 0 deletions app/views/organisations/_organisations_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<div class="govuk-!-margin-bottom-3">
<%= render "govuk_publishing_components/components/details", {
title: @presented_organisations.works_with_statement(organisation),
ga4_attributes: {
index_section_count: number_of_details_components,
section: organisation["title"],
},
summary_aria_attributes: {
label: "#{organisation["title"]} #{@presented_organisations.works_with_statement(organisation)}"
}
Expand Down
3 changes: 2 additions & 1 deletion app/views/organisations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

<div class="organisations" id="search_results" role="region" aria-label="List of departments, agencies and public bodies">
<%= render partial: 'organisations_list', locals: {
all_organisations: @presented_organisations.all_organisations
all_organisations: @presented_organisations.all_organisations,
number_of_details_components: @presented_organisations.organisations_with_works_with_statement,
} %>
</div>
</div>
Expand Down

0 comments on commit a45d0d5

Please sign in to comment.