Prototype for civil registration journeys.
git clone https://github.com/HMPO/civil-registration-prototype.git
cd
to the directory where the project is, then run:
npm install
npm start
This will build sources, and serve pages.
Visit localhost:3000 in your browser.
Visit https://civil-registration-prototypes.herokuapp.com/ in your browser.
It may take a few seconds to load.
Get yourself a Heroku account and added to the prototype app.
Add the Heroku remote (that you will push to, to deploy):
heroku git:remote -a civil-registration-prototypes
To deploy the main branch:
git push heroku main
Once your prototype is ready for testing, it’s time to create an archived version.
Below is a step-by-step process on how to do this.
git tag YYMMDD-feature-name
Alternatively, you can add a message with your tag, similar to commits. This is known as an annotated tag:
git tag -a YYMMDD-feature-name -m "First iteration of feature-name for lab 1"
git push --tags origin main
You should be able to see that git has pushed your tag to the remote:
To https://github.com/HMPO/civil-registration-prototype.git
* [new tag] YYMMDD-feature-name -> YYMMDD-feature-name
Tags can be checked out similar to branches.
If you’re not already at the specific commit you want to archive:
git checkout YYMMDD-feature-name
Create a new branch from that specific commit or tag:
git checkout -b archive/feature-branch-name-v1
Make relevant changes, such as removing links from the app’s start page, the navigation, etc.
git commit -m “Update start page to archive feature-name lab session 1”
git push origin +archive/feature-branch-name-v1
Each prototype archive will be hosted on a separate Heroku app.
heroku apps:create gro-YYMMDD-feature-name -r heroku-feature-name-v1 --region eu
gro-YYMMDD-feature-name
becomes the subdomain in the URL of the Heroku app.
heroku-feature-name-v1
is the remote added to your repository.
To deploy from another branch, where archive/feature-branch-name-v1
is the branch you want to push:
git push heroku-feature-name-v1 archive/feature-branch-name-v1:main
https://github.com/alphagov/accessible-autocomplete
1 - npm install --save accessible-autocomplete
2 - npm install --save browserify
3 - create an empty javascript file typeahead.js in app/assets/javascripts for now.
(a). browserify bundle your javascript code, and later you can reference it.
4 - in the above created file add this code.
const accessibleAutocomplete = require('accessible-autocomplete');
const countries = [
'France',
'Germany',
'United Kingdom'
]
accessibleAutocomplete({
element: document.querySelector('#my-autocomplete-container'),
id: 'my-autocomplete', // To match it to the existing <label>.
source: countries
})
5 - run browserify command as follow:
browserify typeahead.js -o bundle.js
(a). make sure that you are on the root level of file step-3. and you
can run ls
so that your javascript file is listed.
(b). run ls
and you should see bundle.js
6 - add script reference: in this project we add scripts on location.
/app/views/includes/scripts.html
(a). add <script src="/public/javascripts/bundle.js"></script>
7 - Now it's time to use :).
<label id="my-autocomplete">Select your country</label>
<div id="my-autocomplete-container"></div>