-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Taxonomy email alert signup pages #33
Conversation
397211a
to
df7e112
Compare
- Remove unused @mock-email-alert-api tag. - Remove manually added lines from support/env.rb - this is a generated file and shouldn't be modified. - Rename the helper that adds GovukContentSchemaExamples to World, more accurately reflecting what it does. - Extract a slimmer helper from env.
Ensure that we can only stub methods that exist on instances of the GdsApi:EmailAlertApi object.
- Use the verifying instance double of email-alert-api in the existing email alert feature. - Setup a route specific to the test environment to test redirecting to govdelivery subscription url.
2.3.1 is the minimum version required by govuk_taxonomy_helpers.
Update frontend toolkit and add elements to bring in necessary sass for checkboxes.
Add show/hide content javascript and show and hide form submits.
Includes addition of 'Get email alerts' to breadcrumb and refactoring of the TaxonomySignupsController.
Stops sporadic failures caused by network requests to static.
efa23f8
to
3259a2d
Compare
3259a2d
to
272524f
Compare
17f6d14
to
496395a
Compare
745c1c1
to
d9c455c
Compare
09319a5
to
b15d158
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the pages don't have a blank line at the bottom of them which would be good to add from a consistency point of view if your keen. :)
@@ -15,3 +17,5 @@ | |||
margin: 20px 0; | |||
} | |||
} | |||
|
|||
@import "taxonomy-signup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated from line 5 above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
def confirm | ||
redirect_to '/' and return unless params[:'taxon-list'].present? | ||
|
||
taxon_path = params[:'taxon-list'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we look to have called the same thing 3 different names in the params: paths
, taxon-list
and taxon_path
are we able to use something consistent or are these three different things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, naming consistency needs looking at - was going to do this in a followup PR but i'll commit something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated - I've opted to call the query param 'topic' across the controller and view. This is how we describe taxons to users so probably sensible to use that in the URL.
redirect_to '/' and return unless params[:paths].present? | ||
|
||
taxon_path = params[:paths].first | ||
load_taxon(taxon_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens here if this fails to find the taxon? does the breadcrumb stuff breaks should it redirect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaks noisily if it can't find a taxon with the given base path, which is reasonable i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dwhenry added a controller test for this.
app/models/taxonomy_signup.rb
Outdated
{ | ||
'title' => taxon['title'], | ||
'links' => { | ||
'taxons' => [taxon['content_id']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have called this taxon_tree
when it is passed through with the content_item
so I think that is the field we should be subscribing to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quite right, updated.
|
||
<p class='email-option form-block'>or only one of the following</p> | ||
|
||
<% @taxon.dig('links', 'child_taxons').each_with_index do |taxon, taxon_index| %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be nicer to use:
<%= render partial: "taxon", collection: @taxon.dig('links', 'child_taxons') %>
this would give youn the index
variable in then view rather than having to pass it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not worth it in this case, less clear whats going on - particularly as you then need to handle a default value for when you're rendering the parent taxon with this partial.
@@ -0,0 +1,43 @@ | |||
class TaxonomySignupsController < ApplicationController | |||
def new | |||
redirect_to '/' and return unless params[:paths].present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be redirecting back rather than to root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would break in the absence of a referer - redirecting to root is the simplest thing to do in this case, especially as you'd never have a link on the site without the paths specified.
@@ -3,6 +3,7 @@ | |||
<head> | |||
<title><%= yield :title %> - GOV.UK</title> | |||
<%= stylesheet_link_tag "application" %> | |||
<%= javascript_include_tag 'application' %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this only be loaded in the footer? or at least lazy-loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that doesn't work in our layouts, this is the way it's done in the frontends I've seen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved, although as discussed this is handled by slimmer (checked with @NickColley )
Can you add some screenshots? |
@tijmenb added |
@@ -3,7 +3,8 @@ source 'https://rubygems.org' | |||
gem 'rails', '4.2.5.2' | |||
gem 'slimmer', '10.0.0' | |||
|
|||
gem 'govuk_frontend_toolkit', '~> 3.1.0' | |||
gem 'govuk_elements_rails', '~> 3.0.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're currently not using GOV.UK Elements on any GOV.UK Publishing frontend applications.
Seems as though the kind of UI you're implementing it makes sense to make use of Elements, just Elements is technically built in a different way to the rest of GOV.UK Publishing frontend.
Maybe let's have a chat through it offline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know you don't have or hardly have anything like this on GOV.UK. Looks like you had a chat about it though, so that's good.
@@ -0,0 +1,172 @@ | |||
;(function (global) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between this and https://github.com/alphagov/govuk_frontend_toolkit/blob/c88df4977fbb1d63950e8d19cc7dfbd02ede0709/javascripts/govuk/show-hide-content.js ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NickColley nothing, from the looks of it. The frontend work in this PR is almost entirely @carolinegreen . I would assume that with the removal of govuk_frontend_toolkit from this project, the show-hide-content javascript was simply copied across out of pragmatism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mobaig @carolinegreen did govuk_frontend_toolkit conflict with govuk_elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NickColley Unfortunately @carolinegreen is on holiday this week : (.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I wasn't familiar with rails asset pipeline, and was making sure it worked before I put that in. Managed to miss this, I've put in a pull request for this now.
In your screenshots looks like there are indentation issues, the breadcrumbs should line up with the body of the page. |
<%= render 'govuk_component/breadcrumbs', breadcrumbs: @breadcrumbs %> | ||
|
||
<div class='email-signup column-two-thirds'> | ||
<div class="govuk-title length-long"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might work with http://govuk-component-guide.herokuapp.com/components/title
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use the component instead.
781ab90
to
09cf32e
Compare
Specifically, these failures scenarios: - the absence of the expected query param - not finding an item in the content store
- Add missing div and class for grid system, thus correcting alignment of page with breadcrumbs. - Use a govuk_component for the title on both signup pages.
619e75b
to
b0cf74e
Compare
As discussed would prefer not to use |
011aa7e
to
ce64de0
Compare
Add the taxonomy email alert signup pages, served from
/email-alert
.This PR includes some initial cleaning up of the test suite and dependencies - recommend using this diff to review the actual feature.
https://trello.com/c/lPlSbZnX/166-3-build-3-types-of-sign-up-pages-backend
New sign up (when child taxons present)
New sign up (when looking at leaf taxon)
Confirm page