From 5dfaf32f3a31f9dcdeea3f1f0512adafade4483e Mon Sep 17 00:00:00 2001
From: Matthew Landauer
Date: Mon, 26 Aug 2024 05:00:38 +0000
Subject: [PATCH] Extract bullet list component
---
app/components/bullet_list_component.html.erb | 5 ++
app/components/bullet_list_component.rb | 22 +++++
app/views/api_keys/confirm.html.erb | 37 +++++----
app/views/api_keys/requests/new.html.erb | 30 +++----
app/views/authorities/under_the_hood.html.erb | 56 ++++++-------
app/views/documentation/api_landing.html.erb | 83 ++++++++++++-------
app/views/documentation/get_involved.html.erb | 28 +++++--
7 files changed, 163 insertions(+), 98 deletions(-)
create mode 100644 app/components/bullet_list_component.html.erb
create mode 100644 app/components/bullet_list_component.rb
diff --git a/app/components/bullet_list_component.html.erb b/app/components/bullet_list_component.html.erb
new file mode 100644
index 000000000..d2d0d6b9f
--- /dev/null
+++ b/app/components/bullet_list_component.html.erb
@@ -0,0 +1,5 @@
+
+ <% items.each do |item| %>
+ - <%= item %>
+ <% end %>
+
diff --git a/app/components/bullet_list_component.rb b/app/components/bullet_list_component.rb
new file mode 100644
index 000000000..c736bf729
--- /dev/null
+++ b/app/components/bullet_list_component.rb
@@ -0,0 +1,22 @@
+# typed: strict
+# frozen_string_literal: true
+
+class BulletListComponent < ViewComponent::Base
+ extend T::Sig
+
+ renders_many :items
+
+ sig { params(space: T.nilable(Integer)).void }
+ def initialize(space: nil)
+ super
+
+ space_css = if space == 6
+ "space-y-6"
+ elsif space.nil?
+ ""
+ else
+ raise "Unexpected space value: #{space}"
+ end
+ @space_css = T.let(space_css, String)
+ end
+end
diff --git a/app/views/api_keys/confirm.html.erb b/app/views/api_keys/confirm.html.erb
index b8ccc9a23..de2bf7ec7 100644
--- a/app/views/api_keys/confirm.html.erb
+++ b/app/views/api_keys/confirm.html.erb
@@ -10,24 +10,25 @@
We trust you. Don’t be a dickhead. We’re giving you this and your end of the deal is this:
- <%# TODO: Extract component for bullet list %>
-
- -
- Do NOT use this for commercial purposes. That includes any activity happening inside a commercial organisation. It doesn't matter
- whether something will be free or not. You can, however, use this for evaluation purposes. Beyond that you need to
- <%# TODO: Extract this special path into a helper %>
- <%= pa_link_to "contact us to enter into a commercial agreement for access", api_contact_path %>.
-
- -
- You have to attribute the OpenAustralia Foundation and Planning Alerts on your website or application.
-
- -
- Don't use the service (or information obtained from the service) to market goods or services to individuals
-
- -
- Don't use the service (or information obtained from the service) to harass or intimidate a person.
-
-
+
+ <%= render BulletListComponent.new(space: 6) do |c| %>
+ <%= c.with_item do %>
+ Do NOT use this for commercial purposes. That includes any activity happening inside a commercial organisation. It doesn't matter
+ whether something will be free or not. You can, however, use this for evaluation purposes. Beyond that you need to
+ <%# TODO: Extract this special path into a helper %>
+ <%= pa_link_to "contact us to enter into a commercial agreement for access", api_contact_path %>.
+ <% end %>
+ <%= c.with_item do %>
+ You have to attribute the OpenAustralia Foundation and Planning Alerts on your website or application.
+ <% end %>
+ <%= c.with_item do %>
+ Don't use the service (or information obtained from the service) to market goods or services to individuals
+ <% end %>
+ <%= c.with_item do %>
+ Don't use the service (or information obtained from the service) to harass or intimidate a person.
+ <% end %>
+ <% end %>
+
<%= pa_button_to "I understand", api_keys_path, method: :post %>
diff --git a/app/views/api_keys/requests/new.html.erb b/app/views/api_keys/requests/new.html.erb
index 1ca97b138..0edf8fb1e 100644
--- a/app/views/api_keys/requests/new.html.erb
+++ b/app/views/api_keys/requests/new.html.erb
@@ -12,20 +12,22 @@
Under certain very specific circumstances we may grant you access to the API for free. You must:
-
- -
- Not be making money in any way using the API or in a related service - some more words that explain this in detail
-
- -
- Not be funded
-
- -
- Not unduly restricting access to the end result - should be available to the public
-
- -
- You have don't oodles lying around that you could use to pay for API access
-
-
+
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ Not be making money in any way using the API or in a related service - some more words that explain this in detail
+ <% end %>
+ <%= c.with_item do %>
+ Not be funded
+ <% end %>
+ <%= c.with_item do %>
+ Not unduly restricting access to the end result - should be available to the public
+ <% end %>
+ <%= c.with_item do %>
+ You have don't oodles lying around that you could use to pay for API access
+ <% end %>
+ <% end %>
+
<%# TODO: Note that almost none of content is yet relevant to our situation. It's mostly a placeholder %>
diff --git a/app/views/authorities/under_the_hood.html.erb b/app/views/authorities/under_the_hood.html.erb
index 6b87d5b4a..56bf3d304 100644
--- a/app/views/authorities/under_the_hood.html.erb
+++ b/app/views/authorities/under_the_hood.html.erb
@@ -60,36 +60,36 @@
<%= render HeadingComponent.new(tag: :h2).with_content("What you can do next") %>
-
+
If something isn't right with the scraper or the data coming in then you could do one or several of the following:
-
- -
- <%= pa_link_to "Report or view scraper issues", github_issues_url %>
-
- -
- <%= pa_link_to "Fork the scraper on Github", github_url(@authority) %>
- and try to fix it
-
- -
- If it's an issue with the council website, then contact
- <%= @authority.full_name %>
-
- -
- Contact us for help
-
-
-
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Report or view scraper issues", github_issues_url %>
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Fork the scraper on Github", github_url(@authority) %>
+ and try to fix it
+ <% end %>
+ <%= c.with_item do %>
+ If it's an issue with the council website, then contact
+ <%= @authority.full_name %>
+ <% end %>
+ <%= c.with_item do %>
+ Contact us for help
+ <% end %>
+ <% end %>
+
If everything is working fine right now but you want to help if something goes wrong:
-
- -
- <%= pa_link_to "Watch the scraper", morph_url(@authority) %>
- on morph.io, so you will get an email if it errors. Press the "Watch" button in the top right while you're logged in to morph.io.
-
- -
- <%= pa_link_to "View any scraper issues", github_issues_url %>.
- Help fix them or comment on them if they are out of date
-
-
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Watch the scraper", morph_url(@authority) %>
+ on morph.io, so you will get an email if it errors. Press the "Watch" button in the top right while you're logged in to morph.io.
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "View any scraper issues", github_issues_url %>.
+ Help fix them or comment on them if they are out of date
+ <% end %>
+ <% end %>
diff --git a/app/views/documentation/api_landing.html.erb b/app/views/documentation/api_landing.html.erb
index b22ccc2e7..19b202577 100644
--- a/app/views/documentation/api_landing.html.erb
+++ b/app/views/documentation/api_landing.html.erb
@@ -57,11 +57,14 @@
AUD
/ month
- <%# TODO: Use extracted component %>
-
- <%# TODO: Calculate and format this automatically %>
- - Return up to 100,000 applications per day
-
+
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ <%# TODO: Calculate and format this automatically %>
+ Return up to 100,000 applications per day
+ <% end %>
+ <% end %>
+
<%= pa_link_to "Contact us", api_contact_path, extra_classes: "block" %> to apply
@@ -81,13 +84,20 @@
AUD
+ GST / month
- <%# TODO: Use extracted component %>
-
- <%# TODO: Calculate and format this automatically %>
- - Return up to 500,000 applications per day
- - 1 product
- - Priority email support
-
+
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ <%# TODO: Calculate and format this automatically %>
+ Return up to 500,000 applications per day
+ <% end %>
+ <%= c.with_item do %>
+ 1 product
+ <% end %>
+ <%= c.with_item do %>
+ Priority email support
+ <% end %>
+ <% end %>
+
<%= pa_link_to "Contact us", api_contact_path, extra_classes: "block" %>
@@ -106,16 +116,28 @@
Potential add ons can include:
- <%# TODO: Use extracted component %>
-
- - Access to bulk data API
- - Multiple products
- <%# TODO: Calculate and format this automatically %>
- - Return more than 500,000 applications per day
- - Customised integration options
- <%# TODO: Should we include this? %>
- - Resale of data
-
+
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ <%# TODO: Add documentation for bulk data API %>
+ Access to bulk data API
+ <% end %>
+ <%= c.with_item do %>
+ Multiple products
+ <% end %>
+ <%= c.with_item do %>
+ <%# TODO: Calculate and format this automatically %>
+ Return more than 500,000 applications per day
+ <% end %>
+ <%= c.with_item do %>
+ Customised integration options
+ <% end %>
+ <%= c.with_item do %>
+ <%# TODO: Should we include this? %>
+ Resale of data
+ <% end %>
+ <% end %>
+
<%= pa_link_to "Contact us", api_contact_path, extra_classes: "block" %>
@@ -131,14 +153,15 @@
In our API you can find Australia-wide data, updated daily:
- <%# TODO: Extract component for bulleted list %>
-
- - Single Location by longitude/latitude
- - Area by longitude/latitude
- - Planning authority
- - Postcode
- - Suburb
-
+
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item.with_content("Single Location by longitude/latitude") %>
+ <%= c.with_item.with_content("Area by longitude/latitude") %>
+ <%= c.with_item.with_content("Planning authority") %>
+ <%= c.with_item.with_content("Postcode") %>
+ <%= c.with_item.with_content("Suburb") %>
+ <% end %>
+
<%# # TODO: Explain the general shape of the returned data. So far we've only explained how we can search for it. %>
diff --git a/app/views/documentation/get_involved.html.erb b/app/views/documentation/get_involved.html.erb
index 106963e7f..e28d11fa1 100644
--- a/app/views/documentation/get_involved.html.erb
+++ b/app/views/documentation/get_involved.html.erb
@@ -83,14 +83,26 @@
These include:
-
- - <%= pa_link_to "Aten Systems", "https://www.atensystems.com/councillink" %>
- - <%= pa_link_to "Civica", "https://www.civica.com/en-au/container---product-pages/authority-enterprise-suite/" %>
- - <%= pa_link_to "Internetrix", "https://www.internetrix.com.au/" %>
- - <%= pa_link_to "ITVision", "https://www.itvision.com.au/our-solutions/synergyonline-product-suite.aspx" %>
- - <%= pa_link_to "SolOrient", "http://www.solorient.com.au/" %>
- - <%= pa_link_to "Technology One", "https://www.technologyonecorp.com/products/planningxchange" %>
-
+ <%= render BulletListComponent.new do |c| %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Aten Systems", "https://www.atensystems.com/councillink" %>
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Civica", "https://www.civica.com/en-au/container---product-pages/authority-enterprise-suite/" %>
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Internetrix", "https://www.internetrix.com.au/" %>
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "ITVision", "https://www.itvision.com.au/our-solutions/synergyonline-product-suite.aspx" %>
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "SolOrient", "http://www.solorient.com.au/" %>
+ <% end %>
+ <%= c.with_item do %>
+ <%= pa_link_to "Technology One", "https://www.technologyonecorp.com/products/planningxchange" %>
+ <% end %>
+ <% end %>
Please