Skip to content

Commit c76fb80

Browse files
authored
Merge pull request #2741 from DFE-Digital/AQTS-873-dev-fi-changes-to-timeline-in-cms
[AQTS-873] Timeline visual updates
2 parents 462d851 + d1c3cda commit c76fb80

File tree

5 files changed

+57
-39
lines changed

5 files changed

+57
-39
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<% failure_reasons.each do |failure_reason| %>
22
<li>
3-
<p class="govuk-body">
3+
<p class="govuk-body govuk-!-margin-bottom-0">
44
<%= t(failure_reason.key, scope: %i[assessor_interface assessment_sections failure_reasons as_statement]) %>
55
</p>
6-
7-
<%= simple_format failure_reason.assessor_feedback %>
6+
<%= simple_format failure_reason.assessor_feedback, class: "govuk-hint" %>
87
</li>
98
<% end %>

app/components/timeline_entry/component.html.erb

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,35 @@
2222
<% end %>
2323
<% elsif timeline_event.assessment_section_recorded? %>
2424
<p class="govuk-body">
25-
<%= description_vars[:section_name] %>:
2625
<%= render StatusTag::Component.new(description_vars[:status]) %>
2726
</p>
2827

29-
<% if (visible_failure_reasons = description_vars[:visible_failure_reasons]).present? %>
30-
<%= govuk_inset_text do %>
28+
<% if (failure_reasons = description_vars[:failure_reasons]).present? %>
29+
<%= govuk_details(summary_text: "View details") do %>
3130
<ul class="govuk-list--bullet">
32-
<%= render "timeline_entry/failure_reasons", failure_reasons: visible_failure_reasons %>
33-
34-
<% if (hidden_failure_reasons = description_vars[:hidden_failure_reasons]).present? %>
35-
<%= govuk_details(summary_text: "View additional reasons") do %>
36-
<%= render "timeline_entry/failure_reasons", failure_reasons: hidden_failure_reasons %>
37-
<% end %>
38-
<% end %>
31+
<%= render "timeline_entry/failure_reasons", failure_reasons: failure_reasons %>
3932
</ul>
4033
<% end %>
4134
<% end %>
4235
<% elsif timeline_event.requestable_reviewed? %>
4336
<p class="govuk-body">
44-
Status has changed to: <%= render(StatusTag::Component.new(description_vars[:new_status])) %>
37+
Status has changed to <%= render(StatusTag::Component.new(description_vars[:new_status])) %>
4538
</p>
4639

4740
<% if (note = description_vars[:note]).present? %>
48-
<%= govuk_inset_text { simple_format note } %>
41+
<%= govuk_details(summary_text: "View details") do %>
42+
<%= simple_format note, class: "govuk-hint" %>
43+
<% end %>
4944
<% end %>
5045
<% elsif timeline_event.requestable_verified? %>
5146
<p class="govuk-body">
52-
Status has changed to: <%= render(StatusTag::Component.new(description_vars[:new_status])) %>
47+
Status has changed to <%= render(StatusTag::Component.new(description_vars[:new_status])) %>
5348
</p>
5449

5550
<% if (note = description_vars[:note]).present? %>
56-
<%= govuk_inset_text { simple_format note } %>
51+
<%= govuk_details(summary_text: "View details") do %>
52+
<%= simple_format note, class: "govuk-hint" %>
53+
<% end %>
5754
<% end %>
5855
<% elsif timeline_event.information_changed? %>
5956
<p class="govuk-body">
@@ -64,7 +61,7 @@
6461

6562
<% elsif timeline_event.application_declined? %>
6663
<p class="govuk-body">
67-
Status has changed to: <%= render(StatusTag::Component.new(:declined)) %>
64+
Status has changed to <%= render(StatusTag::Component.new(:declined)) %>
6865
</p>
6966

7067
<% TeacherInterface::ApplicationFormViewObject.new(application_form: timeline_event.application_form).declined_reasons.each do |title, reasons| %>

app/components/timeline_entry/component.rb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ def title
1919
locale_key =
2020
if timeline_event.requestable_event_type?
2121
"components.timeline_entry.title.#{timeline_event.event_type}.#{timeline_event.requestable.class.name}"
22+
elsif timeline_event.assessment_section_recorded?
23+
preliminary_or_not =
24+
(
25+
if timeline_event.assessment_section.preliminary?
26+
"preliminary"
27+
else
28+
"not_preliminary"
29+
end
30+
)
31+
32+
"components.timeline_entry.title.assessment_section_recorded" \
33+
".#{preliminary_or_not}.#{timeline_event.assessment_section.key}"
2234
else
2335
"components.timeline_entry.title.#{timeline_event.event_type}"
2436
end
@@ -98,18 +110,7 @@ def assessment_section_recorded_vars
98110
{
99111
section_name: assessment_section.key.titleize,
100112
status:,
101-
visible_failure_reasons:
102-
if selected_failure_reasons.count <= 2
103-
selected_failure_reasons
104-
else
105-
selected_failure_reasons.take(1)
106-
end,
107-
hidden_failure_reasons:
108-
if selected_failure_reasons.count <= 2
109-
[]
110-
else
111-
selected_failure_reasons.drop(1)
112-
end,
113+
failure_reasons: selected_failure_reasons,
113114
}
114115
end
115116

config/locales/components.en.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,16 @@ en:
5555
action_required_by_changed: Action required by changed
5656
age_range_subjects_verified: Age range and subjects verified
5757
application_declined: Application declined
58-
assessment_section_recorded: Section assessed
58+
assessment_section_recorded:
59+
not_preliminary:
60+
age_range_subjects: Age range subjects assessed
61+
english_language_proficiency: English language proficiency assessed
62+
personal_information: Personal information assessed
63+
professional_standing: Professional standing assessed
64+
qualifications: Qualifications assessed
65+
work_history: Work history assessed
66+
preliminary:
67+
qualifications: Preliminary check (qualifications) assessed
5968
assessor_assigned: Assessor assigned
6069
email_sent: Email sent
6170
information_changed: Information changed after submission

spec/components/timeline_entry_spec.rb

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
end
103103

104104
it "describes the event" do
105-
expect(component.text).to include("Personal Information:")
105+
expect(component.text).to include("Personal information assessed")
106106
expect(component.text).to include("Rejected")
107107
expect(component.text).to include(expected_failure_reason_text)
108108
expect(component.text).to include(failure_reason.assessor_feedback)
@@ -111,6 +111,18 @@
111111
it "attributes to the creator" do
112112
expect(component.text).to include(creator.name)
113113
end
114+
115+
context "when the assessment section is preliminary" do
116+
let(:assessment_section) do
117+
create(:assessment_section, :preliminary, :failed)
118+
end
119+
120+
it "describes the event" do
121+
expect(component.text).to include(
122+
"Preliminary check (qualifications) assessed",
123+
)
124+
end
125+
end
114126
end
115127

116128
context "note created" do
@@ -422,7 +434,7 @@
422434
end
423435

424436
it "describes the event" do
425-
expect(component.text).to include("Status has changed to: Rejected")
437+
expect(component.text).to include("Status has changed to Rejected")
426438
expect(component.text).to include("For this reason.")
427439
end
428440

@@ -442,7 +454,7 @@
442454
end
443455

444456
it "describes the event" do
445-
expect(component.text).to include("Status has changed to: Accepted")
457+
expect(component.text).to include("Status has changed to Accepted")
446458
end
447459

448460
it "attributes to the creator" do
@@ -461,7 +473,7 @@
461473
end
462474

463475
it "describes the event" do
464-
expect(component.text).to include("Status has changed to: Rejected")
476+
expect(component.text).to include("Status has changed to Rejected")
465477
end
466478

467479
it "attributes to the creator" do
@@ -480,7 +492,7 @@
480492
end
481493

482494
it "describes the event" do
483-
expect(component.text).to include("Status has changed to: Accepted")
495+
expect(component.text).to include("Status has changed to Accepted")
484496
end
485497

486498
it "attributes to the creator" do
@@ -499,7 +511,7 @@
499511
end
500512

501513
it "describes the event" do
502-
expect(component.text).to include("Status has changed to: Rejected")
514+
expect(component.text).to include("Status has changed to Rejected")
503515
end
504516

505517
it "attributes to the creator" do
@@ -518,7 +530,7 @@
518530
end
519531

520532
it "describes the event" do
521-
expect(component.text).to include("Status has changed to: Accepted")
533+
expect(component.text).to include("Status has changed to Accepted")
522534
end
523535

524536
it "attributes to the creator" do
@@ -537,7 +549,7 @@
537549
end
538550

539551
it "describes the event" do
540-
expect(component.text).to include("Status has changed to: Rejected")
552+
expect(component.text).to include("Status has changed to Rejected")
541553
end
542554

543555
it "attributes to the creator" do

0 commit comments

Comments
 (0)