natdeanlewissoftwire
2 years ago
6 changed files with 47 additions and 2 deletions
@ -0,0 +1,17 @@ |
|||||||
|
class HousingProvidersController < ApplicationController |
||||||
|
include Pagy::Backend |
||||||
|
include Modules::SearchFilter |
||||||
|
|
||||||
|
def index |
||||||
|
all_organisations = Organisation.order(:name) |
||||||
|
@pagy, @organisations = pagy(filtered_collection(all_organisations, search_term)) |
||||||
|
@searched = search_term.presence |
||||||
|
@total_count = all_organisations.size |
||||||
|
end |
||||||
|
|
||||||
|
private |
||||||
|
|
||||||
|
def search_term |
||||||
|
params["search"] |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,2 @@ |
|||||||
|
module HousingProvidersHelper |
||||||
|
end |
@ -0,0 +1,19 @@ |
|||||||
|
<% item_label = format_label(@pagy.count, "organisation") %> |
||||||
|
<% title = "Housing Providers" %> |
||||||
|
|
||||||
|
<% content_for :title, title %> |
||||||
|
|
||||||
|
<%= render partial: "organisations/headings", locals: { main: "Your housing providers", sub: nil } %> |
||||||
|
|
||||||
|
<p>Your organisation can submit logs for its housing providers.</p> |
||||||
|
|
||||||
|
<% if current_user.support? %> |
||||||
|
<%= govuk_button_link_to "Add a housing provider", new_housing_provider_path, html: { method: :get } %> |
||||||
|
<% end %> |
||||||
|
|
||||||
|
<%= render SearchComponent.new(current_user:, search_label: "Search for a housing provider", value: @searched) %> |
||||||
|
|
||||||
|
<%= govuk_section_break(visible: true, size: "m") %> |
||||||
|
|
||||||
|
<%= render partial: "organisations/organisation_list", locals: { organisations: @organisations, title: "Organisations", pagy: @pagy, searched: @searched, item_label:, total_count: @total_count } %> |
||||||
|
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "organisations" } %> |
Loading…
Reference in new issue