From 7a8f92242296e7ece982ff22bcdad3c0ca0e4d99 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Tue, 24 Sep 2024 00:42:45 +0000 Subject: [PATCH] Remove duplication of header between two views --- .../_address_with_results.html.erb | 25 +++++++------ .../applications/_no_applications.html.erb | 37 ------------------- .../_no_applications_box.html.erb | 21 +++++++++++ .../_no_applications_help.html.erb | 10 +++++ 4 files changed, 45 insertions(+), 48 deletions(-) delete mode 100644 app/views/applications/_no_applications.html.erb create mode 100644 app/views/applications/_no_applications_box.html.erb create mode 100644 app/views/applications/_no_applications_help.html.erb diff --git a/app/views/applications/_address_with_results.html.erb b/app/views/applications/_address_with_results.html.erb index 81cff62ea..c3a317e88 100644 --- a/app/views/applications/_address_with_results.html.erb +++ b/app/views/applications/_address_with_results.html.erb @@ -19,17 +19,13 @@ <% end %> -<%# TODO: Remove duplication of heading %> -<%# TODO: Figure out how to handle no results when extra_options_on_address_search is enabled %> -<%# TODO: Add filter option for no filtering (e.g. any distance or any time) because the filtering in its current is very confusing in its behaviour %> -<% if applications.empty? && !Flipper.enabled?(:extra_options_on_address_search, current_user) %> -
- <%= render "no_applications", full_address:, q: %> -
-<% elsif applications %> -
- <%= render HeadingComponent.new(tag: :h2).with_content("Search results") %> - +
+ <%= render HeadingComponent.new(tag: :h2).with_content("Search results") %> + <%# TODO: Figure out how to handle no results when extra_options_on_address_search is enabled %> + <%# TODO: Add filter option for no filtering (e.g. any distance or any time) because the filtering in its current is very confusing in its behaviour %> + <% if applications.empty? && !Flipper.enabled?(:extra_options_on_address_search, current_user) %> + <%= render "no_applications_box", full_address: %> + <% elsif applications %>
<%= render "create_alert_form", alert: %>
@@ -68,5 +64,12 @@
<%= render SimplePagerComponent.new(collection: applications) %>
+ <% end %> +
+ +<% if applications.empty? && !Flipper.enabled?(:extra_options_on_address_search, current_user) %> +
+ <%= render HeadingComponent.new(tag: :h2).with_content("You can help!") %> + <%= render "no_applications_help" %>
<% end %> diff --git a/app/views/applications/_no_applications.html.erb b/app/views/applications/_no_applications.html.erb deleted file mode 100644 index 2b91fb4e9..000000000 --- a/app/views/applications/_no_applications.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -
- <%= render HeadingComponent.new(tag: :h2).with_content("Search results") %> -
- <%= image_tag "illustration/no_results.svg" %> -
-

- Unfortunately, we don't know of any applications near <%= full_address %>. -

-

- This is most likely because we haven't yet been able to add your local council - or planning authority. We're working on covering the whole country but we're not - there yet. -

-

- There is a list of the planning authorities we currently cover - <%= pa_link_to "here", authorities_path %>. -

-

- To see an example of what the results would look like once your area is included - see <%= pa_link_to "Bourke Street in Melbourne", address_applications_path(q: "Bourke St, Melbourne 3000") %>. -

-
-
-
-
- <%= render HeadingComponent.new(tag: :h2).with_content("You can help!") %> -

- We are a free service brought to you by the charity the - <%= pa_link_to "OpenAustralia Foundation", "https://www.oaf.org.au" %>. - Donations and other kinds of support allow us to add more local authorities, - including yours! -

-

- Check out our <%= pa_link_to "get involved", get_involved_path %> section for - ways to help us get your search results. -

-
diff --git a/app/views/applications/_no_applications_box.html.erb b/app/views/applications/_no_applications_box.html.erb new file mode 100644 index 000000000..d1c845d67 --- /dev/null +++ b/app/views/applications/_no_applications_box.html.erb @@ -0,0 +1,21 @@ +
+ <%= image_tag "illustration/no_results.svg" %> +
+

+ Unfortunately, we don't know of any applications near <%= full_address %>. +

+

+ This is most likely because we haven't yet been able to add your local council + or planning authority. We're working on covering the whole country but we're not + there yet. +

+

+ There is a list of the planning authorities we currently cover + <%= pa_link_to "here", authorities_path %>. +

+

+ To see an example of what the results would look like once your area is included + see <%= pa_link_to "Bourke Street in Melbourne", address_applications_path(q: "Bourke St, Melbourne 3000") %>. +

+
+
diff --git a/app/views/applications/_no_applications_help.html.erb b/app/views/applications/_no_applications_help.html.erb new file mode 100644 index 000000000..65aed08a9 --- /dev/null +++ b/app/views/applications/_no_applications_help.html.erb @@ -0,0 +1,10 @@ +

+ We are a free service brought to you by the charity the + <%= pa_link_to "OpenAustralia Foundation", "https://www.oaf.org.au" %>. + Donations and other kinds of support allow us to add more local authorities, + including yours! +

+

+ Check out our <%= pa_link_to "get involved", get_involved_path %> section for + ways to help us get your search results. +