127 changed files with 3118 additions and 1433 deletions
@ -0,0 +1,24 @@
|
||||
--- |
||||
EnableDefaultLinters: true |
||||
linters: |
||||
Rubocop: |
||||
enabled: true |
||||
rubocop_config: |
||||
inherit_from: |
||||
- .rubocop.yml |
||||
Layout/ArgumentAlignment: |
||||
Enabled: false |
||||
Layout/CommentIndentation: |
||||
Enabled: false |
||||
Layout/FirstArgumentIndentation: |
||||
Enabled: false |
||||
Layout/FirstArrayElementIndentation: |
||||
Enabled: false |
||||
Layout/FirstHashElementIndentation: |
||||
Enabled: false |
||||
Layout/InitialIndentation: |
||||
Enabled: false |
||||
Layout/TrailingEmptyLines: |
||||
Enabled: false |
||||
Lint/UselessAssignment: |
||||
Enabled: false |
@ -0,0 +1,15 @@
|
||||
<ul class="app-document-list"> |
||||
<% items.each do |item| %> |
||||
<li class="app-document-list__item"> |
||||
<h3 class="app-document-list__item-title"> |
||||
<%= govuk_link_to item[:name], item[:href] %> |
||||
</h3> |
||||
<% if item[:description] %> |
||||
<p class="app-document-list__item-description"><%= item[:description] %></p> |
||||
<% end %> |
||||
<% if item[:metadata] %> |
||||
<p class="app-document-list__item-metadata"><%= item[:metadata] %></p> |
||||
<% end %> |
||||
</li> |
||||
<% end %> |
||||
</ul> |
@ -0,0 +1,8 @@
|
||||
class DocumentListComponent < ViewComponent::Base |
||||
attr_reader :items |
||||
|
||||
def initialize(items:) |
||||
@items = items |
||||
super |
||||
end |
||||
end |
@ -0,0 +1,17 @@
|
||||
<nav class="app-primary-navigation" aria-label="primary"> |
||||
<div class="govuk-width-container"> |
||||
<ul class="app-primary-navigation__list"> |
||||
<% items.each do |item| %> |
||||
<% if item.fetch(:current, false) || current_page?(item.fetch(:url)) || current_page?("#{item.fetch(:url)}/details") %> |
||||
<li class="app-primary-navigation__item app-primary-navigation__item--current"> |
||||
<%= govuk_link_to item[:name], item[:url], class: "app-primary-navigation__link", aria: { current: "page" } %> |
||||
</li> |
||||
<% else %> |
||||
<li class="app-primary-navigation__item"> |
||||
<%= govuk_link_to item[:name], item[:url], class: "app-primary-navigation__link" %> |
||||
</li> |
||||
<% end %> |
||||
<% end %> |
||||
</ul> |
||||
</div> |
||||
</nav> |
@ -0,0 +1,8 @@
|
||||
class PrimaryNavigationComponent < ViewComponent::Base |
||||
attr_reader :items |
||||
|
||||
def initialize(items:) |
||||
@items = items |
||||
super |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
<nav class="app-tab-navigation" aria-label="sub menu"> |
||||
<ul class="app-tab-navigation__list"> |
||||
<% items.each do |item| %> |
||||
<% if item.fetch(:current, false) || current_page?(strip_query(item.fetch(:url))) %> |
||||
<li class="app-tab-navigation__item app-tab-navigation__item--current"> |
||||
<%= govuk_link_to item[:name], item[:url], class: 'app-tab-navigation__link', aria: { current: 'page' } %> |
||||
</li> |
||||
<% else %> |
||||
<li class="app-tab-navigation__item"> |
||||
<%= govuk_link_to item[:name], item[:url], class: 'app-tab-navigation__link' %> |
||||
</li> |
||||
<% end %> |
||||
<% end %> |
||||
</ul> |
||||
</nav> |
@ -1,14 +0,0 @@
|
||||
class TabNavigationComponent < ViewComponent::Base |
||||
attr_reader :items |
||||
|
||||
def initialize(items:) |
||||
@items = items |
||||
super |
||||
end |
||||
|
||||
def strip_query(url) |
||||
url = Addressable::URI.parse(url) |
||||
url.query_values = nil |
||||
url.to_s |
||||
end |
||||
end |
@ -1,16 +0,0 @@
|
||||
import { Controller } from "@hotwired/stimulus"; |
||||
|
||||
export default class extends Controller { |
||||
toggleFilter() { |
||||
let filter_panel = document.getElementById("filter-panel"); |
||||
let toggle_filter_button = document.getElementById("toggle-filter-button"); |
||||
|
||||
if (filter_panel.style.display === "none" || !filter_panel.style.display) { |
||||
filter_panel.style.display = "block"; |
||||
toggle_filter_button.innerText = "Hide filters"; |
||||
} else { |
||||
filter_panel.style.display = "none"; |
||||
toggle_filter_button.innerText = "Show filters"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
import { Controller } from "@hotwired/stimulus"; |
||||
import { FilterToggle } from "../modules/filter_toggle.js" |
||||
|
||||
export default class extends Controller { |
||||
connect() { |
||||
const filterToggle = new FilterToggle({ |
||||
bigModeMediaQuery: '(min-width: 48.0625em)', |
||||
closeButton: { |
||||
container: this.element.querySelector('.app-filter__header'), |
||||
text: 'Close' |
||||
}, |
||||
filter: { |
||||
container: this.element.querySelector('.app-filter-layout__filter') |
||||
}, |
||||
startHidden: false, |
||||
toggleButton: { |
||||
container: this.element.querySelector('.app-filter-toggle'), |
||||
showText: 'Show filters', |
||||
hideText: 'Hide filters', |
||||
classes: 'govuk-button--secondary' |
||||
} |
||||
}) |
||||
|
||||
filterToggle.init() |
||||
} |
||||
} |
@ -0,0 +1,112 @@
|
||||
export class FilterToggle { |
||||
constructor (options) { |
||||
this.options = options |
||||
this.container = this.options.toggleButton.container |
||||
} |
||||
|
||||
setupResponsiveChecks () { |
||||
this.mq = window.matchMedia(this.options.bigModeMediaQuery) |
||||
this.mq.addListener(this.checkMode.bind(this)) |
||||
this.checkMode(this.mq) |
||||
} |
||||
|
||||
checkMode (mq) { |
||||
if (mq.matches) { |
||||
this.enableBigMode() |
||||
} else { |
||||
this.enableSmallMode() |
||||
} |
||||
} |
||||
|
||||
enableBigMode () { |
||||
this.showMenu() |
||||
this.removeMenuButton() |
||||
this.removeCloseButton() |
||||
} |
||||
|
||||
enableSmallMode () { |
||||
this.options.filter.container.setAttribute("tabindex", "-1") |
||||
this.hideMenu() |
||||
this.addMenuButton() |
||||
this.addCloseButton() |
||||
} |
||||
|
||||
addCloseButton () { |
||||
if (this.options.closeButton) { |
||||
this.closeButton = document.createElement("button") |
||||
this.closeButton.classList.add("app-filter__close") |
||||
this.closeButton.innerText = this.options.closeButton.text |
||||
this.closeButton.type = 'button' |
||||
this.closeButton.addEventListener('click', this.onCloseClick.bind(this)) |
||||
|
||||
this.options.closeButton.container.append(this.closeButton) |
||||
} |
||||
} |
||||
|
||||
onCloseClick () { |
||||
this.hideMenu() |
||||
this.menuButton.focus() |
||||
} |
||||
|
||||
removeCloseButton () { |
||||
if (this.closeButton) { |
||||
this.closeButton.remove() |
||||
this.closeButton = null |
||||
} |
||||
} |
||||
|
||||
addMenuButton () { |
||||
this.menuButton = document.createElement("button") |
||||
this.menuButton.setAttribute("aria-expanded", "false") |
||||
this.menuButton.setAttribute("aria-has-popup", "true") |
||||
this.menuButton.classList.add("govuk-button", this.options.toggleButton.classes, "app-filter-toggle__button") |
||||
this.menuButton.innerText = this.options.toggleButton.showText |
||||
this.menuButton.type = "button" |
||||
this.menuButton.addEventListener("click", this.onMenuButtonClick.bind(this)) |
||||
|
||||
this.options.toggleButton.container.prepend(this.menuButton) |
||||
} |
||||
|
||||
removeMenuButton () { |
||||
if (this.menuButton) { |
||||
this.menuButton.remove() |
||||
this.menuButton = null |
||||
} |
||||
} |
||||
|
||||
hideMenu () { |
||||
if (this.menuButton) { |
||||
this.menuButton.setAttribute("aria-expanded", "false") |
||||
this.menuButton.innerText = this.options.toggleButton.showText |
||||
} |
||||
this.options.filter.container.setAttribute("hidden", true) |
||||
} |
||||
|
||||
showMenu () { |
||||
if (this.menuButton) { |
||||
this.menuButton.setAttribute("aria-expanded", "true") |
||||
this.menuButton.innerText = this.options.toggleButton.hideText |
||||
} |
||||
this.options.filter.container.removeAttribute("hidden") |
||||
} |
||||
|
||||
onMenuButtonClick () { |
||||
this.toggle() |
||||
} |
||||
|
||||
toggle () { |
||||
if (this.options.filter.container.hidden) { |
||||
this.showMenu() |
||||
this.options.filter.container.focus() |
||||
} else { |
||||
this.hideMenu() |
||||
} |
||||
} |
||||
|
||||
init () { |
||||
this.setupResponsiveChecks() |
||||
if (this.options.startHidden) { |
||||
this.hideMenu() |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,7 @@
|
||||
.app-card { |
||||
@include govuk-responsive-padding(4); |
||||
@include govuk-font($size: 19); |
||||
background-color: govuk-colour("light-grey"); |
||||
display: block; |
||||
position: relative; |
||||
} |
@ -0,0 +1,66 @@
|
||||
.app-document-list { |
||||
list-style: none; |
||||
padding: 0; |
||||
} |
||||
|
||||
.app-document-list__item { |
||||
margin-bottom: govuk-spacing(4); |
||||
|
||||
&:last-child { |
||||
border-bottom: 0; |
||||
margin-bottom: 0; |
||||
padding-bottom: 0; |
||||
} |
||||
} |
||||
|
||||
.app-document-list__item-title { |
||||
@include govuk-font($size: 16, $weight: "bold"); |
||||
margin: 0 0 govuk-spacing(1); |
||||
} |
||||
|
||||
.app-document-list__item-metadata { |
||||
padding: 0; |
||||
margin: 0; |
||||
} |
||||
|
||||
.app-document-list__item-description { |
||||
@include govuk-font($size: 16); |
||||
margin: govuk-spacing(1) 0; |
||||
} |
||||
|
||||
.app-document-list__item-metadata { |
||||
@include govuk-font($size: 16); |
||||
color: $govuk-secondary-text-colour; |
||||
margin: 0; |
||||
} |
||||
.app-document-list { |
||||
list-style: none; |
||||
padding: 0; |
||||
} |
||||
|
||||
.app-document-list__item { |
||||
margin-bottom: govuk-spacing(4); |
||||
|
||||
&:last-child { |
||||
border-bottom: 0; |
||||
margin-bottom: 0; |
||||
padding-bottom: 0; |
||||
} |
||||
} |
||||
|
||||
.app-document-list__item-title { |
||||
@include govuk-font($size: 16, $weight: "bold"); |
||||
margin: 0 0 govuk-spacing(1); |
||||
} |
||||
|
||||
.app-document-list__item-description { |
||||
@include govuk-font($size: 16); |
||||
margin: govuk-spacing(1) 0; |
||||
} |
||||
|
||||
.app-document-list__item-metadata { |
||||
@include govuk-font($size: 16); |
||||
color: $govuk-secondary-text-colour; |
||||
padding: 0; |
||||
margin: 0; |
||||
} |
@ -0,0 +1,42 @@
|
||||
.app-filter-layout { |
||||
@include govuk-clearfix; |
||||
} |
||||
|
||||
.app-filter-layout__filter { |
||||
@include govuk-media-query(desktop) { |
||||
float: left; |
||||
min-width: govuk-grid-width("one-quarter"); |
||||
} |
||||
} |
||||
|
||||
.js-enabled .app-filter-layout__filter { |
||||
outline: 0 none; |
||||
|
||||
@include govuk-media-query($until: desktop) { |
||||
background-color: govuk-colour("light-grey"); |
||||
bottom: govuk-spacing(1); |
||||
border: 1px solid govuk-colour("mid-grey"); |
||||
max-width: 310px; |
||||
min-width: 260px; |
||||
width: 100%; |
||||
overflow-y: scroll; |
||||
position: fixed; |
||||
right: govuk-spacing(1); |
||||
top: govuk-spacing(1); |
||||
z-index: 100; |
||||
|
||||
&:focus { |
||||
outline: $govuk-focus-width solid $govuk-focus-colour; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.app-filter-layout__content { |
||||
@include govuk-media-query(desktop) { |
||||
float: right; |
||||
max-width: calc( |
||||
#{govuk-grid-width("three-quarters")} - #{govuk-spacing(6)} |
||||
); |
||||
width: 100%; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
.app-header { |
||||
border-bottom: govuk-spacing(2) solid $govuk-brand-colour; |
||||
|
||||
.govuk-header__logo { |
||||
@include govuk-media-query($from: desktop) { |
||||
width: 60%; |
||||
} |
||||
|
||||
@include govuk-media-query($from: 860px) { |
||||
width: 75%; |
||||
} |
||||
} |
||||
|
||||
.govuk-header__content { |
||||
@include govuk-media-query($from: desktop) { |
||||
width: 40%; |
||||
} |
||||
|
||||
@include govuk-media-query($from: 860px) { |
||||
width: 25%; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,69 @@
|
||||
.app-primary-navigation { |
||||
@include govuk-font(19, $weight: bold); |
||||
background-color: govuk-colour("light-grey"); |
||||
border-bottom: 1px solid $govuk-border-colour; |
||||
} |
||||
|
||||
.govuk-phase-banner + .app-primary-navigation { |
||||
margin-top: -1px; |
||||
} |
||||
|
||||
.app-primary-navigation__list { |
||||
@include govuk-clearfix; |
||||
left: govuk-spacing(-3); |
||||
list-style: none; |
||||
margin: 0; |
||||
padding: 0; |
||||
position: relative; |
||||
right: govuk-spacing(-3); |
||||
width: calc(100% + #{govuk-spacing(6)}); |
||||
} |
||||
|
||||
.app-primary-navigation__item { |
||||
box-sizing: border-box; |
||||
display: block; |
||||
float: left; |
||||
line-height: 50px; |
||||
height: 50px; |
||||
padding: 0 govuk-spacing(3); |
||||
position: relative; |
||||
} |
||||
|
||||
.app-primary-navigation__item--current { |
||||
border-bottom: $govuk-border-width-narrow solid $govuk-link-colour; |
||||
|
||||
&:hover { |
||||
border-bottom-color: $govuk-link-hover-colour; |
||||
} |
||||
|
||||
&:active { |
||||
border-bottom-color: $govuk-link-active-colour; |
||||
} |
||||
} |
||||
|
||||
.app-primary-navigation__item--align-right { |
||||
@include govuk-media-query($from: tablet) { |
||||
float: right; |
||||
} |
||||
} |
||||
|
||||
.app-primary-navigation__link { |
||||
@include govuk-link-common; |
||||
@include govuk-link-style-no-visited-state; |
||||
@include govuk-link-style-no-underline; |
||||
@include govuk-typography-weight-bold; |
||||
|
||||
// Extend the touch area of the link to the list |
||||
&:after { |
||||
bottom: 0; |
||||
content: ""; |
||||
left: 0; |
||||
position: absolute; |
||||
right: 0; |
||||
top: 0; |
||||
} |
||||
} |
||||
|
||||
.app-primary-navigation__item--current .app-primary-navigation__link:hover { |
||||
text-decoration: none; |
||||
} |
@ -1,76 +0,0 @@
|
||||
.app-tab-navigation { |
||||
@include govuk-font(19, $weight: bold); |
||||
@include govuk-responsive-margin(6, "bottom"); |
||||
} |
||||
|
||||
.app-tab-navigation__list { |
||||
@include govuk-clearfix; |
||||
left: govuk-spacing(-3); |
||||
list-style: none; |
||||
margin: 0; |
||||
padding: 0; |
||||
position: relative; |
||||
right: govuk-spacing(-3); |
||||
width: calc(100% + #{govuk-spacing(6)}); |
||||
|
||||
@include govuk-media-query($from: tablet) { |
||||
box-shadow: inset 0 -1px 0 $govuk-border-colour; |
||||
} |
||||
} |
||||
|
||||
.app-tab-navigation__item { |
||||
box-sizing: border-box; |
||||
display: block; |
||||
line-height: 40px; |
||||
height: 40px; |
||||
padding: 0 govuk-spacing(3); |
||||
|
||||
@include govuk-media-query($from: tablet) { |
||||
box-shadow: none; |
||||
display: block; |
||||
float: left; |
||||
line-height: 50px; |
||||
height: 50px; |
||||
padding: 0 govuk-spacing(3); |
||||
position: relative; |
||||
} |
||||
} |
||||
|
||||
.app-tab-navigation__item--current { |
||||
@include govuk-media-query($until: tablet) { |
||||
border-left: 4px solid $govuk-link-colour; |
||||
padding-left: 11px; |
||||
} |
||||
|
||||
@include govuk-media-query($from: tablet) { |
||||
border-bottom: 4px solid $govuk-link-colour; |
||||
padding-left: govuk-spacing(3); |
||||
} |
||||
} |
||||
|
||||
.app-tab-navigation__link { |
||||
@include govuk-link-common; |
||||
@include govuk-link-style-no-visited-state; |
||||
@include govuk-link-style-no-underline; |
||||
@include govuk-typography-weight-bold; |
||||
|
||||
&:not(:focus):hover { |
||||
color: $govuk-link-colour; |
||||
} |
||||
|
||||
// Extend the touch area of the link to the list |
||||
&:after { |
||||
bottom: 0; |
||||
content: ""; |
||||
left: 0; |
||||
position: absolute; |
||||
right: 0; |
||||
top: 0; |
||||
} |
||||
} |
||||
|
||||
.app-tab-navigation__item--current .app-tab-navigation__link { |
||||
&:hover { |
||||
text-decoration: none; |
||||
} |
||||
} |
@ -0,0 +1,392 @@
|
||||
module Imports |
||||
class CaseLogsImportService < ImportService |
||||
def create_logs(folder) |
||||
import_from(folder, :create_log) |
||||
end |
||||
|
||||
private |
||||
|
||||
GN_SH = { |
||||
general_needs: 1, |
||||
supported_housing: 2, |
||||
}.freeze |
||||
|
||||
SR_AR_IR = { |
||||
social_rent: 1, |
||||
affordable_rent: 2, |
||||
intermediate_rent: 3, |
||||
}.freeze |
||||
|
||||
# For providertype, values are reversed!!! |
||||
PRP_LA = { |
||||
private_registered_provider: 1, |
||||
local_authority: 2, |
||||
}.freeze |
||||
|
||||
IRPRODUCT = { |
||||
rent_to_buy: 1, |
||||
london_living_rent: 2, |
||||
other_intermediate_rent_product: 3, |
||||
}.freeze |
||||
|
||||
# These must match our form |
||||
RENT_TYPE = { |
||||
social_rent: 0, |
||||
affordable_rent: 1, |
||||
london_affordable_rent: 2, |
||||
rent_to_buy: 3, |
||||
london_living_rent: 4, |
||||
other_intermediate_rent_product: 5, |
||||
}.freeze |
||||
|
||||
def create_log(xml_doc) |
||||
attributes = {} |
||||
|
||||
# Required fields for status complete or logic to work |
||||
# Note: order matters when we derive from previous values (attributes parameter) |
||||
attributes["startdate"] = compose_date(xml_doc, "DAY", "MONTH", "YEAR") |
||||
attributes["owning_organisation_id"] = find_organisation_id(xml_doc, "OWNINGORGID", "OWNINGORGNAME", "HCNUM") |
||||
attributes["managing_organisation_id"] = find_organisation_id(xml_doc, "MANINGORGID", "MANINGORGNAME", "MANHCNUM") |
||||
attributes["startertenancy"] = unsafe_string_as_integer(xml_doc, "_2a") |
||||
attributes["tenancy"] = unsafe_string_as_integer(xml_doc, "Q2b") |
||||
attributes["tenancyother"] = string_or_nil(xml_doc, "Q2ba") |
||||
attributes["tenancylength"] = safe_string_as_integer(xml_doc, "_2cYears") |
||||
attributes["needstype"] = needs_type(xml_doc) |
||||
attributes["lar"] = london_affordable_rent(xml_doc) |
||||
attributes["irproduct"] = unsafe_string_as_integer(xml_doc, "IRProduct") |
||||
attributes["irproduct_other"] = string_or_nil(xml_doc, "IRProductOther") |
||||
attributes["rent_type"] = rent_type(xml_doc, attributes["lar"], attributes["irproduct"]) |
||||
attributes["hhmemb"] = safe_string_as_integer(xml_doc, "HHMEMB") |
||||
(1..8).each do |index| |
||||
attributes["age#{index}"] = safe_string_as_integer(xml_doc, "P#{index}Age") |
||||
attributes["age#{index}_known"] = age_known(xml_doc, index, attributes["hhmemb"]) |
||||
attributes["sex#{index}"] = sex(xml_doc, index) |
||||
attributes["ecstat#{index}"] = unsafe_string_as_integer(xml_doc, "P#{index}Eco") |
||||
end |
||||
(2..8).each do |index| |
||||
attributes["relat#{index}"] = relat(xml_doc, index) |
||||
end |
||||
attributes["ethnic"] = unsafe_string_as_integer(xml_doc, "P1Eth") |
||||
attributes["ethnic_group"] = ethnic_group(attributes["ethnic"]) |
||||
attributes["national"] = unsafe_string_as_integer(xml_doc, "P1Nat") |
||||
attributes["preg_occ"] = unsafe_string_as_integer(xml_doc, "Preg") |
||||
|
||||
attributes["armedforces"] = unsafe_string_as_integer(xml_doc, "ArmedF") |
||||
attributes["leftreg"] = unsafe_string_as_integer(xml_doc, "LeftAF") |
||||
attributes["reservist"] = unsafe_string_as_integer(xml_doc, "Inj") |
||||
|
||||
attributes["hb"] = unsafe_string_as_integer(xml_doc, "Q6Ben") |
||||
attributes["benefits"] = unsafe_string_as_integer(xml_doc, "Q7Ben") |
||||
attributes["earnings"] = safe_string_as_decimal(xml_doc, "Q8Money") |
||||
attributes["net_income_known"] = net_income_known(xml_doc, attributes["earnings"]) |
||||
attributes["incfreq"] = unsafe_string_as_integer(xml_doc, "Q8a") |
||||
|
||||
attributes["reason"] = unsafe_string_as_integer(xml_doc, "Q9a") |
||||
attributes["reasonother"] = string_or_nil(xml_doc, "Q9aa") |
||||
attributes["underoccupation_benefitcap"] = unsafe_string_as_integer(xml_doc, "_9b") |
||||
%w[a b c f g h].each do |letter| |
||||
attributes["housingneeds_#{letter}"] = housing_needs(xml_doc, letter) |
||||
end |
||||
|
||||
attributes["illness"] = unsafe_string_as_integer(xml_doc, "Q10ia") |
||||
(1..10).each do |index| |
||||
attributes["illness_type_#{index}"] = illness_type(xml_doc, index) |
||||
end |
||||
|
||||
attributes["prevten"] = unsafe_string_as_integer(xml_doc, "Q11") |
||||
attributes["prevloc"] = string_or_nil(xml_doc, "Q12aONS") |
||||
attributes["previous_postcode_known"] = previous_postcode_known(xml_doc) |
||||
attributes["ppostcode_full"] = compose_postcode(xml_doc, "PPOSTC1", "PPOSTC2") |
||||
attributes["layear"] = unsafe_string_as_integer(xml_doc, "Q12c") |
||||
attributes["waityear"] = unsafe_string_as_integer(xml_doc, "Q12d") |
||||
attributes["homeless"] = unsafe_string_as_integer(xml_doc, "Q13") |
||||
|
||||
attributes["reasonpref"] = unsafe_string_as_integer(xml_doc, "Q14a") |
||||
attributes["rp_homeless"] = unsafe_string_as_integer(xml_doc, "Q14b1") |
||||
attributes["rp_insan_unsat"] = unsafe_string_as_integer(xml_doc, "Q14b2") |
||||
attributes["rp_medwel"] = unsafe_string_as_integer(xml_doc, "Q14b3") |
||||
attributes["rp_hardship"] = unsafe_string_as_integer(xml_doc, "Q14b4") |
||||
attributes["rp_dontknow"] = unsafe_string_as_integer(xml_doc, "Q14b5") |
||||
|
||||
attributes["cbl"] = unsafe_string_as_integer(xml_doc, "Q15CBL") |
||||
attributes["chr"] = unsafe_string_as_integer(xml_doc, "Q15CHR") |
||||
attributes["cap"] = unsafe_string_as_integer(xml_doc, "Q15CAP") |
||||
|
||||
attributes["referral"] = unsafe_string_as_integer(xml_doc, "Q16") |
||||
attributes["period"] = unsafe_string_as_integer(xml_doc, "Q17") |
||||
|
||||
attributes["brent"] = safe_string_as_decimal(xml_doc, "Q18ai") |
||||
attributes["scharge"] = safe_string_as_decimal(xml_doc, "Q18aii") |
||||
attributes["pscharge"] = safe_string_as_decimal(xml_doc, "Q18aiii") |
||||
attributes["supcharg"] = safe_string_as_decimal(xml_doc, "Q18aiv") |
||||
attributes["tcharge"] = safe_string_as_decimal(xml_doc, "Q18av") |
||||
|
||||
attributes["hbrentshortfall"] = unsafe_string_as_integer(xml_doc, "Q18d") |
||||
|
||||
attributes["voiddate"] = compose_date(xml_doc, "VDAY", "VMONTH", "VYEAR") |
||||
attributes["mrcdate"] = compose_date(xml_doc, "MRCDAY", "MRCMONTH", "MRCYEAR") |
||||
|
||||
attributes["offered"] = safe_string_as_integer(xml_doc, "Q20") |
||||
attributes["propcode"] = string_or_nil(xml_doc, "Q21a") |
||||
attributes["beds"] = safe_string_as_integer(xml_doc, "Q22") |
||||
attributes["unittype_gn"] = unsafe_string_as_integer(xml_doc, "Q23") |
||||
attributes["builtype"] = unsafe_string_as_integer(xml_doc, "Q24") |
||||
attributes["wchair"] = unsafe_string_as_integer(xml_doc, "Q25") |
||||
attributes["unitletas"] = unsafe_string_as_integer(xml_doc, "Q26") |
||||
attributes["rsnvac"] = unsafe_string_as_integer(xml_doc, "Q27") |
||||
attributes["renewal"] = renewal(attributes["rsnvac"]) |
||||
|
||||
attributes["la"] = string_or_nil(xml_doc, "Q28ONS") |
||||
attributes["postcode_full"] = compose_postcode(xml_doc, "POSTCODE", "POSTCOD2") |
||||
attributes["postcode_known"] = attributes["postcode_full"].nil? ? 0 : 1 |
||||
|
||||
# Not specific to our form but required for CDS and can't be inferred |
||||
attributes["old_form_id"] = Integer(field_value(xml_doc, "xmlns", "FORM")) |
||||
|
||||
# Specific to us |
||||
attributes["previous_la_known"] = 1 # Defaulting to Yes (Required) |
||||
attributes["la_known"] = 1 # Defaulting to Yes (Required) |
||||
attributes["created_at"] = Date.parse(field_value(xml_doc, "meta", "created-date")) |
||||
attributes["updated_at"] = Date.parse(field_value(xml_doc, "meta", "modified-date")) |
||||
|
||||
case_log = CaseLog.new(attributes) |
||||
case_log.save! |
||||
end |
||||
|
||||
# Safe: A string that represents only an integer (or empty/nil) |
||||
def safe_string_as_integer(xml_doc, attribute) |
||||
str = field_value(xml_doc, "xmlns", attribute) |
||||
Integer(str, exception: false) |
||||
end |
||||
|
||||
# Safe: A string that represents only a decimal (or empty/nil) |
||||
def safe_string_as_decimal(xml_doc, attribute) |
||||
str = field_value(xml_doc, "xmlns", attribute) |
||||
BigDecimal(str, exception: false) |
||||
end |
||||
|
||||
# Unsafe: A string that has more than just the integer value |
||||
def unsafe_string_as_integer(xml_doc, attribute) |
||||
str = field_value(xml_doc, "xmlns", attribute) |
||||
if str.blank? |
||||
nil |
||||
else |
||||
str.to_i |
||||
end |
||||
end |
||||
|
||||
def compose_date(xml_doc, day_str, month_str, year_str) |
||||
day = Integer(field_value(xml_doc, "xmlns", day_str), exception: false) |
||||
month = Integer(field_value(xml_doc, "xmlns", month_str), exception: false) |
||||
year = Integer(field_value(xml_doc, "xmlns", year_str), exception: false) |
||||
if day.nil? || month.nil? || year.nil? |
||||
nil |
||||
else |
||||
Date.new(year, month, day) |
||||
end |
||||
end |
||||
|
||||
def get_form_name_component(xml_doc, index) |
||||
form_name = field_value(xml_doc, "meta", "form-name") |
||||
form_type_components = form_name.split("-") |
||||
form_type_components[index] |
||||
end |
||||
|
||||
def needs_type(xml_doc) |
||||
gn_sh = get_form_name_component(xml_doc, -1) |
||||
case gn_sh |
||||
when "GN" |
||||
GN_SH[:general_needs] |
||||
when "SH" |
||||
GN_SH[:supported_housing] |
||||
else |
||||
raise "Unknown needstype value: #{gn_sh}" |
||||
end |
||||
end |
||||
|
||||
# This does not match renttype (CDS) which is derived by case log logic |
||||
def rent_type(xml_doc, lar, irproduct) |
||||
sr_ar_ir = get_form_name_component(xml_doc, -2) |
||||
|
||||
case sr_ar_ir |
||||
when "SR" |
||||
RENT_TYPE[:social_rent] |
||||
when "AR" |
||||
if lar == 1 |
||||
RENT_TYPE[:london_affordable_rent] |
||||
else |
||||
RENT_TYPE[:affordable_rent] |
||||
end |
||||
when "IR" |
||||
if irproduct == IRPRODUCT[:rent_to_buy] |
||||
RENT_TYPE[:rent_to_buy] |
||||
elsif irproduct == IRPRODUCT[:london_living_rent] |
||||
RENT_TYPE[:london_living_rent] |
||||
elsif irproduct == IRPRODUCT[:other_intermediate_rent_product] |
||||
RENT_TYPE[:other_intermediate_rent_product] |
||||
end |
||||
else |
||||
raise "Could not infer rent type with '#{sr_ar_ir}'" |
||||
end |
||||
end |
||||
|
||||
def find_organisation_id(xml_doc, id_field, name_field, reg_field) |
||||
old_visible_id = unsafe_string_as_integer(xml_doc, id_field) |
||||
organisation = Organisation.find_by(old_visible_id:) |
||||
# Quick hack: should be removed when all organisations are imported |
||||
# Will fail in the future if the organisation is missing |
||||
if organisation.nil? |
||||
organisation = Organisation.new |
||||
organisation.old_visible_id = old_visible_id |
||||
let_type = unsafe_string_as_integer(xml_doc, "landlord") |
||||
organisation.provider_type = if let_type == PRP_LA[:local_authority] |
||||
1 |
||||
else |
||||
2 |
||||
end |
||||
organisation.name = string_or_nil(xml_doc, name_field) |
||||
organisation.housing_registration_no = string_or_nil(xml_doc, reg_field) |
||||
organisation.save! |
||||
end |
||||
organisation.id |
||||
end |
||||
|
||||
def sex(xml_doc, index) |
||||
sex = field_value(xml_doc, "xmlns", "P#{index}Sex") |
||||
case sex |
||||
when "Male" |
||||
"M" |
||||
when "Female" |
||||
"F" |
||||
when "Other", "Non-binary" |
||||
"X" |
||||
when "Refused" |
||||
"R" |
||||
end |
||||
end |
||||
|
||||
def relat(xml_doc, index) |
||||
relat = field_value(xml_doc, "xmlns", "P#{index}Rel") |
||||
case relat |
||||
when "Child" |
||||
"C" |
||||
when "Partner" |
||||
"P" |
||||
when "Other", "Non-binary" |
||||
"X" |
||||
when "Refused" |
||||
"R" |
||||
end |
||||
end |
||||
|
||||
def age_known(xml_doc, index, hhmemb) |
||||
return nil if index > hhmemb |
||||
|
||||
age_refused = field_value(xml_doc, "xmlns", "P#{index}AR") |
||||
if age_refused == "AGE_REFUSED" |
||||
1 # No |
||||
else |
||||
0 # Yes |
||||
end |
||||
end |
||||
|
||||
def previous_postcode_known(xml_doc) |
||||
previous_postcode_known = field_value(xml_doc, "xmlns", "Q12bnot") |
||||
if previous_postcode_known == "Temporary or Unknown" |
||||
0 |
||||
else |
||||
1 |
||||
end |
||||
end |
||||
|
||||
def compose_postcode(xml_doc, outcode, incode) |
||||
outcode_value = field_value(xml_doc, "xmlns", outcode) |
||||
incode_value = field_value(xml_doc, "xmlns", incode) |
||||
if outcode_value.blank? || incode_value.blank? |
||||
nil |
||||
else |
||||
"#{outcode_value} #{incode_value}" |
||||
end |
||||
end |
||||
|
||||
def london_affordable_rent(xml_doc) |
||||
lar = unsafe_string_as_integer(xml_doc, "LAR") |
||||
if lar == 1 |
||||
1 |
||||
else |
||||
# We default to No for any other values (nil, not known) |
||||
2 |
||||
end |
||||
end |
||||
|
||||
def renewal(rsnvac) |
||||
# Relet – renewal of fixed-term tenancy |
||||
if rsnvac == 14 |
||||
1 |
||||
else |
||||
0 |
||||
end |
||||
end |
||||
|
||||
def string_or_nil(xml_doc, attribute) |
||||
str = field_value(xml_doc, "xmlns", attribute) |
||||
str.presence |
||||
end |
||||
|
||||
def ethnic_group(ethnic) |
||||
case ethnic |
||||
when 1, 2, 3, 18 |
||||
# White |
||||
0 |
||||
when 4, 5, 6, 7 |
||||
# Mixed |
||||
1 |
||||
when 8, 9, 10, 11, 15 |
||||
# Asian |
||||
2 |
||||
when 12, 13, 14 |
||||
# Black |
||||
3 |
||||
when 16, 19 |
||||
# Others |
||||
4 |
||||
when 17 |
||||
# Refused |
||||
5 |
||||
end |
||||
end |
||||
|
||||
# Letters should be lowercase to match case |
||||
def housing_needs(xml_doc, letter) |
||||
housing_need = field_value(xml_doc, "xmlns", "Q10-#{letter}") |
||||
if housing_need == "Yes" |
||||
1 |
||||
else |
||||
0 |
||||
end |
||||
end |
||||
|
||||
def net_income_known(xml_doc, earnings) |
||||
incref = field_value(xml_doc, "xmlns", "Q8Refused") |
||||
if incref == "Refused" |
||||
# Tenant prefers not to say |
||||
2 |
||||
elsif earnings.nil? |
||||
# No |
||||
1 |
||||
else |
||||
# Yes |
||||
0 |
||||
end |
||||
end |
||||
|
||||
def illness_type(xml_doc, index) |
||||
illness_type = string_or_nil(xml_doc, "Q10ib-#{index}") |
||||
if illness_type == "Yes" |
||||
1 |
||||
else |
||||
0 |
||||
end |
||||
end |
||||
end |
||||
end |
@ -1,25 +1,16 @@
|
||||
<div class="app-filter-layout__filter" tabindex="-1" id="filter-panel"> |
||||
<div class="app-filter" > |
||||
<div class="app-filter__header"> |
||||
<h2 class="govuk-heading-m">Filters</h2> |
||||
<button |
||||
class="app-filter__close" |
||||
type="button" |
||||
data-controller="filter" |
||||
data-action="click->filter#toggleFilter"> |
||||
Close |
||||
</button> |
||||
</div> |
||||
<div class="app-filter__content"> |
||||
<div class="govuk-form-group app-filter__group"> |
||||
<%= form_with url: "/logs", html: { method: :get } do |f| %> |
||||
<% years = {"2021": "2021/22", "2022": "2022/23"} %> |
||||
<%= render partial: "filters/checkbox_filter", locals: { f: f, options: years, label: "Collection year", category: "years" } %> |
||||
<%= render partial: "filters/checkbox_filter", locals: { f: f, options: status_filters, label: "Status", category: "status" } %> |
||||
<%= render partial: "filters/checkbox_filter", locals: { f: f, options: {"all": "All", "yours": "Yours"}, label: "Logs", category: "user" } %> |
||||
<%= f.govuk_submit "Apply filters", class: "govuk-!-margin-top-4" %> |
||||
<% end %> |
||||
</div> |
||||
</div> |
||||
<div class="app-filter-layout__filter"> |
||||
<div class="app-filter"> |
||||
<div class="app-filter__header"> |
||||
<h2 class="govuk-heading-m">Filters</h2> |
||||
</div> |
||||
<div class="app-filter__content"> |
||||
<%= form_with url: "/logs", html: { method: :get } do |f| %> |
||||
<% years = {"2021": "2021/22", "2022": "2022/23"} %> |
||||
<%= render partial: "filters/checkbox_filter", locals: { f: f, options: years, label: "Collection year", category: "years" } %> |
||||
<%= render partial: "filters/checkbox_filter", locals: { f: f, options: status_filters, label: "Status", category: "status" } %> |
||||
<%= render partial: "filters/checkbox_filter", locals: { f: f, options: {"all": "All", "yours": "Yours"}, label: "Logs", category: "user" } %> |
||||
<%= f.govuk_submit "Apply filters", class: "govuk-!-margin-bottom-0" %> |
||||
<% end %> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
@ -1,25 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %> |
||||
<p class="govuk-body">Already have an account? <%= govuk_link_to "Sign in", new_session_path(resource_name) %>.</p><br /> |
||||
<p class="govuk-body">Already have an account? <%= govuk_link_to "Sign in", new_session_path(resource_name) %>.</p> |
||||
<% end %> |
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> |
||||
<%= govuk_link_to "Sign up", new_registration_path(resource_name) %><br /> |
||||
<%= govuk_link_to "Sign up", new_registration_path(resource_name) %><br> |
||||
<% end %> |
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> |
||||
<p class="govuk-body"> You can <%= govuk_link_to "reset your password", new_password_path(resource_name) %> if you’ve forgotten it.<p><br /> |
||||
<p class="govuk-body">You can <%= govuk_link_to "reset your password", new_password_path(resource_name) %> if you’ve forgotten it.</p> |
||||
<% end %> |
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> |
||||
<%= govuk_link_to "Didn’t receive confirmation instructions?", new_confirmation_path(resource_name) %><br /> |
||||
<%= govuk_link_to "Didn’t receive confirmation instructions?", new_confirmation_path(resource_name) %><br> |
||||
<% end %> |
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> |
||||
<%= govuk_link_to "Didn’t receive unlock instructions?", new_unlock_path(resource_name) %><br /> |
||||
<%= govuk_link_to "Didn’t receive unlock instructions?", new_unlock_path(resource_name) %><br> |
||||
<% end %> |
||||
|
||||
<%- if devise_mapping.omniauthable? %> |
||||
<%- resource_class.omniauth_providers.each do |provider| %> |
||||
<%= govuk_link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %><br /> |
||||
<%= govuk_link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %><br> |
||||
<% end %> |
||||
<% end %> |
||||
|
@ -1,10 +1,8 @@
|
||||
<%= f.govuk_check_boxes_fieldset category.to_sym, legend: { text: label, size: "s"} do %> |
||||
<div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes"> |
||||
<% options.map do |key, option| %> |
||||
<%= f.govuk_check_box category, "#{key}", |
||||
label: { text: option }, |
||||
checked: filter_selected?(category, key), |
||||
size: "s" %> |
||||
<% end %> |
||||
</div> |
||||
<%= f.govuk_check_boxes_fieldset category.to_sym, legend: { text: label, size: "s" }, small: true, form_group: { classes: "app-filter__group" } do %> |
||||
<% options.map do |key, option| %> |
||||
<%= f.govuk_check_box category, key.to_s, |
||||
label: { text: option }, |
||||
checked: filter_selected?(category, key), |
||||
size: "s" %> |
||||
<% end %> |
||||
<% end %> |
||||
|
@ -1,9 +1,8 @@
|
||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||
|
||||
<%= f.govuk_date_field question.id.to_sym, |
||||
caption: caption(caption_text, page_header, conditional), |
||||
legend: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
width: 20, |
||||
**stimulus_html_attributes(question) |
||||
%> |
||||
caption: caption(caption_text, page_header, conditional), |
||||
legend: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
width: 20, |
||||
**stimulus_html_attributes(question) %> |
||||
|
@ -1,12 +1,12 @@
|
||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||
|
||||
<%= f.govuk_number_field question.id.to_sym, |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
min: question.min, max: question.max, step: question.step, |
||||
width: question.width, :readonly => question.read_only?, |
||||
prefix_text: question.prefix.to_s, |
||||
suffix_text: question.suffix.is_a?(String) ? question.suffix : nil, |
||||
**stimulus_html_attributes(question) |
||||
%> |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
min: question.min, max: question.max, step: question.step, |
||||
width: question.width, |
||||
readonly: question.read_only?, |
||||
prefix_text: question.prefix.to_s, |
||||
suffix_text: question.suffix.is_a?(String) ? question.suffix : nil, |
||||
**stimulus_html_attributes(question) %> |
||||
|
@ -1,37 +1,36 @@
|
||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||
|
||||
<%= f.govuk_radio_buttons_fieldset question.id.to_sym, |
||||
caption: caption(caption_text, page_header, conditional), |
||||
legend: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe } do %> |
||||
caption: caption(caption_text, page_header, conditional), |
||||
legend: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe } do %> |
||||
|
||||
<% question.displayed_answer_options.map do |key, options| %> |
||||
<% if key.starts_with?("divider") %> |
||||
<%= f.govuk_radio_divider %> |
||||
<% question.displayed_answer_options.map do |key, options| %> |
||||
<% if key.starts_with?("divider") %> |
||||
<%= f.govuk_radio_divider %> |
||||
<% else %> |
||||
<% conditional_question = find_conditional_question(@page, question, key) %> |
||||
<% if conditional_question.nil? %> |
||||
<%= f.govuk_radio_button question.id, |
||||
key, |
||||
label: { text: options["value"] }, |
||||
hint: { text: options["hint"] }, |
||||
**stimulus_html_attributes(question) %> |
||||
<% else %> |
||||
<% conditional_question = find_conditional_question(@page, question, key) %> |
||||
<% if conditional_question.nil? %> |
||||
<%= f.govuk_radio_button question.id, |
||||
key, |
||||
label: { text: options['value'] }, |
||||
hint: { text: options['hint'] }, |
||||
**stimulus_html_attributes(question) |
||||
%> |
||||
<% else %> |
||||
<%= f.govuk_radio_button question.id, |
||||
key, |
||||
label: { text: options['value'] }, |
||||
hint: { text: options['hint'] }, |
||||
**stimulus_html_attributes(question) do %> |
||||
<%= render partial: "#{conditional_question.type}_question", locals: { |
||||
question: conditional_question, |
||||
caption_text: caption_text, |
||||
page_header: page_header, |
||||
f: f, |
||||
conditional: true |
||||
} %> |
||||
<% end %> |
||||
<%= f.govuk_radio_button question.id, |
||||
key, |
||||
label: { text: options["value"] }, |
||||
hint: { text: options["hint"] }, |
||||
**stimulus_html_attributes(question) do %> |
||||
<%= render partial: "#{conditional_question.type}_question", locals: { |
||||
question: conditional_question, |
||||
caption_text:, |
||||
page_header:, |
||||
f:, |
||||
conditional: true, |
||||
} %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
|
@ -1,14 +1,13 @@
|
||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||
|
||||
<% selected = @case_log.public_send(question.id) || "" %> |
||||
<%= answers = question.displayed_answer_options.map { |key, value| OpenStruct.new(id: key, name: value) } |
||||
f.govuk_collection_select question.id.to_sym, |
||||
<% answers = question.displayed_answer_options.map { |key, value| OpenStruct.new(id: key, name: value) } %> |
||||
<%= f.govuk_collection_select question.id.to_sym, |
||||
answers, |
||||
:id, |
||||
:name, |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
options: { disabled: [""], selected: selected }, |
||||
"data-controller": "accessible-autocomplete" |
||||
%> |
||||
options: { disabled: [""], selected: }, |
||||
"data-controller": "accessible-autocomplete" %> |
||||
|
@ -1,9 +1,8 @@
|
||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||
|
||||
<%= f.govuk_text_field question.id.to_sym, |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
width: question.width ? question.width : nil, |
||||
**stimulus_html_attributes(question) |
||||
%> |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
width: question.width || nil, |
||||
**stimulus_html_attributes(question) %> |
||||
|
@ -1,9 +1,8 @@
|
||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||
|
||||
<%= f.govuk_text_area question.id.to_sym, |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
width: question.width ? question.width : nil, |
||||
**stimulus_html_attributes(question) |
||||
%> |
||||
caption: caption(caption_text, page_header, conditional), |
||||
label: legend(question, page_header, conditional), |
||||
hint: { text: question.hint_text&.html_safe }, |
||||
width: question.width || nil, |
||||
**stimulus_html_attributes(question) %> |
||||
|
@ -0,0 +1,16 @@
|
||||
<div class="app-card"> |
||||
<h2 class="govuk-heading-s">Collection resources</h2> |
||||
|
||||
<%= render DocumentListComponent.new(items: [ |
||||
{ |
||||
name: "Lettings log for tenants (2022/23)", |
||||
href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2022-23%20Lettings%20paper%20form.pdf?download-format=pdf", |
||||
metadata: "PDF, 654 KB, 4 pages", |
||||
}, |
||||
{ |
||||
name: "Lettings log for tenants (2021/22)", |
||||
href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2021_22%20Lettings%20Log.pdf?download-format=pdf", |
||||
metadata: "PDF, 302 KB, 3 pages", |
||||
}, |
||||
]) %> |
||||
</div> |
@ -0,0 +1,13 @@
|
||||
class UpdateCaseLogsFields < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.integer :old_form_id, :lar, :irproduct |
||||
t.remove :day, :month, :year, :vday, :vmonth, :vyear, :mrcday, :mrcmonth, :mrcyear, :other_hhmemb, :accessibility_requirements_prefer_not_to_say, :landlord, type: :integer |
||||
t.remove :ppostc1, :ppostc2, :postcode, :postcod2, type: :string |
||||
t.rename :intermediate_rent_product_name, :irproduct_other |
||||
t.rename :lawaitlist, :waityear |
||||
t.rename :other_reason_for_leaving_last_settled_home, :reasonother |
||||
t.rename :property_void_date, :voiddate |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,19 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe DocumentListComponent, type: :component do |
||||
let(:items) do |
||||
[{ name: "PDF Form", href: "/forms/form.pdf", description: "An important form", metadata: "4 pages" }, |
||||
{ name: "Website", href: "https://example.com" }] |
||||
end |
||||
|
||||
context "when rendering tabs" do |
||||
it "all of the nav tabs specified in the items hash are passed to it" do |
||||
result = render_inline(described_class.new(items:)) |
||||
|
||||
expect(result.text).to include("PDF Form") |
||||
expect(result.text).to include("An important form") |
||||
expect(result.text).to include("4 pages") |
||||
expect(result.text).to include("Website") |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,27 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe PrimaryNavigationComponent, type: :component do |
||||
let(:items) do |
||||
[{ name: "Organisations", url: "#", current: true }, |
||||
{ name: "Users", url: "#" }, |
||||
{ name: "Logs ", url: "#" }] |
||||
end |
||||
|
||||
context "when the item is 'current' in nav tabs" do |
||||
it "then that tab appears as selected" do |
||||
result = render_inline(described_class.new(items:)) |
||||
|
||||
expect(result.css('.app-primary-navigation__link[aria-current="page"]').text).to include("Organisations") |
||||
end |
||||
end |
||||
|
||||
context "when rendering tabs" do |
||||
it "all of the nav tabs specified in the items hash are passed to it" do |
||||
result = render_inline(described_class.new(items:)) |
||||
|
||||
expect(result.text).to include("Organisations") |
||||
expect(result.text).to include("Users") |
||||
expect(result.text).to include("Logs") |
||||
end |
||||
end |
||||
end |
@ -1,27 +0,0 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe TabNavigationComponent, type: :component do |
||||
let(:items) do |
||||
[{ name: "Application", url: "#", current: true }, |
||||
{ name: "Notes", url: "#" }, |
||||
{ name: "Timeline", url: "#" }] |
||||
end |
||||
|
||||
context "when the item is 'current' in nav tabs" do |
||||
it "then that tab appears as selected" do |
||||
result = render_inline(described_class.new(items:)) |
||||
|
||||
expect(result.css('.app-tab-navigation__link[aria-current="page"]').text).to include("Application") |
||||
end |
||||
end |
||||
|
||||
context "when rendering tabs" do |
||||
it "all of the nav tabs specified in the items hash are passed to it" do |
||||
result = render_inline(described_class.new(items:)) |
||||
|
||||
expect(result.text).to include("Application") |
||||
expect(result.text).to include("Notes") |
||||
expect(result.text).to include("Timeline") |
||||
end |
||||
end |
||||
end |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue