Browse Source

feat: update user specific behaviour

CLDC-1661-new-page-for-housing-providers
natdeanlewissoftwire 2 years ago
parent
commit
ac337b7f59
  1. 4
      app/controllers/housing_providers_controller.rb
  2. 4
      app/controllers/organisations_controller.rb
  3. 2
      app/views/housing_providers/_housing_provider_list.html.erb

4
app/controllers/housing_providers_controller.rb

@ -4,9 +4,9 @@ class HousingProvidersController < ApplicationController
def index
housing_providers =
Organisation.joins(:parent_organisations)
Organisation.joins(:child_organisations)
.where(organisation_relationships: {
parent_organisation_id: current_user.organisation_id,
child_organisation_id: current_user.organisation_id,
relationship_type: OrganisationRelationship.relationship_types[:owning],
})
.order(:name)

4
app/controllers/organisations_controller.rb

@ -137,9 +137,9 @@ class OrganisationsController < ApplicationController
def housing_providers
housing_providers =
Organisation.joins(:parent_organisations)
Organisation.joins(:child_organisations)
.where(organisation_relationships: {
parent_organisation_id: current_user.organisation_id,
child_organisation_id: @organisation.id,
relationship_type: OrganisationRelationship.relationship_types[:owning],
})
.order(:name)

2
app/views/housing_providers/_housing_provider_list.html.erb

@ -7,6 +7,7 @@
<%= table.body do |body| %>
<%= body.row do |row| %>
<% row.cell(text: organisation.name) %>
<% if current_user.data_coordinator? || current_user.support? %>
<% row.cell(html_attributes: {
scope: "row",
}) do %>
@ -16,4 +17,5 @@
<% end %>
<% end %>
<% end %>
<% end %>
</section>

Loading…
Cancel
Save