Skip to content

Commit

Permalink
Remove duplication of header between two views
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Sep 24, 2024
1 parent 8766521 commit 7a8f922
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 48 deletions.
25 changes: 14 additions & 11 deletions app/views/applications/_address_with_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@
</section>
<% 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) %>
<section class="pt-16">
<%= render "no_applications", full_address:, q: %>
</section>
<% elsif applications %>
<section class="pt-16" id="results">
<%= render HeadingComponent.new(tag: :h2).with_content("Search results") %>

<section class="pt-16" id="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 %>
<div class="mt-6 mb-4">
<%= render "create_alert_form", alert: %>
</div>
Expand Down Expand Up @@ -68,5 +64,12 @@
<div class="mt-6">
<%= render SimplePagerComponent.new(collection: applications) %>
</div>
<% end %>
</section>

<% if applications.empty? && !Flipper.enabled?(:extra_options_on_address_search, current_user) %>
<section class="mt-16 text-xl text-navy">
<%= render HeadingComponent.new(tag: :h2).with_content("You can help!") %>
<%= render "no_applications_help" %>
</section>
<% end %>
37 changes: 0 additions & 37 deletions app/views/applications/_no_applications.html.erb

This file was deleted.

21 changes: 21 additions & 0 deletions app/views/applications/_no_applications_box.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="flex flex-col items-start gap-16 p-16 mt-16 md:flex-row bg-light-grey">
<%= image_tag "illustration/no_results.svg" %>
<div class="text-xl text-navy">
<p class="text-2xl font-bold">
Unfortunately, we don't know of any applications near <%= full_address %>.
</p>
<p class="mt-8">
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.
</p>
<p class="mt-6">
There is a list of the planning authorities we currently cover
<%= pa_link_to "here", authorities_path %>.
</p>
<p class="mt-6">
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") %>.
</p>
</div>
</div>
10 changes: 10 additions & 0 deletions app/views/applications/_no_applications_help.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<p class="mt-8">
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!
</p>
<p class="mt-6">
Check out our <%= pa_link_to "get involved", get_involved_path %> section for
ways to help us get your search results.
</p>

0 comments on commit 7a8f922

Please sign in to comment.