-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds the ability to show important notices, which at the moment refers to patients who have died since they were added in to the service.
- Loading branch information
1 parent
8b5b214
commit eb3203e
Showing
13 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="nhsuk-table__panel-with-heading-tab"> | ||
<h3 class="nhsuk-table__heading-tab"> | ||
<%= pluralize(deceased_patients.count, "notice") %> | ||
</h3> | ||
|
||
<%= govuk_table(html_attributes: { | ||
class: "nhsuk-table-responsive", | ||
}) do |table| %> | ||
<% table.with_head do |head| %> | ||
<% head.with_row do |row| %> | ||
<% row.with_cell(text: "Child") %> | ||
<% row.with_cell(text: "Notice") %> | ||
<% end %> | ||
<% end %> | ||
<% table.with_body do |body| %> | ||
<% deceased_patients.each do |deceased_patient| %> | ||
<% body.with_row do |row| %> | ||
<% row.with_cell do %> | ||
<span class="nhsuk-table-responsive__heading">Child</span> | ||
<%= link_to deceased_patient.full_name, patient_path(deceased_patient) %> | ||
<% end %> | ||
<% row.with_cell do %> | ||
<span class="nhsuk-table-responsive__heading">Notice</span> | ||
Record updated with child’s date of death | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class AppNoticesTableComponent < ViewComponent::Base | ||
def initialize(deceased_patients:) | ||
super | ||
|
||
@deceased_patients = deceased_patients | ||
end | ||
|
||
def render? | ||
deceased_patients.present? | ||
end | ||
|
||
private | ||
|
||
attr_reader :deceased_patients | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class NoticesController < ApplicationController | ||
layout "full" | ||
|
||
def index | ||
@deceased_patients = policy_scope(Patient).deceased | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= h1 t("notices.index.title"), size: "xl" %> | ||
<%= render AppNoticesTableComponent.new(deceased_patients: @deceased_patients) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters