Browse Source
* feat: add merge_date to org and display merged status * feat: prohibit users being added to merged orgs * feat: add migration * feat: update error message * feat: update tests * feat: add user validation test * refactor: linting * feat: update schema * feat: use orange tag for merged status * feat: merge with main * feat: update tests * feat: delete old org helper file * feat: update tests * refactor: lintpull/1802/head
natdeanlewissoftwire
1 year ago
committed by
GitHub
14 changed files with 119 additions and 74 deletions
@ -1,27 +0,0 @@
|
||||
module OrganisationHelper |
||||
def organisation_header(path, user, current_organisation) |
||||
if path == "/organisations" |
||||
"Organisations" |
||||
elsif user.organisation_id == current_organisation.id |
||||
"Your organisation" |
||||
else |
||||
current_organisation.name |
||||
end |
||||
end |
||||
|
||||
def organisation_name_row(user:, organisation:, summary_list:) |
||||
summary_list.row do |row| |
||||
row.key { "Name" } |
||||
row.value { organisation.name } |
||||
if user.support? |
||||
row.action( |
||||
visually_hidden_text: organisation.name.humanize.downcase, |
||||
href: edit_organisation_path(organisation), |
||||
html_attributes: { "data-qa": "change-#{organisation.name.downcase}" }, |
||||
) |
||||
else |
||||
row.action |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,40 @@
|
||||
module OrganisationsHelper |
||||
def organisation_header(path, user, current_organisation) |
||||
if path == "/organisations" |
||||
"Organisations" |
||||
elsif user.organisation_id == current_organisation.id |
||||
"Your organisation" |
||||
else |
||||
current_organisation.name |
||||
end |
||||
end |
||||
|
||||
def display_organisation_attributes(organisation) |
||||
[ |
||||
{ name: "Organisation ID", value: "ORG#{organisation.id}", editable: false }, |
||||
{ name: "Address", value: organisation.address_string, editable: true }, |
||||
{ name: "Telephone number", value: organisation.phone, editable: true }, |
||||
{ name: "Type of provider", value: organisation.display_provider_type, editable: false }, |
||||
{ name: "Registration number", value: organisation.housing_registration_no || "", editable: false }, |
||||
{ name: "Rent periods", value: organisation.rent_period_labels, editable: false, format: :bullet }, |
||||
{ name: "Owns housing stock", value: organisation.holds_own_stock ? "Yes" : "No", editable: false }, |
||||
{ name: "Status", value: status_tag(organisation.status), editable: false }, |
||||
] |
||||
end |
||||
|
||||
def organisation_name_row(user:, organisation:, summary_list:) |
||||
summary_list.row do |row| |
||||
row.key { "Name" } |
||||
row.value { organisation.name } |
||||
if user.support? |
||||
row.action( |
||||
visually_hidden_text: organisation.name.humanize.downcase, |
||||
href: edit_organisation_path(organisation), |
||||
html_attributes: { "data-qa": "change-#{organisation.name.downcase}" }, |
||||
) |
||||
else |
||||
row.action |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,5 @@
|
||||
class AddMergeDateToOrganisation < ActiveRecord::Migration[7.0] |
||||
def change |
||||
add_column :organisations, :merge_date, :datetime |
||||
end |
||||
end |
@ -0,0 +1,23 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe OrganisationsHelper do |
||||
include TagHelper |
||||
describe "display_organisation_attributes" do |
||||
let(:organisation) { create(:organisation) } |
||||
|
||||
it "does not include data protection agreement" do |
||||
expect(display_organisation_attributes(organisation)).to eq( |
||||
[{ editable: false, name: "Organisation ID", value: "ORG#{organisation.id}" }, |
||||
{ editable: true, |
||||
name: "Address", |
||||
value: "2 Marsham Street\nLondon\nSW1P 4DF" }, |
||||
{ editable: true, name: "Telephone number", value: nil }, |
||||
{ editable: false, name: "Type of provider", value: "Local authority" }, |
||||
{ editable: false, name: "Registration number", value: "1234" }, |
||||
{ editable: false, format: :bullet, name: "Rent periods", value: %w[All] }, |
||||
{ editable: false, name: "Owns housing stock", value: "Yes" }, |
||||
{ editable: false, name: "Status", value: status_tag(organisation.status) }], |
||||
) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue