Skip to content

Commit

Permalink
Display the restrictions in the search results
Browse files Browse the repository at this point in the history
The prototype for the search results now displays the restrictions of
the teacher as a list.

This change introduces the design to the service.
  • Loading branch information
felixclack committed Oct 12, 2023
1 parent e48799f commit 36bb03c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
37 changes: 25 additions & 12 deletions app/views/check_records/search/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,32 @@
<%= teacher.sanctions.any? ? "Restrictions" : "No restrictions" %>
</strong>

<%
rows = [
{
key: { text: "TRN" },
value: { text: teacher.trn }
},
{
key: { text: "Date of birth" },
value: { text: Date.parse(teacher.date_of_birth).to_fs(:long_uk) }
}
]
<%= govuk_summary_list borders: false, classes: ['app-summary-list--compact'] do |summary_list|
summary_list.with_row do |row|
row.with_key { "TRN" }
row.with_value { teacher.trn }
end

summary_list.with_row do |row|
row.with_key { "Date of birth" }
row.with_value { Date.parse(teacher.date_of_birth).to_fs(:long_uk) }
end

if teacher.sanctions.any?
summary_list.with_row do |row|
row.with_key { "Restrictions" }
row.with_value do
%>
<ul class="govuk-list govuk-list--spaced govuk-!-font-size-16">
<% teacher.sanctions.each do |sanction| %>
<li><%= sanction.title %></li>
<% end %>
</ul>
<% end
end
end
end
%>
<%= render GovukComponent::SummaryListComponent.new(rows:, borders: false, classes: ['app-summary-list--compact']) %>
</div>
<% end %>
</div>
Expand Down
4 changes: 4 additions & 0 deletions spec/support/fake_qualifications_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def sanctions_data
{
code: "C2",
startDate: "2019-10-25"
},
{
code: "A1A",
startDate: "2018-9-20"
}
],
trn: "987654321"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def and_search_returns_a_restricted_record
def then_i_see_the_restriction_on_the_result
expect(page).to have_title("Search results (1) - Check a teacher’s record")
expect(page).to have_content("RESTRICTIONS")
expect(page).to have_content("Failed induction")
expect(page).to have_content("Prohibition by the General Teaching Council England (GTCE)")
end

def when_i_click_on_the_result
Expand Down

0 comments on commit 36bb03c

Please sign in to comment.