Skip to content

Commit

Permalink
Use GOV.UK Design System task list
Browse files Browse the repository at this point in the history
This upgrades our task lists to use the new one that is included as
part of the GOV.UK Design System.
  • Loading branch information
thomasleese committed Apr 25, 2024
1 parent a6b2af1 commit 3a4cedc
Show file tree
Hide file tree
Showing 42 changed files with 305 additions and 478 deletions.
70 changes: 0 additions & 70 deletions app/assets/stylesheets/_task_list.scss

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ $moj-images-path: "/";
@import "_environments";
@import "_search_results";
@import "_support";
@import "_task_list";

ul.autocomplete__menu {
li {
Expand Down
33 changes: 0 additions & 33 deletions app/components/task_list/component.html.erb

This file was deleted.

42 changes: 0 additions & 42 deletions app/components/task_list/component.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def check_consent_method_task_item
consent_requests.exists? || qualification_requests.requested.exists?

{
name: "Check and select consent method",
link:
title: "Check and select consent method",
href:
unless cannot_change
[
(
Expand Down Expand Up @@ -100,8 +100,8 @@ def generate_consent_document_in_all_qualifications?

def generate_consent_document_task_item
{
name: "Generate consent document",
link: [
title: "Generate consent document",
href: [
:unsigned_consent_document,
:assessor_interface,
application_form,
Expand Down Expand Up @@ -133,9 +133,9 @@ def send_consent_document_task_item
all_consents_requested = consent_requests.all?(&:requested?)

{
name:
title:
"Send consent #{"document".pluralize(consent_requests.count)} to applicant",
link:
href:
if all_documents_completed && !all_consents_requested
[
:request,
Expand All @@ -162,8 +162,8 @@ def signed_consent_method_task_items(qualification_request)

[
{
name: "Upload consent document",
link:
title: "Upload consent document",
href:
if consent_request.nil?
Rails
.application
Expand All @@ -190,8 +190,8 @@ def signed_consent_method_task_items(qualification_request)
send_consent_document_task_item
end,
{
name: "Record applicant response",
link:
title: "Record applicant response",
href:
if consent_request&.requested?
[
:verify,
Expand Down Expand Up @@ -239,8 +239,8 @@ def ecctis_task_items(qualification_request)

[
{
name: "Request Ecctis verification",
link:
title: "Request Ecctis verification",
href:
if can_start && !qualification_request.requested?
[
:request,
Expand All @@ -260,8 +260,8 @@ def ecctis_task_items(qualification_request)
end,
},
{
name: "Record Ecctis response",
link:
title: "Record Ecctis response",
href:
if qualification_request.requested?
[
:verify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,23 @@ def further_information_request
.find(params[:id])
end

def task_list_sections
items =
further_information_request
.items
.order(:created_at)
.map do |item|
{
name: item_name(item),
link: [
:edit,
:teacher_interface,
:application_form,
further_information_request,
item,
],
status: item.status,
}
end

[{ title: "Further information requested", items: }]
def task_list_items
further_information_request
.items
.order(:created_at)
.map do |item|
{
title: item_name(item),
href: [
:edit,
:teacher_interface,
:application_form,
further_information_request,
item,
],
status: item.status,
}
end
end

def can_check_answers?
Expand Down
12 changes: 11 additions & 1 deletion app/views/assessor_interface/application_forms/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@

<h2 class="govuk-heading-l govuk-!-margin-top-9">Task list</h2>

<%= render(TaskList::Component.new(@view_object.task_list_sections)) %>
<% @view_object.task_list_sections.each do |section| %>
<% if (items = section[:items]).present? %>
<h3 class="govuk-heading-m"><%= section[:title] %></h3>

<%= govuk_task_list(id_prefix: section[:title].parameterize) do |task_list|
items.each do |item|
task_list.with_item(title: item[:name], href: item[:link], status: render(StatusTag::Component.new(item[:status])))
end
end %>
<% end %>
<% end %>
74 changes: 34 additions & 40 deletions app/views/assessor_interface/assessments/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,49 @@
<% if @professional_standing_request.present? %>
<h2 class="govuk-heading-m">LoPS</h2>

<%= render(TaskList::Component.new([{
indentation: false,
items: [
{
name: region_teaching_authority_name(@application_form.region, context: :assessor).upcase_first,
link: [:review, :assessor_interface, @application_form, @assessment, :professional_standing_request],
status: @professional_standing_request.review_status,
}
],
}])) %>
<%= govuk_task_list(id_prefix: "lops") do |task_list|
task_list.with_item(
title: region_teaching_authority_name(@application_form.region, context: :assessor).upcase_first,
href: [:review, :assessor_interface, @application_form, @assessment, :professional_standing_request],
status: render(StatusTag::Component.new(@professional_standing_request.review_status)),
)
end %>
<% end %>


<% if @consent_requests.present? || @qualification_requests.present? %>
<h2 class="govuk-heading-m">Qualifications</h2>

<%= render(TaskList::Component.new([{
indentation: false,
items: @consent_requests.map do |consent_request|
{
name: qualification_title(consent_request.qualification),
link: [:review, :assessor_interface, @application_form, @assessment, consent_request],
status: consent_request.review_status,
}
end + @qualification_requests.map do |qualification_request|
{
name: qualification_title(qualification_request.qualification),
link: [:review, :assessor_interface, @application_form, @assessment, qualification_request],
status: qualification_request.review_status,
}
end
}])) %>
<%= govuk_task_list(id_prefix: "qualifications") do |task_list|
@consent_requests.each do |consent_request|
task_list.with_item(
title: qualification_title(consent_request.qualification),
href: [:review, :assessor_interface, @application_form, @assessment, consent_request],
status: render(StatusTag::Component.new(consent_request.review_status)),
)
end

@qualification_requests.each do |qualification_request|
task_list.with_item(
title: qualification_title(qualification_request.qualification),
href: [:review, :assessor_interface, @application_form, @assessment, qualification_request],
status: render(StatusTag::Component.new(qualification_request.review_status)),
)
end
end %>
<% end %>

<% if @reference_requests.present? %>
<h2 class="govuk-heading-m">References</h2>

<%= render(TaskList::Component.new([{
indentation: false,
items: @reference_requests.map do |reference_request|
{
name: work_history_name(reference_request.work_history),
link: [:review, :assessor_interface, @application_form, @assessment, reference_request],
status: reference_request.review_status,
}
end
}])) %>
<%= govuk_task_list(id_prefix: "references") do |task_list|
@reference_requests.each do |reference_request|
task_list.with_item(
title: work_history_name(reference_request.work_history),
href: [:review, :assessor_interface, @application_form, @assessment, reference_request],
status: render(StatusTag::Component.new(reference_request.review_status)),
)
end
end %>
<% end %>

<div class="govuk-!-padding-top-3">
<%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %>
</div>
<%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %>
Loading

0 comments on commit 3a4cedc

Please sign in to comment.