Web component postcode box#572
Open
ajparsons wants to merge 5 commits into
Open
Conversation
If values have been pre-populated, store to pass over to write page
- Stop skipping the who page if there's a single rep, when a purpose parameter is set to find
- Upgrades the plain form with language switcher - Adds styling and descriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(I'll need to do some rearranging of this as I fix up those bits in the markdown-help branch - but these are mostly independent choices)
In tidying up the help pages, I found our embeddable form to put a postcode lookup on another site! This PR fixes a few things and gives it a new coat of paint so we can use it as part of the making contact project.
Fixing things up and adding some new parameter options
When we introduced the message type screen, we broke an assumption around how passed in fields like name etc propagate to the writing page. This just ensures that all fields sent to the who page get passed until they end up on the right page.
Similarly, as it fits into the general pattern here - I've made message_type able to be passed through.
To enable something in the next step, I've made it possible to specify if there is a single option shown, the who page should not be skipped (so it can be used to create a 'find out about your MP' link rather than a write to your MP link).
Web component
The big thing here is wrapping the previous approach (which was a few variations of a form with all the formatting included) in a web component approach and creating a useful form builder to customise it.
There is a basic approach (a form that will send a postcode to wtt) that is enhanced by our javascript file to style and add further options. This includes a language switcher (options modeled on the approach taken by democracy club). Forms are given a purpose to either write or find out about representatives - and can be customised to just certain levels of representation.
I've decided that the JS itself contains the translations - as it was fiddly in PHP to access both sets at once and this means if we fix things up it will fix up already installed versions. Similarly decided against an iframe approach (which is what democracy club do) - as it's a bit more complicated at this point to change more of the flow.
A decision to check: as we run the JS on the other website, this passes the current page in as an external ref so we can see the origins of messages in other campaigns.
I've taken out references to the wordpress plugin for the moment - but if we get this merged creating a new wordpress gutenberg component for this approach would not be difficult.
Link generator
Taking some of those same form components to make it a bit easier to customise a link without knowledge of our internal identifiers.