Skip to content
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

Hoff 113- added Hof skeleton project #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
node_modules
.DS_Store
public
.env
yarn-error.log
apps/**/translations/**/*
!apps/**/translations/src/
!apps/**/translations/src/**/*
.vscode
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 UKHomeOffice

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# hof-skeleton
# Hof skeleton
This is to get you started with HOF. Use this to create a new project.

## Install prerequisites

Step 1 : Install Node Version Manager

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# or
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# or
brew install nvm

Check the version nvm --version

Step 2 : nvm install 18.19.0

Step 3: nvm use 18.19.0

Step 4: npm i -g yarn

Step 5: yarn

Step 6: yarn run start:dev

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would highly recommend reading about how to do documentation on github https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github

Whenever you put in codeblocks, the common practice is to use backticks


- [Node.js](https://nodejs.org/en/) - Tested against LTS
- NPM (installed with Node.js) - Works with versions 2 and 3
- [Redis server](http://redis.io/download) running on the default port


### Replacing existing project and settings with a prefered project name

- In the apps folder rename the existing folder 'hof-project'.

> Example apps/hof-project --> apps/name-of-project .

- navigate to the index.js file on line-4 replace 'hof-project'.

> Example name: 'hof-project' --> name: 'name-of-project'.

- navigate to hof-settings.json on line-8 replace the app route.

> Example "routes": [
"./apps/hof-project" --> "./apps/name-of-project".
],
7 changes: 7 additions & 0 deletions apps/hof-project/fields/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
name: {
mixin: 'input-text'
}
};
21 changes: 21 additions & 0 deletions apps/hof-project/index.js
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change

'/confirmation': {
      backLink: false
 }

to

'/confirmation': {
     clearSession: true
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have unresolved this as I can't see the change - has it been pushed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should say clearSession: true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes push already i have no idea why the changes not coming on

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

const SummaryPageBehaviour = require('hof').components.summary;

module.exports = {
name: 'hof-project',
steps: {
'/start': {
fields: ['name'],
next: '/confirm'
},
'/confirm': {
behaviours: [SummaryPageBehaviour],
sections: require('./sections/summary-data-sections'),
next: '/confirmation'
},
'/confirmation': {
backLink: false
}
}
};
7 changes: 7 additions & 0 deletions apps/hof-project/sections/summary-data-sections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
start: [
'name'
]
};
6 changes: 6 additions & 0 deletions apps/hof-project/translations/src/en/buttons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"start": "Start Now",
"edit": "Change",
"continue": "Continue",
"confirm-submission": "Submit"
}
5 changes: 5 additions & 0 deletions apps/hof-project/translations/src/en/fields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": {
"label": "Hof project name (if known)"
}
}
4 changes: 4 additions & 0 deletions apps/hof-project/translations/src/en/journey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"header": "New HOF Service Form",
"phase": "beta"
}
18 changes: 18 additions & 0 deletions apps/hof-project/translations/src/en/pages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"start": {
"header": "Welcome to Hof Project"
},
"confirm": {
"header": "Check your answers",
"sections": {
"name": {
"header": "Hof Project Details"
}
},
"fields": {
"name": {
"label": "Project Name"
}
}
}
}
1 change: 1 addition & 0 deletions apps/hof-project/translations/src/en/validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions apps/hof-project/views/partials/confirmation-alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="govuk-panel govuk-panel--confirmation" role="alert">
<h1 govuk-panel__title>{{#t}}journey.confirmation.message{{/t}}</h1>
</div>
Binary file added assets/images/ho-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/no-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions assets/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

require('hof/frontend/themes/gov-uk/client-js');
const govuk = require('govuk-frontend');
const $ = require('jquery');
const accessibleAutocomplete = require('accessible-autocomplete');


$('.typeahead').each(function applyTypeahead() {
accessibleAutocomplete.enhanceSelectElement({
defaultValue: '',
selectElement: this
});
});

govuk.initAll();
202 changes: 202 additions & 0 deletions assets/scss/app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
@import "hof/frontend/themes/gov-uk/styles/govuk";

ul {
@extend .govuk-list--bullet;
}

a {
@extend .govuk-link;
}

// Accessible autocomplete
.autocomplete__wrapper {
position: relative;
}

.autocomplete__hint,
.autocomplete__input {
-webkit-appearance: none;
border: 2px solid #0b0c0c;
border-radius: 0;
/* Safari 10 on iOS adds implicit border rounding. */
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
margin-bottom: 0;
/* BUG: Safari 10 on macOS seems to add an implicit margin. */
width: 100%;
}

.autocomplete__input {
background-color: transparent;
position: relative;
}

.autocomplete__hint {
color: #b1b4b6;
position: absolute;
}

.autocomplete__input--default {
padding: 5px;
}

.autocomplete__input--focused {
outline: 3px solid #fd0;
outline-offset: 0;
box-shadow: inset 0 0 0 2px;
}

.autocomplete__input--show-all-values {
padding: 5px 34px 5px 5px;
/* Space for arrow. Other padding should match .autocomplete__input--default. */
cursor: pointer;
}

.autocomplete__dropdown-arrow-down {
z-index: -1;
display: inline-block;
position: absolute;
right: 8px;
width: 24px;
height: 24px;
top: 10px;
}

.autocomplete__menu {
background-color: #fff;
border: 2px solid #0B0C0C;
border-top: 0;
color: #0B0C0C;
margin: 0;
max-height: 342px;
overflow-x: hidden;
padding: 0;
width: 100%;
width: calc(100% - 4px);
}

.autocomplete__menu--visible {
display: block;
}

.autocomplete__menu--hidden {
display: none;
}

.autocomplete__menu--overlay {
box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;
left: 0;
position: absolute;
top: 100%;
z-index: 100;
}

.autocomplete__menu--inline {
position: relative;
}

.autocomplete__option {
border-bottom: solid #b1b4b6;
border-width: 1px 0;
cursor: pointer;
display: block;
position: relative;
}

.autocomplete__option>* {
pointer-events: none;
}

.autocomplete__option:first-of-type {
border-top-width: 0;
}

.autocomplete__option:last-of-type {
border-bottom-width: 0;
}

.autocomplete__option--odd {
background-color: #FAFAFA;
}

.autocomplete__option--focused,
.autocomplete__option:hover {
background-color: #1d70b8;
border-color: #1d70b8;
color: white;
outline: none;
}

.autocomplete__option--no-results {
background-color: #FAFAFA;
color: #646b6f;
cursor: not-allowed;
}

.autocomplete__hint,
.autocomplete__input,
.autocomplete__option {
font-size: 16px;
line-height: 1.25;
}

.autocomplete__hint,
.autocomplete__option {
padding: 5px;
}

@media (min-width: 641px) {

.autocomplete__hint,
.autocomplete__input,
.autocomplete__option {
font-size: 19px;
line-height: 1.31579;
}
}

//Cookie banner styling

#cookie-banner {
#cookie-banner-actions {
font-size: 65% !important;
width: 66.667% !important;
}
}

pre.looped-records {
white-space: pre-wrap;
word-wrap: break-word;
word-break: break-all;
}

/* Links instead of regular buttons */
.button-as-link .govuk-button {
background-color: Transparent;
background: none !important;
border: none;
padding: 0 !important;
font-family: inherit;
line-height: 25px;
-webkit-box-shadow: 0 0px 0 #003618;
box-shadow: 0 0px 0 #003618;
text-decoration: underline;
cursor: pointer;
margin-bottom: 1em;
color: #1d70b8;
font-size: 1em;
}

.button-as-link:active {
background: #ffdd00;
}

.button-as-link .govuk-button:active {
color: black;
line-height: 23px;
border-bottom-style: solid;
border-bottom-color: black;
border-bottom-width: 4px;
text-decoration: none;
}
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = {};
14 changes: 14 additions & 0 deletions hof.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"appName": "Hof Skeleton Project",
"theme": "govUK",
"behaviours": [
"hof/components/clear-session"
],
"routes": [
"./apps/hof-project"
],
"session": {
"name": "hof-project.hof.sid"
},
"getAccessibility": true
}
Loading