diff --git a/Gemfile b/Gemfile index 0d6aec6e38..5781e79436 100644 --- a/Gemfile +++ b/Gemfile @@ -112,7 +112,7 @@ gem 'asset_sync' gem 'fog-aws', '>= 3.14.0' # Use CCS Frontend Helpers -gem 'ccs-frontend_helpers', '~> 0.1.1' +gem 'ccs-frontend_helpers', '~> 0.1.2' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index d916c78729..6dc8648f24 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -168,7 +168,7 @@ GEM caxlsx_rails (0.6.3) actionpack (>= 3.1) caxlsx (>= 3.0) - ccs-frontend_helpers (0.1.1) + ccs-frontend_helpers (0.1.2) rails (>= 6.0) clamby (1.6.8) cliver (0.3.2) @@ -649,7 +649,7 @@ DEPENDENCIES caracal-rails (>= 1.0.2) caxlsx (>= 3.2.0) caxlsx_rails (>= 0.6.3) - ccs-frontend_helpers (~> 0.1.1) + ccs-frontend_helpers (~> 0.1.2) cucumber-rails (>= 2.6.1) database_cleaner (>= 2.0.1) date_validator (>= 0.12.0) diff --git a/app/assets/fonts/bold-affa96571d-v2.woff b/app/assets/fonts/bold-affa96571d-v2.woff deleted file mode 100755 index 48fbcf59c0..0000000000 Binary files a/app/assets/fonts/bold-affa96571d-v2.woff and /dev/null differ diff --git a/app/assets/fonts/bold-b542beb274-v2.woff2 b/app/assets/fonts/bold-b542beb274-v2.woff2 deleted file mode 100755 index 81fd14985d..0000000000 Binary files a/app/assets/fonts/bold-b542beb274-v2.woff2 and /dev/null differ diff --git a/app/assets/fonts/light-94a07e06a1-v2.woff2 b/app/assets/fonts/light-94a07e06a1-v2.woff2 deleted file mode 100755 index 1eb101571b..0000000000 Binary files a/app/assets/fonts/light-94a07e06a1-v2.woff2 and /dev/null differ diff --git a/app/assets/fonts/light-f591b13f7d-v2.woff b/app/assets/fonts/light-f591b13f7d-v2.woff deleted file mode 100755 index 3b26d5ffda..0000000000 Binary files a/app/assets/fonts/light-f591b13f7d-v2.woff and /dev/null differ diff --git a/app/assets/images/.keep b/app/assets/images/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/assets/images/ccs-opengraph-image.png b/app/assets/images/ccs-opengraph-image.png new file mode 100644 index 0000000000..eba8eb170f Binary files /dev/null and b/app/assets/images/ccs-opengraph-image.png differ diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss deleted file mode 100644 index b650c48760..0000000000 --- a/app/assets/stylesheets/_settings.scss +++ /dev/null @@ -1,58 +0,0 @@ -// Override any GOVUK settings here - -$govuk-font-url-function: 'font-url'; -$govuk-image-url-function: 'image-url'; - -$govuk-global-styles: true; - -$govuk-compatibility-govukfrontendtoolkit: false; -$govuk-compatibility-govuktemplate: false; -$govuk-compatibility-govukelements: false; - -$ccs-colours: ( - "primary": #9B1A47, - "grey-1": #6f777b, - "grey-2": #bfc1c3, - "grey-3": #dee0e2, - "grey-4": #f8f8f8, - "green-2": #F0FFF1, - "green-3": #006435, - "button-green": #007E8A, - "red": #9b1a47, - "dark-red": #85163d, - "white": #ffffff, - - "mid-grey": #b1b4b6, - "black": #2f2f2f -); - -@function ccs-colour($colour) { - $colour: quote($colour); - - @if not map-has-key($ccs-colours, $colour) { - @error "Unknown colour `#{$colour}`"; - } - - @return map-get($ccs-colours, $colour); -} - -@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700'); - -$govuk-font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; -$govuk-font-family-print: sans-serif; - -$govuk-font-weight-light: 300; -$govuk-font-weight-regular: 400; -$govuk-font-weight-semi-bold: 600; -$govuk-font-weight-bold: 700; - -$govuk-heading-xl: 48px; -$govuk-heading-l: 27px; - -$govuk-button-background-colour: ccs-colour("button-green"); -$ccs-border-colour: ccs-colour("mid-grey"); -$ccs-brand-colour: ccs-colour("red") !default; - -#main-footer .ccs-footer__links { - text-decoration: underline; -} diff --git a/app/assets/stylesheets/ccs/_all.scss b/app/assets/stylesheets/ccs/_all.scss deleted file mode 100644 index 940d2e6aeb..0000000000 --- a/app/assets/stylesheets/ccs/_all.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "facilities-management/all"; -@import "govuk-frontend-overrides"; diff --git a/app/assets/stylesheets/ccs/_ccs.scss b/app/assets/stylesheets/ccs/_ccs.scss new file mode 100644 index 0000000000..f5cba79275 --- /dev/null +++ b/app/assets/stylesheets/ccs/_ccs.scss @@ -0,0 +1,59 @@ +.error-box { + display: flex; + flex-direction: column; + height: 100vh; +} + +.error-content { + flex: 1 0 auto; +} + +.button_as_link { + font-size: 1em; + border: 0; + text-decoration: underline; + color: $govuk-link-colour; + background-color: inherit; + padding: 0; + margin: 0; + + &:link { + color: $govuk-link-colour; + } + + &:visited { + color: $govuk-link-visited-colour; + } + + &:hover:not(:focus), + &:active:not(:focus) { + color: $govuk-link-hover-colour; + } + + &:hover { + cursor: pointer; + } +} + +.supplier-rates-td { + border: none !important; +} + +.govuk-brand-light-grey-benchmark { + color: #6f777b !important; +} + +%govuk-section-break--s { + @include govuk-responsive-margin(2, "top"); + @include govuk-responsive-margin(2, "bottom"); +} + +.govuk-section-break--s { + @extend %govuk-section-break--s; +} + +.ccs-no-underline, +.govuk-warning-text abbr, +abbr { + text-decoration: none; +} diff --git a/app/assets/stylesheets/ccs/_govuk-frontend-overrides.scss b/app/assets/stylesheets/ccs/_govuk-frontend-overrides.scss deleted file mode 100644 index 52b95f2939..0000000000 --- a/app/assets/stylesheets/ccs/_govuk-frontend-overrides.scss +++ /dev/null @@ -1,92 +0,0 @@ -.govuk-label--s { - font-weight : 600; - } - -.button_as_link { - font-size: 1em; - border: 0; - text-decoration: underline; - color: $govuk-link-colour; - background-color: inherit; - padding: 0; - margin: 0; - - &:link { - color: $govuk-link-colour - } - - &:visited { - color: $govuk-link-visited-colour - } - - &:hover:not(:focus), - &:active:not(:focus) { - color: $govuk-link-hover-colour - } - - &:hover { - cursor: pointer; - } -} - -.govuk-align-center-table__td { - text-align: center !important; -} -.govuk-align-left-table__td { - text-align: left !important; -} -.supplier-rates-td { - border: none !important; -} -.govuk-brand-light-grey { - color: #cecece !important; -} -.govuk-brand-light-grey-benchmark { - color:#6F777B !important; -} -.govuk-header_muted { - color: #6F777B; -} -.bg_gov-mssg { - background-color: #6F777B; - color: #FFFFFF; - padding: 5px; -} -.govuk-border-bottom_none { - border-bottom: 0px !important; -} - -body.js-enabled #ccs-accordion-with-basket { - .basket, - .govuk-checkboxes .ccs-select-all, - .govuk-checkboxes > div + p { - display : block; - } -} - -%govuk-section-break--s { - @include govuk-responsive-margin(2, "top"); - @include govuk-responsive-margin(2, "bottom"); -} - -.govuk-section-break--s { - @extend %govuk-section-break--s; -} - -.govuk-template { - background-color: #ffffff; -} - -.error-box { - display: flex; - flex-direction: column; - height: 100vh; -} - -.error-content { - flex: 1 0 auto; -} - -.govuk-no-border th, .govuk-no-border td { - border: 0 !important; -} diff --git a/app/assets/stylesheets/ccs/facilities-management/_all.scss b/app/assets/stylesheets/ccs/facilities-management/_all.scss deleted file mode 100644 index da7d1a7054..0000000000 --- a/app/assets/stylesheets/ccs/facilities-management/_all.scss +++ /dev/null @@ -1,9 +0,0 @@ -@import "buyer-account.scss"; -@import "filter-component.scss"; -@import "panel.scss"; -@import "procurement-buildings.scss"; -@import "service-specification.scss"; -@import "summary-box"; -@import "summary-list.scss"; -@import "supplier_lot_data"; -@import "supplier-lot-list.scss"; diff --git a/app/assets/stylesheets/ccs/facilities-management/_buyer-account.scss b/app/assets/stylesheets/ccs/facilities-management/_buyer-account.scss deleted file mode 100644 index 612421d957..0000000000 --- a/app/assets/stylesheets/ccs/facilities-management/_buyer-account.scss +++ /dev/null @@ -1,33 +0,0 @@ -.fm-buyer-account-panel__container { - @include govuk-media-query ($from: tablet) { - display: flex; - } -} - -.fm-buyer-account-panel { - border: 1px #DEE0E2 solid; - padding: 10px; - background: #F8F8F8; - margin-bottom: 30px; - - @include govuk-media-query ($from: tablet) { - margin-left: 10px; - margin-right: 10px; - - &:first-child { - margin-left: 15px; - } - } -} - -.fm-buyer-account-panel__title { - color: #007196; - cursor: pointer; - margin-bottom: 5px; -} - -.fm-buyer-account-panel__title_no_link { - color: #007196; - cursor: pointer; - text-decoration: none; -} diff --git a/app/assets/stylesheets/ccs/facilities-management/_filter-component.scss b/app/assets/stylesheets/ccs/facilities-management/_filter-component.scss deleted file mode 100644 index 5d83f5bf43..0000000000 --- a/app/assets/stylesheets/ccs/facilities-management/_filter-component.scss +++ /dev/null @@ -1,19 +0,0 @@ -.filter-component-container-grey { - background-color: #F8F8F8; - margin: 5px; - overflow-x: hidden; -} - -.filter-component-container { - border-style: solid; - border-width: 1px; - border-color: #f3f2f1; - padding-top: 10px; - min-width: 300px; -} - -.filter-component-container details { - background-color: govuk-colour("white"); - padding: govuk-spacing(2); - margin: govuk-spacing(2); -} diff --git a/app/assets/stylesheets/ccs/facilities-management/_procurement-buildings.scss b/app/assets/stylesheets/ccs/facilities-management/_procurement-buildings.scss deleted file mode 100644 index 28263e1268..0000000000 --- a/app/assets/stylesheets/ccs/facilities-management/_procurement-buildings.scss +++ /dev/null @@ -1,7 +0,0 @@ -.procurement-add-buildings-container { - border-style: solid; - border-width: 1px; - border-color: #b1b4b6; - padding-top: 10px; - padding-bottom: 10px; -} diff --git a/app/assets/stylesheets/ccs/facilities-management/_summary-list.scss b/app/assets/stylesheets/ccs/facilities-management/_summary-list.scss deleted file mode 100644 index e215fd4a1a..0000000000 --- a/app/assets/stylesheets/ccs/facilities-management/_summary-list.scss +++ /dev/null @@ -1,4 +0,0 @@ -.ccs-summary-list__value { - min-width:10em; - text-align:right; -} \ No newline at end of file diff --git a/app/assets/stylesheets/ccs/facilities-management/_supplier-lot-list.scss b/app/assets/stylesheets/ccs/facilities-management/_supplier-lot-list.scss deleted file mode 100644 index ffa0cc29ab..0000000000 --- a/app/assets/stylesheets/ccs/facilities-management/_supplier-lot-list.scss +++ /dev/null @@ -1,15 +0,0 @@ -.supplier-lot-list { - @media (max-width: 90em) { - margin-bottom: 50px; - } - - @media (max-width: 1000px) { - margin-bottom: 20px; - } -} - -#supplier-lot-list__container, .filter-pane { - @media (max-width: 1000px) { - width: 100%; - } -} diff --git a/app/assets/stylesheets/components/_all.scss b/app/assets/stylesheets/components/_all.scss index cfe9999271..e70bf8fcd5 100644 --- a/app/assets/stylesheets/components/_all.scss +++ b/app/assets/stylesheets/components/_all.scss @@ -1,17 +1,17 @@ -/* Import from Govuk frontend, refer to govuk-frontend/govuk/components/_all.scss */ -@import "govuk-frontend/govuk/components/all"; - -/* Override with my own components */ +// /* Override GOV.UK/add our CCS components */ +@import "basket/basket"; +@import "checkbox-accordion/checkbox-accordion"; +@import "dashboard-section/dashboard-section"; @import "header/header"; @import "footer/footer"; -@import "details/details"; -@import "documents/documents"; -@import "inset-text/inset-text"; -@import "label/label"; +@import "info-panel/info-panel"; @import "logo/logo"; @import "notification-banner/notification-banner"; +@import "panel/panel"; +@import "password-rules/password-rules"; +@import "progress-bar/progress-bar"; +@import "service-specification/service-specification"; +@import "step-by-step-nav/step-by-step-nav"; +@import "summary-box/summary-box"; +@import "supplier-lot-data/supplier-lot-data"; @import "supplier-record/supplier-record"; -@import "typography/typography"; -/* CCS override and bespoke styles; re-used globally across all modules */ -@import "ccs-global/ccs-global"; -@import "step-by-step-nav/all"; diff --git a/app/assets/stylesheets/components/basket/_basket.scss b/app/assets/stylesheets/components/basket/_basket.scss new file mode 100644 index 0000000000..6bafb18f56 --- /dev/null +++ b/app/assets/stylesheets/components/basket/_basket.scss @@ -0,0 +1,83 @@ +#css-list-basket { + display: none; + + .govuk-heading-m { + margin-left: govuk-spacing(2); + margin-bottom: 0; + } + + #removeAll { + margin: govuk-spacing(2) 0 govuk-spacing(3) govuk-spacing(2); + display: inline-block; + } + + & > .govuk-button { + width: 100%; + } + + & > div { + background-color: ccs-colour("light-grey"); + padding: govuk-spacing(3); + } + + ul.govuk-list { + margin: 0; + + li { + @include govuk-clearfix; + + background-color: govuk-colour("white"); + margin-bottom: 0; + padding: govuk-spacing(2) govuk-spacing(2); + border-top: 1px solid ccs-colour("mid-grey"); + + &:first-child { + border-top: none; + } + + span { + text-align: left; + font-size: 1rem; + top: 0; + top: 0; + float: left; + padding-top: 2px; + width: 66%; + } + + a { + width: 33%; + text-align: right; + font-size: 14px; + font-size: 0.9rem; + position: relative; + top: -2px; + display: inline-block; + } + } + + li:first-child { + border-bottom: none; + } + + @media (max-width: 768px) { + li { + span, + a { + width: 100% !important; + text-align: left !important; + } + } + } + } + + @media (max-width: 641px) { + & > .govuk-button { + display: inline-block; + } + } +} + +body.js-enabled #css-list-basket { + display: block; +} diff --git a/app/assets/stylesheets/components/ccs-global/_ccs-global.scss b/app/assets/stylesheets/components/ccs-global/_ccs-global.scss deleted file mode 100644 index b2ece3b5d2..0000000000 --- a/app/assets/stylesheets/components/ccs-global/_ccs-global.scss +++ /dev/null @@ -1,857 +0,0 @@ -%ccs-font-21 { - font-size : 21px; - font-size : 1.3125rem; - line-height : 1.5; - } - -%ccs-labels-m { - font-size : 17px; - font-size : 1.0625rem; - } - -%clearfix { - &::after { - content : ''; - clear : both; - display : table; - } - } - - -#wrapper { - display : flex; - flex-direction : column; - width : 100%; - min-height: auto !important; - } - -#main-footer { - overflow : hidden; - } - -@media (min-width : 1025px) { - .govuk-width-container { - flex-grow : 1; - width : 100%; - } - } - - - -.ccs-font-weight-semi-bold { - font-weight : 600; - } - -.ccs-landing-pg-content { - padding-bottom : 60px; - } - -.ccs-no-underline, -.govuk-warning-text abbr, -abbr { - text-decoration : none; - } - -.ccs-remove { - display : block; - position : absolute; - left : -3000px; - top : -3000px; - } - -legend + p.ccs-legend-download { - margin-top : -#{govuk-spacing(2)}; - margin-bottom : govuk-spacing(6); - } - -.ccs-next { - text-decoration : none !important; - padding : govuk-spacing(4) 0; - display : block; - width : 100%; - text-align : right; - clear : left; - } - -form.ccs-form { - .govuk-input, - .govuk-textarea, - .govuk-radios__input, - .govuk-input[type="number"], - .js-enabled .govuk-tabs__list, - .js-enabled .govuk-tabs__panel, - .js-enabled .govuk-tabs__tab[aria-selected="true"] { - &:not(:focus) { - border-width : 2px !important; - } - - &:focus { - border-width : 4px !important; - } - } - - .govuk-radios__input + .govuk-radios__label::before { - border-width : 1.6px; - } - - .ccs-govuk-checkboxes--thin { - .govuk-checkboxes__input + .govuk-checkboxes__label::before { - border-width : 1.6px; - } - } - - .js-enabled .govuk-tabs__tab[aria-selected="true"] { - margin-bottom : -2px !important; - } - - .supplier-record__file-download abbr { - position : absolute; - top : -3000px; - left : -3000px; - } - - input:-webkit-autofill, - input:-webkit-autofill:hover, - input:-webkit-autofill:focus, - input:-webkit-autofill:active { - -webkit-box-shadow : 0 0 0 30px #ffffff inset !important; - } - } - -.ccs-tag { - background-color : ccs-colour("grey-1"); - color : govuk-colour("white"); - padding : 0 govuk-spacing(1); - text-align : center; - margin-right : govuk-spacing(1); - - h1[class^="govuk-heading"] &, - h2[class^="govuk-heading"] &, - h3[class^="govuk-heading"] & { - display : inline-block; - vertical-align : middle; - font-size : 1.1rem; - margin-left : govuk-spacing(1); - } - - h1.govuk-heading-xl & { - padding : 0 govuk-spacing(2); - vertical-align : super; - font-size : 1.1rem !important; - font-weight : 600 !important; - } - - p.govuk-body & { - padding : 0 govuk-spacing(2); - } - - a.ccs-no-underline & { - margin-left : govuk-spacing(1); - } - - &-approved, &-completed { - background-color : govuk-colour("green"); - } - - &-canceled, &-failed, &-rejected { - background-color : govuk-colour("red"); - } - - &-in_review, &-in_progress, &-uploading { - background-color : ccs-colour("grey-1"); - } - - .ccs-results-list & { - padding : 0 govuk-spacing(2); - } - } - - - - -a.ccs-print-icon { - padding-left : govuk-spacing(2); - display : inline-block; - - &::before { - content : ' '; - display : inline-block; - width : govuk-spacing(4); - height : govuk-spacing(4); - position : relative; - left : -#{govuk-spacing(2)}; - top : govuk-spacing(1); - background : url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASAgMAAAAvVbb5AAAACVBMVEX///////8KDAwmYEUdAAAAAXRSTlMAQObYZgAAADBJREFUCFtjYOBa1cDAoBkKJFYCCSYwEYpCrAICZCI0FEhkrURmQRRnrYRpW7WqAQAlGR86Ip1rwwAAAABJRU5ErkJggg==') no-repeat center center; - } - } - -ul.ccs-checklist { - list-style : none; - padding : 0; - - & > li { - - b { - display : block; - width : 33%; - float : left; - } - - ul { - list-style : none; - padding-left : 0; - float : left; - width : 66%; - padding-bottom : govuk-spacing(5); - - li { - span.ccs-y, - span.ccs-n { - text-indent : -3000px; - color : transparent; - display : inline-block; - width : govuk-spacing(4); - height : govuk-spacing(4); - margin-right : govuk-spacing(2); - position : relative; - top : 3px; - background-repeat : no-repeat; - background-size : cover; - } - - span.ccs-y { - background-image : url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAACU0lEQVR4Ae3YA6xcQRQG4D+1bdtu58yza9uemefaQRk3dm3btm3btrWd4lnzdHeTbJIT7r332388sNlsDl1OoBOoywmEojAIPtUhgVAsGILZ/hVNcSggFAVq2C9dtqiicQ4B1DgRBxdRiobaFYhA3j9BXERJCrILEIL6QLKfCeMiiqZbDtSwnoa4OZgwIYOlQEjeDYJ+JImTNC8CpwtWJdfFCCdoIZZ1zmjpKIbkHSHpe9I4tiQCZxkQktpDsm8GzbocE3wyGa8kCHUriyC3WqnDubQxwelaGYEzAiLEqzQk3dL1FCEu1VM4CbeEYF8NklsDpTIbbxYgeCn94M2oF7BHCOSVk5lcc0j2xSC5dZjQOYvxbgZh7iUg6Ho8//I+BJU3w1FTMxxtjMAZAaE8i0PS1USa4jaUR5kkkguAoM8GuM0Ib541WftB/eDupPsLu4Eg15IJLF9+kPTJoFm36QGRLdkbVgTyGtCDwuADVzCYF42ZnKu3xn80SG4HhrpmT/GOGnpagWDPDEbeBYR7Fv6fnCcE+2DwzC6o1jlSveWHcq0NQS8MPngGgS6tIem9QXJ7MaJJzjQ7kyCQ6kLQyyQ+bFaS9iPEJ1eaH5oQ5Fofkl6lDscOYpR77nQ71UHwhhDsdQqTO4xwnifdj506SYJkb5KZ3DGogLyWnYshuAskvTUD0gkM8cln+cEd0tXNYMSeQrBHfrvdLEBxD434kOC0M9S1gN2vPhDIvOKsGpKdQygVdJi7GSjuG4GMvqpYAzRP0v/vgAhyK+K8fnMCnUA7128nPTg6GfvQPgAAAABJRU5ErkJggg=='); - } - - span.ccs-n { - background-image : url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAFVBMVEX/////VVWyDx+yDyGyDx6xDh6xDh4Sl4TlAAAAB3RSTlMAA6VWqf/8dNf9xAAAAHRJREFUeNrl1DEOACEIRNEVHe9/ZC2s/komoZWSvERF4Hs8WnSmerSLG5odbmq0i9OWcDoSTlvC/WRIR8JJgetAIpHIzFHS5RIul3C5hDMSjhLOSOM89Ef7x9TL4wvuv7DaFL7NfOMWRsEMV2lc/QLwK+XtWGhtCI1x8c/cAAAAAElFTkSuQmCC'); - } - - details { - margin-top : govuk-spacing(2); - margin-left : govuk-spacing(1); - } - } - } - - } - - @media (max-width : 641px) { - li { - b, ul { - width : 100%; - } - } - } - } - -.chooser-component { - .basket { - display : none; - - .govuk-heading-m { - margin-left : govuk-spacing(2); - margin-bottom : 0; - } - - #removeAll { - margin : govuk-spacing(2) 0 govuk-spacing(3) govuk-spacing(2); - display : inline-block; - - & .ccs-remove { - margin : 0; - } - } - - & > .govuk-button { - width : 100%; - } - - & > div { - background-color : ccs-colour("grey-4"); - padding : govuk-spacing(3); - } - - ul.govuk-list { - margin : 0; - - li { - background-color : govuk-colour("white"); - margin-bottom : 0; - padding : govuk-spacing(2) govuk-spacing(2); - border-top : 1px solid ccs-colour("grey-2"); - - &:first-child { - border-top : none; - } - - @extend %clearfix; - - span { - text-align : left; - font-size : 1rem; - top : 0; - top : 0; - float : left; - padding-top : 2px; - } - - a { - text-align : right; - font-size : 14px; - font-size : 0.9rem; - position : relative; - top : -2px; - display : inline-block; - color : $govuk-link-colour; - - &:hover { - color : $govuk-link-hover-colour; - } - - &:focus { - color: #000000; - } - } - } - - li:first-child { - border-bottom : none; - } - - @media (max-width : 768px) { - li { - span, a { - width : 100% !important; - text-align : left !important; - } - } - } - } - } - - @media (max-width : 641px) { - & > .govuk-button { - display : inline-block; - } - } -} - -.ccs-search-results { - - .ccs-search-results__sort { - float : right; - clear : left; - margin : 0 3px govuk-spacing(6) 0; - - .govuk-label { - display : inline-block; - font-weight : bold; - margin-right : 10px; - } - - .govuk-select { - min-width : 190px; - border-width : 1px; - border-radius : 5px; - } - - } - - ul.ccs-results-list { - list-style : none; - padding : 0; - clear : left; - - li.govuk-list { - float : left; - clear : left; - width : 100%; - padding : govuk-spacing(2) 0; - margin : 0; - border-bottom : 1px solid $govuk-border-colour; - - &:first-child { - border-top : 1px solid $govuk-border-colour; - } - - & > div { - padding : 0; - } - - a { - margin : 0; - } - } - - .ccs-results-list__detail { - - div { - float : right; - - span { - font-weight : bold; - } - - span span.ccs-font--wrap { - font-weight : 700; - display : block; - width : 100%; - } - } - - } - - .ccs-results-list__details { - list-style : none; - padding : 0; - margin : govuk-spacing(2) 0 0 0; - width : 100%; - - li { - margin : 0; - padding : 0; - } - } - - .mc-suppliers-average-day-rate { - list-style : none; - text-align : right; - } - - @extend %clearfix; - - @media (max-width : 641px) { - .ccs-results-list__detail div span span.ccs-font--wrap { - display : inline; - } - } - } - - .govuk-table { - margin : 0; - - .govuk-table__head .govuk-table__header { - font-weight : bold; - } - - td > a[class^="govuk-heading"] { - margin-bottom : 0; - } - - .govuk-table__header, - .govuk-table__cell { - vertical-align : top; - } - - .govuk-table__head th, - .govuk-table__body th, - .govuk-table__body td { - text-align : right; - padding-top : govuk-spacing(4); - padding-bottom : govuk-spacing(4); - } - - .govuk-table__head th:first-child, - .govuk-table__body th:first-child, - .govuk-table__body td:first-child { - text-align : left; - } - - } - - } - -.govuk-table { - @media (min-width : 992px) { - th:first-child[class$="width-one-half"] ~ :last-child { - text-align : right; - } - th:first-child[class$="width-one-half"] ~ :nth-last-child(2) { - padding-left : govuk-spacing(8); - } - } - @media (max-width : 991px) { - th:first-child[class$="width-one-half"] ~ th, - th:first-child[class$="width-one-half"] ~ td { - text-align : right; - padding-left : govuk-spacing(2); - padding-right : govuk-spacing(0); - } - } - } - -.ccs-govuk-checkboxes--s { - - .govuk-checkboxes__input + .govuk-checkboxes__label::before, - .govuk-checkboxes__input { - height : 20px; - width : 20px; - top : 11px; - left : 0; - border-width : 1px; - } - - .govuk-checkboxes__input:checked + .govuk-checkboxes__label::after { - left : 3px; - top : 15px; - width : 11px; - height : 5px; - border-width : 0 0 3px 3px; - } - - .govuk-checkboxes__label { - padding : 5px; - width : 100%; - font-size : 17px; - font-size : 1.0625rem; - } - - .govuk-checkboxes__item { - margin-bottom : 0; - padding-top : 5px; - padding-right : 10px; - padding-bottom : 0; - padding-left : 25px; - } - - } - -.ccs-titles-checkboxes { - margin-bottom : govuk-spacing(8); - - .govuk-fieldset__heading { - margin-bottom : govuk-spacing(5); - } - - .govuk-radios, - .govuk-checkboxes { - .govuk-label { - font-weight : bold; - } - - .govuk-hint { - margin-bottom : govuk-spacing(1) !important; - } - - .govuk-details { - margin-left : govuk-spacing(3); - margin-right : govuk-spacing(3); - margin-bottom : govuk-spacing(1); - padding-bottom : govuk-spacing(1); - - &.govuk-details--border-bottom { - border-bottom : 1px solid ccs-colour("grey-2"); - } - } - } - } - - -.pagination--button_as_link, -.pagination-number--button_as_link { - @include govuk-font(19); - background-color: inherit; - border: none; - padding: 0!important; - color: $govuk-link-colour; - - &:hover:not(:focus), - &:active:not(:focus) { - color: $govuk-link-hover-colour - } - - &:hover { - cursor: pointer; - } -} - -.pagination--button_as_link, -.govuk-pagination__item--current .pagination-number--button_as_link { - @include govuk-typography-weight-bold; -} - -.govuk-pagination__item--current .pagination-number--button_as_link { - color: govuk-colour("white"); - - &:hover:not(:focus), - &:active:not(:focus) { - color: govuk-colour("white"); - } -} - -@media print { - #results-filters { - .results-panel { - background-color : none; - - } - } - .ccs-print-icon, - #navigation, - #ccs-clear-filters, - .govuk-button { - display : none; - } - - .ccs-at-results-filters { - font-size : 80% !important; - font-weight : normal; - } - - #main-content > .govuk-grid-row:first-child > .govuk-grid-column-two-thirds:first-child { - width : 100%; - } - } - -@media all and (-ms-high-contrast : none) { - *::-ms-backdrop, #wrapper { - flex : none; - } - *::-ms-backdrop, img[src*=".svg"] { - width : 100%; - } - *::-ms-backdrop, .ccs-logo__dfe img[src*=".svg"] { - width : 50%; - } - } - -.ccs-fieldset__heading--wide { - max-width : none; - width : 100%; - } - -table.ccs-at-govuk-table--sm { - th { - @include govuk-font($size : 16, $weight : inherit); - } - - td { - font-size : 15px; - font-size : 0.9rem; - } - } - -table.ccs-at-govuk-table--5050 { - tr th:first-child, - tr td:first-child { - font-size: 0.9rem; - width : 50%; - padding-right : govuk-spacing(2); - } - } - -table.ccs-at-govuk-table--3070 { - border-collapse: collapse; - tr th:first-child, - tr td:first-child { - width: 20%; - padding-right : govuk-spacing(2); - } - tr th:last-child, - tr td:last-child { - padding-left: 1em; - min-width : 4em; - } - tr th:nth-last-child(2), - tr td:nth-last-child(2) { - padding: 1ex 0; - min-width : 5em; - } - thead tr { - border-top : 1px solid #CCCCCC; - border-bottom : 1px solid #CCCCCC; - padding-top : 4px; - padding-bottom : 4px; - } - thead th { - text-align: left; - padding: 1ex; - } - tbody td { - padding: 1ex 1ex; - } - } -table.ccs-at-govuk-table--3070, -table.ccs-at-govuk-table--sm, -table.ccs-at-govuk-table--5050 { - th, td { - padding-top : govuk-spacing(3); - padding-bottom : govuk-spacing(3); - vertical-align : top; - } - } - - -.ccs-right-panel-sticky { - display : block; - width : 100%; - margin-bottom : govuk-spacing(3); - - & > div { - padding : govuk-spacing(4) govuk-spacing(4) govuk-spacing(2) govuk-spacing(3); - margin : 0; - } - - @media (min-width : 40.0625em) { - position : -webkit-sticky; - position : sticky; - top : 30px; - float : right; - width : 33.33333%; - - & > div { - background-color : ccs-colour("grey-4"); - margin-left : govuk-spacing(2); - } - - span { - @include govuk-font($size : 36); - display : inline-block; - width : 100%; - font-weight : bold; - } - } - } - - -.ccs-info-panel { - background-color : ccs-colour("grey-4"); - padding : govuk-spacing(3); - margin : 0 0 govuk-spacing(7) 0; - - @media (min-width : 40.0625em) { - &.ccs-info-panel--pull-up { - margin-top : -#{govuk-spacing(3)} !important; - } - } - - dl.ccs-contact-details { - dt, dd { - font-family : $govuk-font-family; - @include govuk-font($size : 19, $weight : normal); - width : 100%; - display : inline-block; - margin : 0; - } - - dt { - font-weight : bold; - margin-top : govuk-spacing(4); - - &:first-child { - margin-top : 0; - } - } - - a { - overflow-wrap : break-word; - word-wrap : break-word; - } - } - } - -#passwordrules { - li { - - &.correct { - color : govuk-colour("green"); - - span { - background-image : url("data:image/svg+xml,%3Csvg height='15' viewBox='0 0 19 15' width='19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m43.6740506 1353.95951 9.8607595-9.95951 2.4651899 2.55061-12.3259494 12.44939-6.6740506-6.74089 2.5253165-2.55061z' fill='%23006435' fill-rule='evenodd' transform='translate(-37 -1344)'/%3E%3C/svg%3E"); - } - } - - &.wrong { - color : $govuk-error-colour; - - span { - background-image : url("data:image/svg+xml,%3Csvg height='14' viewBox='0 0 14 14' width='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m46 1385.41176-4.5882353 4.58824-2.4117647-2.41176 4.5882353-4.58824-4.5882353-4.58824 2.4117647-2.41176 4.5882353 4.58824 4.5882353-4.58824 2.4117647 2.41176-4.5882353 4.58824 4.5882353 4.58824-2.4117647 2.41176z' fill='%23b10e1e' fill-rule='evenodd' transform='matrix(-1 0 0 1 53 -1376)'/%3E%3C/svg%3E"); - } - } - - &.correct, - &.wrong { - span:first-child { - position : relative; - top : 0.2rem; - - b { - position : absolute; - left : -3000px; - top : -3000px; - } - } - } - - span { - display : inline-block; - background-image : none; - background-position : center center; - background-repeat : no-repeat; - width : 16px; - height : 16px; - - b { - display : inline-block; - margin-right : 0.3rem; - width : inherit; - height : inherit; - } - } - } - } - -.ccs-special-date-input { - width: 75px; -} - -.ccs-progress { - height: 40px; - margin-bottom: 20px; - overflow: hidden; - background: govuk-colour("light-grey"); - border-radius: 4px; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -} - -.ccs-progress-bar { - float: left; - width: 10%; - height: 100%; - font-size: 12px; - line-height: 20px; - color: #fff; - text-align: center; - background: govuk-colour("blue"); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - transition: width .6s ease, background .6s ease; - - &--succeed { - background: govuk-colour("green"); - } - - &--fail { - background: govuk-colour("red"); - } -} - -.ccs-upload-progress-container { - display: grid; - text-align: center; - grid-template-columns: 20% 20% 20% 20% 20%; - - div:not([aria-current="true"]) { - @media (max-width: 30em) { - position: absolute; - width: 1px; - height: 1px; - margin: 0; - padding: 0; - overflow: hidden; - clip: rect(0 0 0 0); - border: 0; - white-space: nowrap; - } - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/components/checkbox-accordion/_checkbox-accordion.scss b/app/assets/stylesheets/components/checkbox-accordion/_checkbox-accordion.scss new file mode 100644 index 0000000000..ba39f1ccc2 --- /dev/null +++ b/app/assets/stylesheets/components/checkbox-accordion/_checkbox-accordion.scss @@ -0,0 +1,11 @@ +#ccs-accordion-with-basket .govuk-accordion__section-content div.govuk-checkboxes__divider, +#ccs-accordion-with-basket .govuk-accordion__section-content div.govuk-checkboxes__item:last-child { + display: none; +} + +body.js-enabled { + #ccs-accordion-with-basket .govuk-accordion__section-content div.govuk-checkboxes__divider, + #ccs-accordion-with-basket .govuk-accordion__section-content div.govuk-checkboxes__item:last-child { + display: block; + } +} diff --git a/app/assets/stylesheets/components/dashboard-section/_dashboard-section.scss b/app/assets/stylesheets/components/dashboard-section/_dashboard-section.scss new file mode 100644 index 0000000000..b960c0b072 --- /dev/null +++ b/app/assets/stylesheets/components/dashboard-section/_dashboard-section.scss @@ -0,0 +1,48 @@ +$ccs-dashboard-panel-border-colour: ccs-colour("grey"); +$ccs-dashboard-panel-background-colour: ccs-colour("light-grey"); + +.ccs-dashboard-section__container { + @extend %govuk-body-m; + + @include govuk-media-query ($from: tablet) { + display: flex; + } +} + +.ccs-dashboard-section__heading { + margin-top: govuk-spacing(5); + margin-bottom: govuk-spacing(1); +} + +.ccs-dashboard-section__heading-section-break { + margin-bottom: govuk-spacing(5); +} + +.ccs-dashboard-section__panel { + margin-bottom: 30px; + margin-left: 15px; + padding: 10px; + border: 1px $ccs-dashboard-panel-border-colour solid; + background: $ccs-dashboard-panel-background-colour; + + @include govuk-media-query ($from: tablet) { + margin-right: 10px; + margin-left: 10px; + + &:first-child { + margin-left: 15px; + } + } +} + +.ccs-dashboard-section__panel-title { + @include govuk-link-common; + @include govuk-link-style-no-visited-state; + @include govuk-typography-weight-bold; + + text-decoration: none; +} + +.ccs-dashboard-section__panel-description { + margin-top: 20px; +} diff --git a/app/assets/stylesheets/components/details/_details.scss b/app/assets/stylesheets/components/details/_details.scss deleted file mode 100644 index 0caed20544..0000000000 --- a/app/assets/stylesheets/components/details/_details.scss +++ /dev/null @@ -1,7 +0,0 @@ -.govuk-details { - margin-bottom: 0; -} - -.govuk-details__text { - word-break: break-word; -} \ No newline at end of file diff --git a/app/assets/stylesheets/components/documents/_documents.scss b/app/assets/stylesheets/components/documents/_documents.scss deleted file mode 100644 index 130233869c..0000000000 --- a/app/assets/stylesheets/components/documents/_documents.scss +++ /dev/null @@ -1,5 +0,0 @@ -.documents { - background-color: #f3f2f1; - padding-top: 15px; - padding-bottom: 3px; -} diff --git a/app/assets/stylesheets/components/footer/_footer.scss b/app/assets/stylesheets/components/footer/_footer.scss index 48c838dbbf..abb87ce773 100644 --- a/app/assets/stylesheets/components/footer/_footer.scss +++ b/app/assets/stylesheets/components/footer/_footer.scss @@ -34,7 +34,7 @@ $ccs-footer-columns-to-rows-point: 501px; // alphagov/govuk_template includes a specific a:link:focus selector // designed to make unvisited links a slightly darker blue when focussed, so // we need to override the text colour for that combination of selectors. - @include govuk-compatibility(govuk_template) { + @include _govuk-compatibility(govuk_template) { &:link:focus { @include govuk-text-colour; } diff --git a/app/assets/stylesheets/components/info-panel/_info-panel.scss b/app/assets/stylesheets/components/info-panel/_info-panel.scss new file mode 100644 index 0000000000..e71fe539e1 --- /dev/null +++ b/app/assets/stylesheets/components/info-panel/_info-panel.scss @@ -0,0 +1,36 @@ +.ccs-info-panel { + background-color: ccs-colour("light-grey"); + padding: govuk-spacing(3); + margin: 0 0 govuk-spacing(7) 0; + + @media (min-width: 40.0625em) { + &.ccs-info-panel--pull-up { + margin-top: -#{govuk-spacing(3)} !important; + } + } + + dl.ccs-contact-details { + dt, + dd { + font-family: $govuk-font-family; + @include govuk-font($size: 19, $weight: normal); + width: 100%; + display: inline-block; + margin: 0; + } + + dt { + font-weight: bold; + margin-top: govuk-spacing(4); + + &:first-child { + margin-top: 0; + } + } + + a { + overflow-wrap: break-word; + word-wrap: break-word; + } + } +} diff --git a/app/assets/stylesheets/components/inset-text/_inset-text.scss b/app/assets/stylesheets/components/inset-text/_inset-text.scss deleted file mode 100644 index 83ea462355..0000000000 --- a/app/assets/stylesheets/components/inset-text/_inset-text.scss +++ /dev/null @@ -1,21 +0,0 @@ -$ccs_inset-text_bg_grey: ccs-colour("grey-4"); - -.cmp-inset-text { - margin:1em 0; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - padding: 1rem; -} - -.cmp-inset-text--neutral { - background-color:$ccs_inset-text_bg_grey; - border-left:0; -} -.cmp-inset-text__body--neutral { - font-size: 16px; - font-weight: 400; -} -.cmp-inset-text__list-item { - font-size: 16px; -} diff --git a/app/assets/stylesheets/components/label/_label.scss b/app/assets/stylesheets/components/label/_label.scss deleted file mode 100644 index 55c15afdc5..0000000000 --- a/app/assets/stylesheets/components/label/_label.scss +++ /dev/null @@ -1,5 +0,0 @@ -.govuk-label--m { - line-height: 2; - margin-bottom: 5px; - font-weight: $govuk-font-weight-semi-bold; -} diff --git a/app/assets/stylesheets/ccs/facilities-management/_panel.scss b/app/assets/stylesheets/components/panel/_panel.scss similarity index 86% rename from app/assets/stylesheets/ccs/facilities-management/_panel.scss rename to app/assets/stylesheets/components/panel/_panel.scss index 15e173444d..8908c8cb61 100644 --- a/app/assets/stylesheets/ccs/facilities-management/_panel.scss +++ b/app/assets/stylesheets/components/panel/_panel.scss @@ -15,8 +15,8 @@ .ccs-panel--confirmation { color: govuk-colour("black"); - background: ccs-colour("green-2"); - border-left: 3px solid ccs-colour("green-3"); + background: ccs-colour("light-green"); + border-left: 3px solid ccs-colour("dark-green"); } .ccs-panel__title { diff --git a/app/assets/stylesheets/components/password-rules/_password-rules.scss b/app/assets/stylesheets/components/password-rules/_password-rules.scss new file mode 100644 index 0000000000..61f8d40619 --- /dev/null +++ b/app/assets/stylesheets/components/password-rules/_password-rules.scss @@ -0,0 +1,49 @@ +#ccs-password-rules { + li { + &.correct { + color: govuk-colour("green"); + + span { + background-image: url("data:image/svg+xml,%3Csvg height='15' viewBox='0 0 19 15' width='19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m43.6740506 1353.95951 9.8607595-9.95951 2.4651899 2.55061-12.3259494 12.44939-6.6740506-6.74089 2.5253165-2.55061z' fill='%23006435' fill-rule='evenodd' transform='translate(-37 -1344)'/%3E%3C/svg%3E"); + } + } + + &.wrong { + color: $govuk-error-colour; + + span { + background-image: url("data:image/svg+xml,%3Csvg height='14' viewBox='0 0 14 14' width='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m46 1385.41176-4.5882353 4.58824-2.4117647-2.41176 4.5882353-4.58824-4.5882353-4.58824 2.4117647-2.41176 4.5882353 4.58824 4.5882353-4.58824 2.4117647 2.41176-4.5882353 4.58824 4.5882353 4.58824-2.4117647 2.41176z' fill='%23b10e1e' fill-rule='evenodd' transform='matrix(-1 0 0 1 53 -1376)'/%3E%3C/svg%3E"); + } + } + + &.correct, + &.wrong { + span:first-child { + position: relative; + top: 0.2rem; + + b { + position: absolute; + left: -3000px; + top: -3000px; + } + } + } + + span { + display: inline-block; + background-image: none; + background-position: center center; + background-repeat: no-repeat; + width: 16px; + height: 16px; + + b { + display: inline-block; + margin-right: 0.3rem; + width: inherit; + height: inherit; + } + } + } +} diff --git a/app/assets/stylesheets/components/progress-bar/_progress-bar.scss b/app/assets/stylesheets/components/progress-bar/_progress-bar.scss new file mode 100644 index 0000000000..a55f5d994f --- /dev/null +++ b/app/assets/stylesheets/components/progress-bar/_progress-bar.scss @@ -0,0 +1,51 @@ +.ccs-progress { + height: 40px; + margin-bottom: 20px; + overflow: hidden; + background: govuk-colour("light-grey"); + border-radius: 4px; + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); +} + +.ccs-progress-bar { + float: left; + width: 10%; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background: govuk-colour("blue"); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + transition: + width 0.6s ease, + background 0.6s ease; + + &--succeed { + background: govuk-colour("green"); + } + + &--fail { + background: govuk-colour("red"); + } +} + +.ccs-upload-progress-container { + display: grid; + text-align: center; + grid-template-columns: 20% 20% 20% 20% 20%; + + div:not([aria-current="true"]) { + @media (max-width: 30em) { + position: absolute; + width: 1px; + height: 1px; + margin: 0; + padding: 0; + overflow: hidden; + clip: rect(0 0 0 0); + border: 0; + white-space: nowrap; + } + } +} diff --git a/app/assets/stylesheets/ccs/facilities-management/_service-specification.scss b/app/assets/stylesheets/components/service-specification/_service-specification.scss similarity index 100% rename from app/assets/stylesheets/ccs/facilities-management/_service-specification.scss rename to app/assets/stylesheets/components/service-specification/_service-specification.scss diff --git a/app/assets/stylesheets/components/step-by-step-nav/_all.scss b/app/assets/stylesheets/components/step-by-step-nav/_all.scss deleted file mode 100644 index 56bbf7ac9b..0000000000 --- a/app/assets/stylesheets/components/step-by-step-nav/_all.scss +++ /dev/null @@ -1,3 +0,0 @@ -@import "./step-by-step-nav-header"; -@import "./step-by-step-nav-related"; -@import "./step-by-step-nav"; diff --git a/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav-main.scss b/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav-main.scss new file mode 100644 index 0000000000..cd7546bfa8 --- /dev/null +++ b/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav-main.scss @@ -0,0 +1,538 @@ +$stroke-width: 1px; +$number-circle-size: 30px; +$number-circle-size-large: 35px; +$top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3"); + +@mixin step-nav-vertical-line($line-style: solid) { + content: ""; + position: absolute; + z-index: 2; + width: 0; + height: 100%; + border-left: $line-style $stroke-width govuk-colour("mid-grey", $legacy: "grey-2"); + background: govuk-colour("white"); +} + +@mixin step-nav-line-position { + left: 0; + margin-left: govuk-em(($number-circle-size / 2) - ($stroke-width / 2), 16); +} + +@mixin step-nav-line-position-large { + left: 0; + margin-left: govuk-em(($number-circle-size-large / 2) - ($stroke-width / 2), 16); +} + +// custom mixin as govuk-font does undesirable things at different breakpoints +// we want to ensure that both large and small step navs have the same size font on mobile +// this will stop text resizing if compatibility mode is turned off +@mixin step-nav-font($size, $tablet-size: $size, $weight: normal, $line-height: 1.3, $tablet-line-height: $line-height) { + @include govuk-typography-common; + font-size: $size + px; + font-weight: $weight; + line-height: $line-height; + + @include govuk-media-query($from: tablet) { + font-size: $tablet-size + px; + line-height: $tablet-line-height; + } +} + +// Adds a focus state for the chevron icon so that it turns black on button focus +@mixin step-nav-chevron-focus-state { + .gem-c-step-nav__chevron-stroke { + stroke: govuk-colour("black"); + } +} + +.gem-c-step-nav { + margin-bottom: govuk-spacing(6); + + &.gem-c-step-nav--large { + @include govuk-media-query($from: tablet) { + margin-bottom: govuk-spacing(9); + } + } + + .js-enabled &.js-hidden { + display: none; + } +} + +.gem-c-step-nav__controls { + padding: 3px 3px 0 0; +} + +.gem-c-step-nav____title-text-focus { + margin-bottom: 13px; + display: inline-block; +} + +// Create Chevron icon aligned with text +.gem-c-step-nav__chevron { + box-sizing: border-box; + display: inline-block; + position: relative; + // Set size using rems to make the icon scale with text if user resizes text in their browser + width: govuk-px-to-rem(20px); + height: govuk-px-to-rem(20px); + border: govuk-px-to-rem(1px) solid; + border-radius: 50%; + + vertical-align: text-top; + + // Reduce size, alter alignment + .gem-c-step-nav--large & { + vertical-align: top; + } + + // Create inner chevron arrow + &:after { + content: ""; + box-sizing: border-box; + display: block; + position: absolute; + bottom: govuk-px-to-rem(5px); + left: govuk-px-to-rem(6px); + width: govuk-px-to-rem(6px); + height: govuk-px-to-rem(6px); + -webkit-transform: rotate(-45deg); /* Ch <36, Saf 5.1+, iOS < 9.2, An =<4.4.4 */ + -ms-transform: rotate(-45deg); /* IE 9 */ + transform: rotate(-45deg); + border-top: govuk-px-to-rem(2px) solid; + border-right: govuk-px-to-rem(2px) solid; + } +} + +// Rotate icon to create "Down" version +.gem-c-step-nav__chevron--down { + -webkit-transform: rotate(180deg); /* Ch <36, Saf 5.1+, iOS < 9.2, An =<4.4.4 */ + -ms-transform: rotate(180deg); /* IE 9 */ + transform: rotate(180deg); +} + +.gem-c-step-nav__button { + color: $govuk-link-colour; + cursor: pointer; + background: none; + border: 0; + margin: 0; + + &:hover { + background: govuk-colour("light-grey"); + // Chevron icon interaction states + .gem-c-step-nav__chevron { + color: govuk-colour("black"); + background: govuk-colour("black"); + } + + .gem-c-step-nav__chevron:after { + color: govuk-colour("light-grey"); + } + + .gem-c-step-nav__button-text { + color: $govuk-text-colour; + } + } + + &:focus { + outline: 0; + // Chevron icon interaction states + .gem-c-step-nav__chevron { + color: govuk-colour("black"); + background: govuk-colour("black"); + } + + .gem-c-step-nav__chevron:after { + color: $govuk-focus-colour; + } + + .gem-c-step-nav____title-text-focus, + .gem-c-step-nav__toggle-link-focus { + @include govuk-focused-text; + } + + .gem-c-step-nav__toggle-link-focus { + padding-bottom: 2px; + } + } +} + +// removes extra dotted outline from buttons in Firefox +// on focus (standard yellow outline unaffected) +.gem-c-step-nav__button::-moz-focus-inner { + border: 0; +} + +.gem-c-step-nav__button--title { + @include step-nav-font(19, $weight: bold, $line-height: 1.2); + display: inline-block; + padding: govuk-spacing(1) 0 0; + text-align: left; + color: govuk-colour("black"); + width: 100%; + + .gem-c-step-nav--large & { + @include step-nav-font(19, $tablet-size: 24, $weight: bold); + + @include govuk-media_query($from: tablet) { + padding-top: govuk-spacing(2); + } + } +} + +.gem-c-step-nav__button--controls { + @include step-nav-font(15); + position: relative; + z-index: 1; // this and relative position stops focus outline underlap with border of accordion + margin: .5em 0 14px; + padding: govuk-spacing(1) 0 govuk-spacing(1); + + .gem-c-step-nav--large & { + @include step-nav-font(15, $tablet-size: 19); + } + + &:focus { + @include govuk-focused-text; + + .gem-c-step-nav__button-text { + text-decoration: none; + } + } +} + +.gem-c-step-nav__button-text { + display: inline-block; + text-align: left; + min-width: govuk-em(35, 14); + margin-left: govuk-spacing(1); + + .gem-c-step-nav--large & { + min-width: govuk-em(40, 16); + margin-left: govuk-spacing(1); + } +} + +.gem-c-step-nav__button-text--all { + min-width: govuk-em(87, 14); + + .gem-c-step-nav--large & { + min-width: govuk-em(100, 16); + } +} + +.gem-c-step-nav__steps { + padding: 0; + margin: 0; +} + +.gem-c-step-nav__step { + position: relative; + padding-left: govuk-em(govuk-spacing(6) + govuk-spacing(3), 16); + list-style: none; + + // line down the side of a step + &:after { + @include step-nav-vertical-line; + @include step-nav-line-position; + top: govuk-em(govuk-spacing(3), 16); + } + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + padding-left: govuk-em(govuk-spacing(9), 16); + + &:after { // stylelint-disable-line max-nesting-depth + @include step-nav-line-position-large; + top: govuk-em(govuk-spacing(6), 16); + } + } + } +} + +.gem-c-step-nav__step:last-child { + // little dash at the bottom of the line + &:before { + content: ""; + position: absolute; + z-index: 6; + bottom: 0; + left: 0; + margin-left: $number-circle-size / 4; + width: $number-circle-size / 2; + height: 0; + border-bottom: solid $stroke-width govuk-colour("mid-grey", $legacy: "grey-2"); + } + + &:after { + height: -webkit-calc(100% - #{govuk-spacing(3)}); // fallback for iphone 4 + height: calc(100% - #{govuk-spacing(3)}); + } + + .gem-c-step-nav__help:after { + height: 100%; + } + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + &:before { + margin-left: $number-circle-size-large / 4; + width: $number-circle-size-large / 2; + } + + &:after { + height: calc(100% - #{govuk-spacing(6)}); + } + } + } +} + +.gem-c-step-nav__step--active { + &:last-child:before, + .gem-c-step-nav__circle--number, + &:after, + .gem-c-step-nav__help:after { + border-color: govuk-colour("black"); + } +} + +.gem-c-step-nav__circle { + box-sizing: border-box; + position: absolute; + z-index: 5; + top: 3px; + left: 0; + width: govuk-em($number-circle-size, 16); + height: govuk-em($number-circle-size, 16); + color: govuk-colour("black"); + background: govuk-colour("white"); + border-radius: 100px; + text-align: center; + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + top: 11px; + width: govuk-em($number-circle-size-large, 19); + height: govuk-em($number-circle-size-large, 19); + } + } +} + +.gem-c-step-nav__circle--number { + @include step-nav-font(16, $weight: bold, $line-height: 29px); + border: solid $stroke-width govuk-colour("mid-grey", $legacy: "grey-2"); + + .gem-c-step-nav--large & { + @include step-nav-font(16, $tablet-size: 19, $weight: bold, $line-height: 29px, $tablet-line-height: 34px); + } + + .gem-c-step-nav__step--active & { + background-color: govuk-colour("black"); + + .gem-c-step-nav__circle-background { + text-shadow: none; + color: govuk-colour("white"); + } + } +} + +.gem-c-step-nav__circle--logic { + @include step-nav-font(19, $weight: bold, $line-height: 28px); + left: 3px; + width: govuk-em($number-circle-size, 19); + height: govuk-em($number-circle-size, 19); + + .gem-c-step-nav--large & { + @include step-nav-font(19, $tablet-size: 24, $weight: bold, $line-height: 28px, $tablet-line-height: 34px); + + @include govuk-media-query($from: tablet) { + width: govuk-em($number-circle-size-large, 24); + height: govuk-em($number-circle-size-large, 24); + } + } +} + +// makes sure logic text expands to the left if text size is zoomed, preventing overlap +.gem-c-step-nav__circle-inner { + float: right; + min-width: 100%; +} + +.gem-c-step-nav__circle-background { + $shadow-offset: .1em; + $shadow-colour: govuk-colour("white"); + + // to make numbers readable for users zooming text only in browsers such as Firefox + text-shadow: 0 -#{$shadow-offset} 0 $shadow-colour, $shadow-offset 0 0 $shadow-colour, 0 $shadow-offset 0 $shadow-colour, -#{$shadow-offset} 0 0 $shadow-colour; +} + +.gem-c-step-nav__circle-step-label, +.gem-c-step-nav__circle-step-colon { + @include govuk-visually-hidden; +} + +.gem-c-step-nav__header { + border-top: $top-border; + padding: govuk-spacing(1) 0 govuk-spacing(6); + + .gem-c-step-nav--large & { + padding-top: govuk-spacing(2); + } + + .js-enabled & { + padding: 0; + } + + .gem-c-step-nav--active & { + cursor: pointer; + } +} + +.gem-c-step-nav__title { + @include govuk-text-colour; + @include step-nav-font(19, $weight: bold, $line-height: 1.4); + margin: 0; + + .gem-c-step-nav--large & { + @include step-nav-font(19, $tablet-size: 24, $weight: bold, $line-height: 1.4); + } +} + +.gem-c-step-nav__toggle-link { + @include step-nav-font(15, $line-height: 1.2); + display: block; + color: $govuk-link-colour; + text-transform: capitalize; + padding-bottom: govuk-spacing(6); + + .gem-c-step-nav--large & { + @include step-nav-font(15, $tablet-size: 19, $line-height: 1.2); + } +} + +.gem-c-step-nav__panel { + @include govuk-text-colour; + @include step-nav-font(16); + padding-bottom: govuk-spacing(5); + + .gem-c-step-nav--large & { + @include step-nav-font(16, $tablet-size: 19); + } + + .js-enabled &.js-hidden { + display: none; + } +} + +// contents of the steps, such as paragraphs and links + +.gem-c-step-nav__paragraph { + padding-bottom: govuk-spacing(3); + margin: 0; + font-size: inherit; + + + .gem-c-step-nav__list { + margin-top: -5px; + } + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + padding-bottom: govuk-spacing(6); + } + } + + .gem-c-step-nav--large & + .gem-c-step-nav__list { + @include govuk-media-query($from: tablet) { + margin-top: -govuk-spacing(3); + } + } +} + +.gem-c-step-nav__list { + padding: 0; + padding-bottom: 10px; + list-style: none; + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + padding-bottom: 20px; + } + } +} + +.gem-c-step-nav__list--choice { + $links-margin: 20px; + + margin-left: $links-margin; + list-style: disc; + + .gem-c-step-nav__list-item--active:before { + left: -(govuk-spacing(6) + govuk-spacing(3)) - $links-margin; + } + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + .gem-c-step-nav__list-item--active:before { + left: -(govuk-spacing(9)) - $links-margin; + } + } + } +} + +.gem-c-step-nav__list-item { + margin-bottom: 10px; +} + +.gem-c-step-nav__link { + @include govuk-link-common; + @include govuk-link-style-default; +} + +.gem-c-step-nav__link-active-context { + @include govuk-visually-hidden; +} + +.gem-c-step-nav__list-item--active { + position: relative; + + &:before { + box-sizing: border-box; + content: ""; + position: absolute; + z-index: 5; + top: .6em; // position the dot to align with the first row of text in the link + left: -(govuk-spacing(6) + govuk-spacing(3)); + margin-top: -($stroke-width / 2); + margin-left: ($number-circle-size / 2); + width: $number-circle-size / 2; + height: $stroke-width; + background: govuk-colour("black"); + } + + .gem-c-step-nav--large & { + @include govuk-media-query($from: tablet) { + &:before { + left: -(govuk-spacing(9)); + margin-left: ($number-circle-size-large / 2); + } + } + } + + .gem-c-step-nav__link { + @include govuk-link-style-text; + } +} + +.gem-c-step-nav__context { + display: inline-block; + font-weight: normal; + color: govuk-colour("dark-grey", $legacy: "grey-1"); + + &:before { + content: " \2013\00a0"; // dash followed by   + } +} + +.gem-c-step-nav__list--no-marker { + list-style-type: none; +} diff --git a/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav.scss b/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav.scss index cd7546bfa8..558e81990a 100644 --- a/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav.scss +++ b/app/assets/stylesheets/components/step-by-step-nav/_step-by-step-nav.scss @@ -1,538 +1,3 @@ -$stroke-width: 1px; -$number-circle-size: 30px; -$number-circle-size-large: 35px; -$top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3"); - -@mixin step-nav-vertical-line($line-style: solid) { - content: ""; - position: absolute; - z-index: 2; - width: 0; - height: 100%; - border-left: $line-style $stroke-width govuk-colour("mid-grey", $legacy: "grey-2"); - background: govuk-colour("white"); -} - -@mixin step-nav-line-position { - left: 0; - margin-left: govuk-em(($number-circle-size / 2) - ($stroke-width / 2), 16); -} - -@mixin step-nav-line-position-large { - left: 0; - margin-left: govuk-em(($number-circle-size-large / 2) - ($stroke-width / 2), 16); -} - -// custom mixin as govuk-font does undesirable things at different breakpoints -// we want to ensure that both large and small step navs have the same size font on mobile -// this will stop text resizing if compatibility mode is turned off -@mixin step-nav-font($size, $tablet-size: $size, $weight: normal, $line-height: 1.3, $tablet-line-height: $line-height) { - @include govuk-typography-common; - font-size: $size + px; - font-weight: $weight; - line-height: $line-height; - - @include govuk-media-query($from: tablet) { - font-size: $tablet-size + px; - line-height: $tablet-line-height; - } -} - -// Adds a focus state for the chevron icon so that it turns black on button focus -@mixin step-nav-chevron-focus-state { - .gem-c-step-nav__chevron-stroke { - stroke: govuk-colour("black"); - } -} - -.gem-c-step-nav { - margin-bottom: govuk-spacing(6); - - &.gem-c-step-nav--large { - @include govuk-media-query($from: tablet) { - margin-bottom: govuk-spacing(9); - } - } - - .js-enabled &.js-hidden { - display: none; - } -} - -.gem-c-step-nav__controls { - padding: 3px 3px 0 0; -} - -.gem-c-step-nav____title-text-focus { - margin-bottom: 13px; - display: inline-block; -} - -// Create Chevron icon aligned with text -.gem-c-step-nav__chevron { - box-sizing: border-box; - display: inline-block; - position: relative; - // Set size using rems to make the icon scale with text if user resizes text in their browser - width: govuk-px-to-rem(20px); - height: govuk-px-to-rem(20px); - border: govuk-px-to-rem(1px) solid; - border-radius: 50%; - - vertical-align: text-top; - - // Reduce size, alter alignment - .gem-c-step-nav--large & { - vertical-align: top; - } - - // Create inner chevron arrow - &:after { - content: ""; - box-sizing: border-box; - display: block; - position: absolute; - bottom: govuk-px-to-rem(5px); - left: govuk-px-to-rem(6px); - width: govuk-px-to-rem(6px); - height: govuk-px-to-rem(6px); - -webkit-transform: rotate(-45deg); /* Ch <36, Saf 5.1+, iOS < 9.2, An =<4.4.4 */ - -ms-transform: rotate(-45deg); /* IE 9 */ - transform: rotate(-45deg); - border-top: govuk-px-to-rem(2px) solid; - border-right: govuk-px-to-rem(2px) solid; - } -} - -// Rotate icon to create "Down" version -.gem-c-step-nav__chevron--down { - -webkit-transform: rotate(180deg); /* Ch <36, Saf 5.1+, iOS < 9.2, An =<4.4.4 */ - -ms-transform: rotate(180deg); /* IE 9 */ - transform: rotate(180deg); -} - -.gem-c-step-nav__button { - color: $govuk-link-colour; - cursor: pointer; - background: none; - border: 0; - margin: 0; - - &:hover { - background: govuk-colour("light-grey"); - // Chevron icon interaction states - .gem-c-step-nav__chevron { - color: govuk-colour("black"); - background: govuk-colour("black"); - } - - .gem-c-step-nav__chevron:after { - color: govuk-colour("light-grey"); - } - - .gem-c-step-nav__button-text { - color: $govuk-text-colour; - } - } - - &:focus { - outline: 0; - // Chevron icon interaction states - .gem-c-step-nav__chevron { - color: govuk-colour("black"); - background: govuk-colour("black"); - } - - .gem-c-step-nav__chevron:after { - color: $govuk-focus-colour; - } - - .gem-c-step-nav____title-text-focus, - .gem-c-step-nav__toggle-link-focus { - @include govuk-focused-text; - } - - .gem-c-step-nav__toggle-link-focus { - padding-bottom: 2px; - } - } -} - -// removes extra dotted outline from buttons in Firefox -// on focus (standard yellow outline unaffected) -.gem-c-step-nav__button::-moz-focus-inner { - border: 0; -} - -.gem-c-step-nav__button--title { - @include step-nav-font(19, $weight: bold, $line-height: 1.2); - display: inline-block; - padding: govuk-spacing(1) 0 0; - text-align: left; - color: govuk-colour("black"); - width: 100%; - - .gem-c-step-nav--large & { - @include step-nav-font(19, $tablet-size: 24, $weight: bold); - - @include govuk-media_query($from: tablet) { - padding-top: govuk-spacing(2); - } - } -} - -.gem-c-step-nav__button--controls { - @include step-nav-font(15); - position: relative; - z-index: 1; // this and relative position stops focus outline underlap with border of accordion - margin: .5em 0 14px; - padding: govuk-spacing(1) 0 govuk-spacing(1); - - .gem-c-step-nav--large & { - @include step-nav-font(15, $tablet-size: 19); - } - - &:focus { - @include govuk-focused-text; - - .gem-c-step-nav__button-text { - text-decoration: none; - } - } -} - -.gem-c-step-nav__button-text { - display: inline-block; - text-align: left; - min-width: govuk-em(35, 14); - margin-left: govuk-spacing(1); - - .gem-c-step-nav--large & { - min-width: govuk-em(40, 16); - margin-left: govuk-spacing(1); - } -} - -.gem-c-step-nav__button-text--all { - min-width: govuk-em(87, 14); - - .gem-c-step-nav--large & { - min-width: govuk-em(100, 16); - } -} - -.gem-c-step-nav__steps { - padding: 0; - margin: 0; -} - -.gem-c-step-nav__step { - position: relative; - padding-left: govuk-em(govuk-spacing(6) + govuk-spacing(3), 16); - list-style: none; - - // line down the side of a step - &:after { - @include step-nav-vertical-line; - @include step-nav-line-position; - top: govuk-em(govuk-spacing(3), 16); - } - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - padding-left: govuk-em(govuk-spacing(9), 16); - - &:after { // stylelint-disable-line max-nesting-depth - @include step-nav-line-position-large; - top: govuk-em(govuk-spacing(6), 16); - } - } - } -} - -.gem-c-step-nav__step:last-child { - // little dash at the bottom of the line - &:before { - content: ""; - position: absolute; - z-index: 6; - bottom: 0; - left: 0; - margin-left: $number-circle-size / 4; - width: $number-circle-size / 2; - height: 0; - border-bottom: solid $stroke-width govuk-colour("mid-grey", $legacy: "grey-2"); - } - - &:after { - height: -webkit-calc(100% - #{govuk-spacing(3)}); // fallback for iphone 4 - height: calc(100% - #{govuk-spacing(3)}); - } - - .gem-c-step-nav__help:after { - height: 100%; - } - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - &:before { - margin-left: $number-circle-size-large / 4; - width: $number-circle-size-large / 2; - } - - &:after { - height: calc(100% - #{govuk-spacing(6)}); - } - } - } -} - -.gem-c-step-nav__step--active { - &:last-child:before, - .gem-c-step-nav__circle--number, - &:after, - .gem-c-step-nav__help:after { - border-color: govuk-colour("black"); - } -} - -.gem-c-step-nav__circle { - box-sizing: border-box; - position: absolute; - z-index: 5; - top: 3px; - left: 0; - width: govuk-em($number-circle-size, 16); - height: govuk-em($number-circle-size, 16); - color: govuk-colour("black"); - background: govuk-colour("white"); - border-radius: 100px; - text-align: center; - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - top: 11px; - width: govuk-em($number-circle-size-large, 19); - height: govuk-em($number-circle-size-large, 19); - } - } -} - -.gem-c-step-nav__circle--number { - @include step-nav-font(16, $weight: bold, $line-height: 29px); - border: solid $stroke-width govuk-colour("mid-grey", $legacy: "grey-2"); - - .gem-c-step-nav--large & { - @include step-nav-font(16, $tablet-size: 19, $weight: bold, $line-height: 29px, $tablet-line-height: 34px); - } - - .gem-c-step-nav__step--active & { - background-color: govuk-colour("black"); - - .gem-c-step-nav__circle-background { - text-shadow: none; - color: govuk-colour("white"); - } - } -} - -.gem-c-step-nav__circle--logic { - @include step-nav-font(19, $weight: bold, $line-height: 28px); - left: 3px; - width: govuk-em($number-circle-size, 19); - height: govuk-em($number-circle-size, 19); - - .gem-c-step-nav--large & { - @include step-nav-font(19, $tablet-size: 24, $weight: bold, $line-height: 28px, $tablet-line-height: 34px); - - @include govuk-media-query($from: tablet) { - width: govuk-em($number-circle-size-large, 24); - height: govuk-em($number-circle-size-large, 24); - } - } -} - -// makes sure logic text expands to the left if text size is zoomed, preventing overlap -.gem-c-step-nav__circle-inner { - float: right; - min-width: 100%; -} - -.gem-c-step-nav__circle-background { - $shadow-offset: .1em; - $shadow-colour: govuk-colour("white"); - - // to make numbers readable for users zooming text only in browsers such as Firefox - text-shadow: 0 -#{$shadow-offset} 0 $shadow-colour, $shadow-offset 0 0 $shadow-colour, 0 $shadow-offset 0 $shadow-colour, -#{$shadow-offset} 0 0 $shadow-colour; -} - -.gem-c-step-nav__circle-step-label, -.gem-c-step-nav__circle-step-colon { - @include govuk-visually-hidden; -} - -.gem-c-step-nav__header { - border-top: $top-border; - padding: govuk-spacing(1) 0 govuk-spacing(6); - - .gem-c-step-nav--large & { - padding-top: govuk-spacing(2); - } - - .js-enabled & { - padding: 0; - } - - .gem-c-step-nav--active & { - cursor: pointer; - } -} - -.gem-c-step-nav__title { - @include govuk-text-colour; - @include step-nav-font(19, $weight: bold, $line-height: 1.4); - margin: 0; - - .gem-c-step-nav--large & { - @include step-nav-font(19, $tablet-size: 24, $weight: bold, $line-height: 1.4); - } -} - -.gem-c-step-nav__toggle-link { - @include step-nav-font(15, $line-height: 1.2); - display: block; - color: $govuk-link-colour; - text-transform: capitalize; - padding-bottom: govuk-spacing(6); - - .gem-c-step-nav--large & { - @include step-nav-font(15, $tablet-size: 19, $line-height: 1.2); - } -} - -.gem-c-step-nav__panel { - @include govuk-text-colour; - @include step-nav-font(16); - padding-bottom: govuk-spacing(5); - - .gem-c-step-nav--large & { - @include step-nav-font(16, $tablet-size: 19); - } - - .js-enabled &.js-hidden { - display: none; - } -} - -// contents of the steps, such as paragraphs and links - -.gem-c-step-nav__paragraph { - padding-bottom: govuk-spacing(3); - margin: 0; - font-size: inherit; - - + .gem-c-step-nav__list { - margin-top: -5px; - } - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - padding-bottom: govuk-spacing(6); - } - } - - .gem-c-step-nav--large & + .gem-c-step-nav__list { - @include govuk-media-query($from: tablet) { - margin-top: -govuk-spacing(3); - } - } -} - -.gem-c-step-nav__list { - padding: 0; - padding-bottom: 10px; - list-style: none; - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - padding-bottom: 20px; - } - } -} - -.gem-c-step-nav__list--choice { - $links-margin: 20px; - - margin-left: $links-margin; - list-style: disc; - - .gem-c-step-nav__list-item--active:before { - left: -(govuk-spacing(6) + govuk-spacing(3)) - $links-margin; - } - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - .gem-c-step-nav__list-item--active:before { - left: -(govuk-spacing(9)) - $links-margin; - } - } - } -} - -.gem-c-step-nav__list-item { - margin-bottom: 10px; -} - -.gem-c-step-nav__link { - @include govuk-link-common; - @include govuk-link-style-default; -} - -.gem-c-step-nav__link-active-context { - @include govuk-visually-hidden; -} - -.gem-c-step-nav__list-item--active { - position: relative; - - &:before { - box-sizing: border-box; - content: ""; - position: absolute; - z-index: 5; - top: .6em; // position the dot to align with the first row of text in the link - left: -(govuk-spacing(6) + govuk-spacing(3)); - margin-top: -($stroke-width / 2); - margin-left: ($number-circle-size / 2); - width: $number-circle-size / 2; - height: $stroke-width; - background: govuk-colour("black"); - } - - .gem-c-step-nav--large & { - @include govuk-media-query($from: tablet) { - &:before { - left: -(govuk-spacing(9)); - margin-left: ($number-circle-size-large / 2); - } - } - } - - .gem-c-step-nav__link { - @include govuk-link-style-text; - } -} - -.gem-c-step-nav__context { - display: inline-block; - font-weight: normal; - color: govuk-colour("dark-grey", $legacy: "grey-1"); - - &:before { - content: " \2013\00a0"; // dash followed by   - } -} - -.gem-c-step-nav__list--no-marker { - list-style-type: none; -} +@import "./step-by-step-nav-header"; +@import "./step-by-step-nav-main"; +@import "./step-by-step-nav-related"; diff --git a/app/assets/stylesheets/ccs/facilities-management/_summary-box.scss b/app/assets/stylesheets/components/summary-box/_summary-box.scss similarity index 84% rename from app/assets/stylesheets/ccs/facilities-management/_summary-box.scss rename to app/assets/stylesheets/components/summary-box/_summary-box.scss index 27fdeda173..747db63d68 100644 --- a/app/assets/stylesheets/ccs/facilities-management/_summary-box.scss +++ b/app/assets/stylesheets/components/summary-box/_summary-box.scss @@ -1,7 +1,7 @@ .ccs-summary-box { @extend %govuk-body-m; - background-color: #f8f8f8; + background-color: ccs-colour("light-grey"); padding: govuk-spacing(3); } @@ -27,7 +27,7 @@ } .ccs-summary-box__content { - background-color: #ffffff; + background-color: ccs-colour("white"); padding: govuk-spacing(2); & details { diff --git a/app/assets/stylesheets/ccs/facilities-management/_supplier_lot_data.scss b/app/assets/stylesheets/components/supplier-lot-data/_supplier-lot-data.scss similarity index 100% rename from app/assets/stylesheets/ccs/facilities-management/_supplier_lot_data.scss rename to app/assets/stylesheets/components/supplier-lot-data/_supplier-lot-data.scss diff --git a/app/assets/stylesheets/components/supplier-record/_supplier-record.scss b/app/assets/stylesheets/components/supplier-record/_supplier-record.scss index 124eee821c..08b8a7c1f0 100644 --- a/app/assets/stylesheets/components/supplier-record/_supplier-record.scss +++ b/app/assets/stylesheets/components/supplier-record/_supplier-record.scss @@ -1,29 +1,3 @@ -.supplier-record { - padding-bottom: 20px; -} - -.supplier-record__supplier-name { - margin-bottom: 5px; -} - -.supplier-record__branch { - margin-bottom: 0; -} - -.supplier-record__branch-name { - font-weight: $govuk-font-weight-regular; -} - -.supplier-record__header-group { - margin-bottom: 20px -} - -.supplier-record__markup-rate, -.supplier-record__distance { - font-weight: $govuk-font-weight-semi-bold;; - margin-bottom: 0; -} - .supplier-record__file-download { display: inline-block; position: relative; @@ -46,7 +20,7 @@ text-align: center; line-height: 2.45; text-transform: uppercase; - font-weight: $govuk-font-weight-semi-bold; + font-weight: $govuk-font-weight-bold; content: ""; padding-left: 5px; padding-right: 5px; @@ -81,41 +55,3 @@ background-color: #0D85CD; content: ".ODT"; } - -.supplier-record__print-option { - min-height: 35px; -} - -.supplier-record__calculator { - margin: 0; - background: ccs-colour("grey-4"); -} - -.supplier-record__calculator--muted p { - color: ccs-colour("grey-2"); -} - -.supplier-record__worker-cost, -.supplier-record__agency-fee -{ - margin: 10px 0 0 0; - font-size: 24px; -} - -strong.supplier-record__finders-fee-percentage { - line-height: 1 !important; -} - -@media print { - .supplier-record { - page-break-inside: avoid; - } - - .supplier-record__distance, - .supplier-record__distance-units, - .supplier-record__markup-rate-units, - .supplier-record__markup-rate { - display: inline; - } - -} diff --git a/app/assets/stylesheets/components/typography/_typography.scss b/app/assets/stylesheets/components/typography/_typography.scss deleted file mode 100644 index d02b5a7a36..0000000000 --- a/app/assets/stylesheets/components/typography/_typography.scss +++ /dev/null @@ -1,20 +0,0 @@ -strong { - font-weight: $govuk-font-weight-semi-bold; -} -.govuk-heading-xl { - font-weight: $govuk-font-weight-light; - margin-bottom: 36px; - line-height: 1.15; - - @media (min-width: 300px) and (max-width: 640px){ - word-break: break-all; - } -} -.govuk-heading-l, -.govuk-heading-m, -.govuk-heading-s { - font-weight: $govuk-font-weight-semi-bold; -} -.cmp-start-page__sub-heading { - margin-top: 40px; -} \ No newline at end of file diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index d356f76485..1740b639d5 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -1,17 +1,11 @@ -// We import the GOVUK settings and then override the ones we need to in -// our own settings file. -@import "govuk-frontend/govuk/settings/all"; -@import "settings"; +// Import our settings for CCS and GOV.UK +@import "settings/all"; -// Import the other sections -@import "govuk-frontend/govuk/tools/all"; -@import "govuk-frontend/govuk/helpers/all"; -@import "govuk-frontend/govuk/core/all"; -@import "govuk-frontend/govuk/objects/all"; -// We are importing all the GOVUK components within the components folder +// Import the govuk-frontend assets +@import "govuk-frontend/govuk/all"; + +// Import the additional CCS components @import "components/all"; -@import "govuk-frontend/govuk/utilities/all"; -@import "govuk-frontend/govuk/overrides/all"; // Import additional CCS SCSS -@import "ccs/all"; +@import "ccs/ccs"; diff --git a/app/assets/stylesheets/settings/_all.scss b/app/assets/stylesheets/settings/_all.scss new file mode 100644 index 0000000000..8d49f4e00a --- /dev/null +++ b/app/assets/stylesheets/settings/_all.scss @@ -0,0 +1,2 @@ +@import "ccs/ccs"; +@import "govuk/govuk"; diff --git a/app/assets/stylesheets/settings/ccs/_ccs.scss b/app/assets/stylesheets/settings/ccs/_ccs.scss new file mode 100644 index 0000000000..eda84ca3a9 --- /dev/null +++ b/app/assets/stylesheets/settings/ccs/_ccs.scss @@ -0,0 +1,26 @@ +$ccs-colours: ( + "light-green": #F0FFF1, + "dark-green": #006435, + "button-green": #007e8a, + "red": #9b1a47, + "dark-red": #85163d, + "black": #2f2f2f, + "dark-grey": #6f777b, + "mid-grey": #b1b4b6, + "grey": #dee0e2, + "light-grey": #f8f8f8, + "white": #ffffff, +); + +@function ccs-colour($colour) { + $colour: quote($colour); + + @if not map-has-key($ccs-colours, $colour) { + @error "Unknown colour `#{$colour}`"; + } + + @return map-get($ccs-colours, $colour); +} + +$ccs-border-colour: ccs-colour("mid-grey"); +$ccs-brand-colour: ccs-colour("red") !default; diff --git a/app/assets/stylesheets/settings/govuk/_govuk.scss b/app/assets/stylesheets/settings/govuk/_govuk.scss new file mode 100644 index 0000000000..7226e99180 --- /dev/null +++ b/app/assets/stylesheets/settings/govuk/_govuk.scss @@ -0,0 +1,13 @@ +// Override font and image url functions due to location of those assets +$govuk-assets-path: "assets/govuk-frontend/govuk/assets/"; + +// Make sure that all p tags and a tags have the GOV.UK Styles by default +$govuk-global-styles: true; + +// Set the button colour for the app +$govuk-button-background-colour: ccs-colour("button-green"); + +@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700'); + +$govuk-font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; +$govuk-font-family-print: sans-serif; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3f2cc93645..3ff7b5f1ac 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -54,13 +54,6 @@ def determine_non_admin_after_sign_in delegate :ccs_homepage_url, to: Marketplace helper_method :ccs_homepage_url - # <%= hidden_field_tag 'current_choices', TransientSessionInfo[session.id].to_json %> - # to copy the cached choices - def set_current_choices - TransientSessionInfo[session.id] = JSON.parse(params['current_choices']) if params['current_choices'] - TransientSessionInfo[session.id] = JSON.parse(flash['current_choices']) if flash['current_choices'] && params['current_choices'].nil? - end - protected def configure_permitted_parameters diff --git a/app/controllers/base/passwords_controller.rb b/app/controllers/base/passwords_controller.rb index 2fefa92795..da4bbd1a21 100644 --- a/app/controllers/base/passwords_controller.rb +++ b/app/controllers/base/passwords_controller.rb @@ -16,28 +16,42 @@ def edit end def create - @response = Cognito::ForgotPassword.call(params[:email]) + @response = Cognito::ForgotPassword.call(create_params[:email]) + if @response.success? - cookies[:crown_marketplace_reset_email] = { value: params[:email], expires: 20.minutes, httponly: true } + cookies[:crown_marketplace_reset_email] = { value: create_params[:email], expires: 20.minutes, httponly: true } + redirect_to edit_password_path else - flash[:error] = @response.error - redirect_to new_user_password_path + render :new end end def update - @response = Cognito::ConfirmPasswordReset.call(params[:email], params[:password], params[:password_confirmation], params[:confirmation_code]) + @response = Cognito::ConfirmPasswordReset.call(update_params[:email], update_params[:password], update_params[:password_confirmation], update_params[:confirmation_code]) if @response.success? cookies.delete :crown_marketplace_reset_email redirect_to password_reset_success_path else - render :edit, erorr: @response.error + render :edit end end def password_reset_success; end + + def create_params + params.require(:cognito_forgot_password).permit(:email) + end + + def update_params + params.require(:cognito_confirm_password_reset).permit( + :email, + :password, + :password_confirmation, + :confirmation_code + ) + end end end diff --git a/app/controllers/base/sessions_controller.rb b/app/controllers/base/sessions_controller.rb index c96ce70047..e7a1936587 100644 --- a/app/controllers/base/sessions_controller.rb +++ b/app/controllers/base/sessions_controller.rb @@ -16,7 +16,7 @@ def new def create self.resource ||= User.new - @result = Cognito::SignInUser.new(params[:user][:email], params[:user][:password], request.cookies.blank?) + @result = Cognito::SignInUser.new(sign_in_params[:email], sign_in_params[:password], request.cookies.blank?) @result.call if @result.success? @@ -53,26 +53,26 @@ def after_sign_out_path_for(_resource) sign_in_url end + def challenge_path + cookies[:crown_marketplace_challenge_session] = { value: @result.session, expires: 20.minutes, httponly: true } + cookies[:crown_marketplace_challenge_username] = { value: @result.cognito_uuid, expires: 20.minutes, httponly: true } + + service_challenge_path + end + def result_unsuccessful_path sign_out if @result.needs_password_reset - cookies[:crown_marketplace_reset_email] = { value: params[:user][:email], expires: 20.minutes, httponly: true } + cookies[:crown_marketplace_reset_email] = { value: sign_in_params[:email], expires: 20.minutes, httponly: true } redirect_to edit_password_path elsif @result.needs_confirmation - cookies[:crown_marketplace_confirmation_email] = { value: params[:user][:email], expires: 20.minutes, httponly: true } + cookies[:crown_marketplace_confirmation_email] = { value: sign_in_params[:email], expires: 20.minutes, httponly: true } redirect_to confirm_email_path else render :new end end - - def challenge_path - cookies[:crown_marketplace_challenge_session] = { value: @result.session, expires: 20.minutes, httponly: true } - cookies[:crown_marketplace_challenge_username] = { value: @result.cognito_uuid, expires: 20.minutes, httponly: true } - - service_challenge_path - end end end diff --git a/app/controllers/base/users_controller.rb b/app/controllers/base/users_controller.rb index 3188a7cf85..293dac4487 100644 --- a/app/controllers/base/users_controller.rb +++ b/app/controllers/base/users_controller.rb @@ -4,16 +4,16 @@ class UsersController < ApplicationController before_action :authenticate_user!, except: %i[confirm_new confirm resend_confirmation_email challenge_new challenge] before_action :authorize_user, except: %i[confirm_new confirm resend_confirmation_email challenge_new challenge] - before_action :set_user_phone, only: %i[challenge_new challenge] + before_action :set_user_phone, only: %i[challenge_new challenge], if: -> { params[:challenge_name] == 'SMS_MFA' } helper_method :confirm_email_path, :resend_confirmation_email_path, :challenge_user_path, :new_user_session_path def confirm_new - @result = Cognito::ConfirmSignUp.new(nil, nil) + @result = Cognito::ConfirmSignUp.new(cookies[:crown_marketplace_confirmation_email], nil) end def confirm - @result = Cognito::ConfirmSignUp.call(params[:email], params[:confirmation_code]) + @result = Cognito::ConfirmSignUp.call(confirm_params[:email], confirm_params[:confirmation_code]) if @result.success? cookies.delete :crown_marketplace_confirmation_email @@ -24,17 +24,17 @@ def confirm end def resend_confirmation_email - result = Cognito::ResendConfirmationCode.call(params[:email]) + Cognito::ResendConfirmationCode.call(confirm_params[:email]) - redirect_to confirm_email_path, error: result.error + redirect_to confirm_email_path end def challenge_new - @challenge = Cognito::RespondToChallenge.new(params[:challenge_name], params[:username], params[:session]) + @challenge = Cognito::RespondToChallenge.new(params[:challenge_name], cookies[:crown_marketplace_challenge_username], cookies[:crown_marketplace_challenge_session]) end def challenge - @challenge = Cognito::RespondToChallenge.new(params[:challenge_name], params[:username], params[:session], new_password: params[:new_password], new_password_confirmation: params[:new_password_confirmation], access_code: params[:access_code]) + @challenge = Cognito::RespondToChallenge.new(params[:challenge_name], challenge_params[:username], challenge_params[:session], new_password: challenge_params[:new_password], new_password_confirmation: challenge_params[:new_password_confirmation], access_code: challenge_params[:access_code]) @challenge.call if @challenge.success? @challenge.challenge? ? redirect_to(new_challenge_path) : find_and_sign_in_user @@ -56,7 +56,7 @@ def find_and_sign_in_user cookies.delete :crown_marketplace_challenge_session cookies.delete :crown_marketplace_challenge_username - user = Cognito::CreateUserFromCognito.call(params[:username]).user + user = Cognito::CreateUserFromCognito.call(challenge_params[:username]).user sign_in_user(user) end @@ -69,5 +69,28 @@ def set_user_phone user_phone_full = User.find_by(cognito_uuid: cookies[:crown_marketplace_challenge_username]).try(:phone_number) || Cognito::CreateUserFromCognito.call(cookies[:crown_marketplace_challenge_username]).try(:user).try(:phone_number) @user_phone = ('*' * 9) + user_phone_full.last(3) if user_phone_full end + + def confirm_params + params.require(:cognito_confirm_sign_up).permit( + :confirmation_code, + :email + ) + end + + def challenge_params + params.require(:cognito_respond_to_challenge).permit( + %i[session username] + CHALLANGE_PARAMS[params[:challenge_name]] + ) + end + + CHALLANGE_PARAMS = { + 'NEW_PASSWORD_REQUIRED' => %i[ + new_password + new_password_confirmation + ], + 'SMS_MFA' => %i[ + access_code + ] + }.freeze end end diff --git a/app/controllers/facilities_management/rm6232/procurements_controller.rb b/app/controllers/facilities_management/rm6232/procurements_controller.rb index 1903f1c159..81123ec71d 100644 --- a/app/controllers/facilities_management/rm6232/procurements_controller.rb +++ b/app/controllers/facilities_management/rm6232/procurements_controller.rb @@ -15,9 +15,11 @@ def show end def new - @procurement = current_user.rm6232_procurements.build(service_codes: params[:service_codes], - region_codes: params[:region_codes], - annual_contract_value: params[:annual_contract_value]) + @procurement = current_user.rm6232_procurements.build( + service_codes: params[:service_codes], + region_codes: params[:region_codes], + annual_contract_value: params[:annual_contract_value] + ) @procurement.lot_number = @procurement.quick_view_suppliers.lot_number @suppliers = @procurement.quick_view_suppliers.selected_suppliers diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1d5d4ad4c5..110fc09c8f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,6 @@ # rubocop:disable Metrics/ModuleLength module ApplicationHelper include CCS::FrontendHelpers - include LayoutHelper - include GovUKHelper include HeaderNavigationLinksHelper def feedback_email_link @@ -13,65 +11,21 @@ def support_telephone_number Marketplace.support_telephone_number end - def govuk_form_group_with_optional_error(journey, *attributes, &) - attributes_with_errors = attributes.select { |a| journey.errors[a].any? } - - css_classes = ['govuk-form-group'] - css_classes += ['govuk-form-group--error'] if attributes_with_errors.any? - - tag.div(class: css_classes, &) + def error_id(attribute) + "#{attribute}-error" end - def govuk_fieldset_with_optional_error(journey, *attributes, &) - attributes_with_errors = attributes.select { |a| journey.errors[a].any? } + def validation_messages(model_object_sym, *attribute_symbols) + translation_key = "errors.models.#{model_object_sym.downcase}.attributes" + translation_key += ".#{attribute_symbols.join('.')}" - options = { class: 'govuk-fieldset' } - options['aria-describedby'] = attributes_with_errors.map { |a| error_id(a) } if attributes_with_errors.any? + %w[activerecord activemodel].each do |active_type| + result = t("#{active_type}.#{translation_key}") - tag.fieldset(**options, &) - end - - def display_error(journey, attribute, margin = true, id_prefix = '') - error = journey.errors[attribute].first - return if error.blank? - - tag.span(id: "#{id_prefix}#{error_id(attribute)}", class: "govuk-error-message #{'govuk-!-margin-top-3' if margin}") do - error.to_s + return result unless result.include? 'translation_missing' end - end - ERROR_TYPES = { - too_long: 'maxlength', - too_short: 'minlength', - blank: 'required', - inclusion: 'required', - after: 'max', - greater_than: 'min', - greater_than_or_equal_to: 'min', - before: 'min', - less_than: 'max', - less_than_or_equal_to: 'max', - not_a_date: 'pattern', - not_a_number: 'number', - not_an_integer: 'number' - }.freeze - - def get_client_side_error_type_from_errors(errors, attribute) - return ERROR_TYPES[errors.details[attribute].first[:error]] if ERROR_TYPES.key?(errors.details[attribute].try(:first)[:error]) - - errors.details[attribute].first[:error].to_sym unless ERROR_TYPES.key?(errors.details[attribute].first[:error]) - end - - def css_classes_for_input(journey, attribute, extra_classes = []) - error = journey.errors[attribute].first - - css_classes = ['govuk-input'] + extra_classes - css_classes += ['govuk-input--error'] if error.present? - css_classes - end - - def error_id(attribute) - "#{attribute}-error" + {} end def page_title @@ -186,11 +140,20 @@ def accordion_region_items(region_codes, with_overseas: false) next unless nuts1_regions[region_group_code] + region_name = "#{region.name.gsub(160.chr('UTF-8'), ' ')} (#{region.code})" + nuts1_regions[region.code[..2]][:items] << { - code: region.code, value: region.code, - name: "#{region.name.gsub(160.chr('UTF-8'), ' ')} (#{region.code})", - selected: region_codes.include?(region.code) + label: { + text: region_name, + }, + code: region.code, + checked: region_codes.include?(region.code), + attributes: { + id: "region_#{region.code}", + title: region_name, + sectionid: region_group_code + } } end @@ -204,12 +167,26 @@ def rm6232_accordion_service_items(service_codes) { name: work_package.name, items: work_package.selectable_services.map do |service| + service_code = service.code.tr('.', '-') + { - code: service.code.tr('.', '-'), value: service.code, - name: service.name, - selected: service_codes&.include?(service.code), - description: service.description + label: { + text: service.name, + }, + hint: { + text: capture do + concat(service.description) + concat(tag.hr(class: 'govuk-section-break govuk-!-margin-top-4')) + concat(link_to(t('facilities_management.rm6232.journey.choose_services.learn_more'), facilities_management_rm6232_service_specification_path(service_code), target: '_blank', rel: 'noopener')) + end + }, + checked: service_codes&.include?(service.code), + attributes: { + id: "service_#{service_code}", + title: service.name, + sectionid: work_package.code + } } end } @@ -222,13 +199,13 @@ def can_show_new_framework_banner? end # rubocop:disable Metrics/ParameterLists - def link_to_add_row(name, number_of_items, form, association, partial_prefix, **args) + def link_to_add_row(name, number_of_items, form, association, partial_prefix, **options) new_object = form.object.send(association).klass.new id = new_object.object_id fields = form.fields_for(association, new_object, child_index: id) do |builder| render("#{partial_prefix}/#{association.to_s.singularize}", ff: builder) end - link_to(name.gsub('', number_of_items.to_s), '#', class: args[:class], data: { id: id, fields: fields.gsub('\n', ''), 'button-text': name }) + govuk_button(name.gsub('', number_of_items.to_s), href: '#', classes: options[:class], attributes: { data: { id: id, fields: fields.gsub('\n', ''), 'button-text': name } }) end # rubocop:enable Metrics/ParameterLists @@ -277,6 +254,38 @@ def pagination_params(paginator) end # rubocop:enable Metrics/AbcSize + def govuk_date_items + [ + { + name: 'dd', + input: { + classes: 'govuk-input--width-2' + }, + label: { + text: I18n.t('date.day') + } + }, + { + name: 'mm', + input: { + classes: 'govuk-input--width-2' + }, + label: { + text: I18n.t('date.month') + } + }, + { + name: 'yyyy', + input: { + classes: 'govuk-input--width-4' + }, + label: { + text: I18n.t('date.year') + } + } + ] + end + STATUS_TO_COLOUR = { cannot_start: :grey, incomplete: :red, diff --git a/app/helpers/gov_uk_helper.rb b/app/helpers/gov_uk_helper.rb deleted file mode 100644 index 1913477235..0000000000 --- a/app/helpers/gov_uk_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -module GovUKHelper - include Accordion - include Button - include CharacterCount - include ErrorMessage - include Radios - include Select - include TextInput -end diff --git a/app/helpers/gov_uk_helper/accordion.rb b/app/helpers/gov_uk_helper/accordion.rb deleted file mode 100644 index c42fc2f16f..0000000000 --- a/app/helpers/gov_uk_helper/accordion.rb +++ /dev/null @@ -1,117 +0,0 @@ -# rubocop:disable Metrics/ModuleLength -module GovUKHelper::Accordion - def govuk_accordion(name, sections, &) - tag.div(class: 'govuk-accordion', id: "accordion-with-summary-sections-for-#{name}", data: { module: 'govuk-accordion' }) do - capture do - sections.each.with_index(1) do |section, index| - concat(tag.div(class: 'govuk-accordion__section') do - capture do - concat(govuk_accordion_heading(index, section[:name])) - concat(govuk_accordion_content(index, name, section, &)) - end - end) - end - end - end - end - - def govuk_accordion_with_checkboxes(name, sections, model_name, attribute, &) - tag.div(class: 'govuk-accordion', id: "accordion-with-summary-sections-for-#{name}", data: { module: 'govuk-accordion' }) do - capture do - sections.each.with_index(1) do |(section_id, section), index| - concat(tag.div(class: 'govuk-accordion__section chooser-section', data: { section: section_id, sectionname: section[:name] }) do - capture do - concat(govuk_accordion_heading(index, section[:name])) - concat(govuk_accordion_content(index, section[:name], section) do - check_boxes_for_section(section_id, model_name, attribute, section[:name], section[:items], &) - end) - end - end) - end - end - end - end - - private - - def govuk_accordion_heading(index, heading_text) - tag.div(class: 'govuk-accordion__section-header') do - tag.h2(class: 'govuk-accordion__section-heading') do - tag.span(heading_text, class: 'govuk-accordion__section-button', id: govuk_accordion_heading_id(index)) - end - end - end - - def govuk_accordion_content(index, name, section, &block) - tag.div(class: 'govuk-accordion__section-content', id: govuk_accordion_content_id(name, index), aria: { labelledby: govuk_accordion_heading_id(index) }) do - yield(section) if block - end - end - - def check_boxes_for_section(section_id, model_name, attribute, section_name, items, &) - tag.div(class: 'govuk-form-group chooser-input', sectionname: section_name, section: section_id) do - tag.div(class: 'govuk-checkboxes') do - capture do - items.each do |item| - concat(tag.div(class: 'govuk-checkboxes__item') do - capture do - concat(check_box_item(section_id, model_name, attribute, item)) - concat(check_box_label(section_id, model_name, item, &)) - end - end) - end - if items.length > 1 - concat(tag.p('Or', class: 'govuk-body govuk-!-margin-top-4')) - concat(select_all_checkbox(section_id, model_name)) - end - end - end - end - end - - def check_box_item(section_id, model_name, attribute, item) - check_box_tag( - "#{attribute}[]", - item[:value], - item[:selected], - title: item[:name], - class: 'govuk-checkboxes__input', - sectionid: section_id, - id: "#{model_name}_#{item[:code]}" - ) - end - - def check_box_label(section_id, model_name, item, &block) - tag.label(class: 'govuk-label govuk-checkboxes__label', for: "#{model_name}_#{item[:code]}") do - capture do - concat(item[:name]) - concat(tag.div(item[:description], class: 'govuk-hint')) if item[:description] - concat(tag.div(yield(section_id, item))) if block - end - end - end - - def select_all_checkbox(section_id, model_name) - tag.div(class: 'govuk-checkboxes__item ccs-select-all') do - capture do - concat(tag.input( - class: 'govuk-checkboxes__input', - id: "#{model_name}_#{section_id}_all", - name: 'section-checkbox_select_all', - type: 'checkbox', - value: '' - )) - concat(check_box_label(section_id, model_name, { name: 'Select all', code: "#{section_id}_all" })) - end - end - end - - def govuk_accordion_heading_id(index) - "accordion-with-summary-sections-heading-#{index + 1}" - end - - def govuk_accordion_content_id(name, index) - "accordion-with-summary-sections-for-#{name}-content-#{index + 1}" - end -end -# rubocop:enable Metrics/ModuleLength diff --git a/app/helpers/gov_uk_helper/button.rb b/app/helpers/gov_uk_helper/button.rb deleted file mode 100644 index 3de29c6fea..0000000000 --- a/app/helpers/gov_uk_helper/button.rb +++ /dev/null @@ -1,15 +0,0 @@ -module GovUKHelper::Button - def govuk_button_start(start_text, link_url, **options) - class_list = ['govuk-button govuk-button--start'] - class_list << options.delete(:class) - - link_to(link_url, role: 'button', class: class_list, **options) do - capture do - concat(start_text) - concat(tag.svg(class: 'govuk-button__start-icon', xmlns: 'http://www.w3.org/2000/svg', width: 17.5, height: 19, viewBox: '0 0 33 40', aria: { hidden: true }, focusable: false) do - tag.path(fill: 'currentColor', d: 'M0 0h13l20 20-20 20H0l20-20z') - end) - end - end - end -end diff --git a/app/helpers/gov_uk_helper/character_count.rb b/app/helpers/gov_uk_helper/character_count.rb deleted file mode 100644 index bc8a720ac2..0000000000 --- a/app/helpers/gov_uk_helper/character_count.rb +++ /dev/null @@ -1,27 +0,0 @@ -module GovUKHelper::CharacterCount - def govuk_character_count(form, attribute, max_length, rows, **options) - @form = form - @attribute = attribute - @max_length = max_length - @rows = rows - @options = options - - tag.div(class: 'govuk-character-count', data: { module: 'govuk-character-count', maxlength: @max_length }) do - capture do - concat(govuk_text_area) - concat(govuk_characters_remaing) - end - end - end - - def govuk_text_area - class_list = 'govuk-textarea govuk-js-character-count' - class_list << ' govuk-textarea--error' if @form.object.errors.include? @attribute - - @form.text_area @attribute, class: class_list, rows: @rows, **@options - end - - def govuk_characters_remaing - tag.div("You have #{@max_length} characters remaining", id: "#{@form.object_name}_#{@attribute}-info", class: 'govuk-hint govuk-character-count__message', aria: { live: 'polite' }) - end -end diff --git a/app/helpers/gov_uk_helper/error_message.rb b/app/helpers/gov_uk_helper/error_message.rb deleted file mode 100644 index adfc75bb70..0000000000 --- a/app/helpers/gov_uk_helper/error_message.rb +++ /dev/null @@ -1,14 +0,0 @@ -module GovUKHelper::ErrorMessage - def govuk_error_message(form, attribute) - govuk_error_message_format(attribute, form.object.errors[attribute].first) - end - - def govuk_error_message_format(attribute, message) - tag.p(id: "#{attribute}-error", class: 'govuk-error-message') do - capture do - concat(tag.span('Error:', class: 'govuk-visually-hidden')) - concat(message) - end - end - end -end diff --git a/app/helpers/gov_uk_helper/radios.rb b/app/helpers/gov_uk_helper/radios.rb deleted file mode 100644 index 4ad7f47a99..0000000000 --- a/app/helpers/gov_uk_helper/radios.rb +++ /dev/null @@ -1,26 +0,0 @@ -module GovUKHelper::Radios - def govuk_radios_conditional(&) - tag.div(class: 'govuk-radios govuk-radios--conditional', data: { module: 'govuk-radios' }, &) - end - - def govuk_radios_conditional_item(form, attribute, value, label_text) - tag.div(class: 'govuk-radios__item') do - capture do - concat(form.radio_button(attribute, value, value: value, class: 'govuk-radios__input', data: { 'aria-controls': govuk_radios_conditional_id(attribute, value) })) - concat(form.label(attribute, label_text, value: value, class: 'govuk-label govuk-radios__label')) - yield if block_given? - end - end - end - - def govuk_radios_conditional_area(attribute, value, **options, &) - class_list = ['govuk-radios__conditional govuk-radios__conditional--hidden'] - class_list << options.delete(:class) - - tag.div(class: class_list.compact.join(' '), id: govuk_radios_conditional_id(attribute, value), **options, &) - end - - def govuk_radios_conditional_id(attribute, value) - "#{attribute}-#{value}" - end -end diff --git a/app/helpers/gov_uk_helper/select.rb b/app/helpers/gov_uk_helper/select.rb deleted file mode 100644 index f240ea81bb..0000000000 --- a/app/helpers/gov_uk_helper/select.rb +++ /dev/null @@ -1,30 +0,0 @@ -module GovUKHelper::Select - def govuk_select(form, attribute, select_options) - class_list = ['govuk-form-group'] - any_errors = form.object.errors.include? attribute - class_list << 'govuk-form-group--error' if any_errors - - tag.div(class: class_list, id: "#{attribute}-form-group") do - capture do - concat(govuk_label(form, attribute, select_options[:label])) if select_options[:label] - concat(govuk_hint(select_options[:hint])) if select_options[:hint] - concat(govuk_error_message(form, attribute)) if any_errors - concat(govuk_select_input(attribute, any_errors, select_options[:select])) - end - end - end - - private - - def govuk_select_input(attribute, any_errors, select_options) - class_list = ['govuk-select'] - class_list << select_options.delete(:classes) if select_options[:classes] - class_list << 'govuk-select--error' if any_errors - - options = select_options[:options].map do |select_option| - [select_option[:text] || select_option[:value], select_option[:value], select_option[:attributes]] - end - - select_tag(attribute, options_for_select(options, select_options[:selected]), class: class_list, prompt: select_options[:prompt], **(select_options[:attributes] || {})) - end -end diff --git a/app/helpers/gov_uk_helper/text_input.rb b/app/helpers/gov_uk_helper/text_input.rb deleted file mode 100644 index 1085fd3a41..0000000000 --- a/app/helpers/gov_uk_helper/text_input.rb +++ /dev/null @@ -1,51 +0,0 @@ -module GovUKHelper::TextInput - def govuk_text_input(form, attribute, text_input_options) - class_list = ['govuk-form-group'] - any_errors = form.object.errors.include? attribute - class_list << 'govuk-form-group--error' if any_errors - - tag.div(class: class_list, id: "#{attribute}-form-group") do - capture do - concat(govuk_label(form, attribute, text_input_options[:label])) if text_input_options[:label] - concat(govuk_hint(text_input_options[:hint])) if text_input_options[:hint] - concat(govuk_error_message(form, attribute)) if any_errors - concat(govuk_input(form, attribute, any_errors, text_input_options[:input])) - end - end - end - - private - - def govuk_label(form, attribute, label_options = {}) - class_list = ['govuk-label'] - class_list << label_options[:classes] if label_options[:classes] - - form.label(attribute, label_options[:text], class: class_list, **label_options) - end - - def govuk_hint(hint_options = {}) - tag.div(hint_options[:text], class: 'govuk-hint', **hint_options) - end - - def govuk_input(form, attribute, any_errors, input_options = {}) - class_list = ['govuk-input'] - class_list << input_options.delete(:classes) if input_options[:classes] - class_list << 'govuk-input--error' if any_errors - - prefix = input_options.delete(:prefix) - suffix = input_options.delete(:suffix) - text_field = form.text_field(attribute, class: class_list, **input_options[:attributes]) - - if prefix || suffix - tag.div(class: 'govuk-input__wrapper') do - capture do - concat(tag.div(prefix[:text], class: 'govuk-input__prefix', aria: { hidden: true })) if prefix - concat(text_field) - concat(tag.div(suffix[:text], class: 'govuk-input__suffix', aria: { hidden: true })) if suffix - end - end - else - text_field - end - end -end diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb deleted file mode 100644 index ccd7c83321..0000000000 --- a/app/helpers/layout_helper.rb +++ /dev/null @@ -1,52 +0,0 @@ -module LayoutHelper - def form_group_with_error(model, attribute) - css_classes = ['govuk-form-group'] - any_errors = model.errors.include? attribute - css_classes += ['govuk-form-group--error'] if any_errors - - tag.div(class: css_classes, id: "#{attribute}-form-group") do - yield(display_error(model, attribute), any_errors) - end - end - - # looks up the locals data for validation messages - def validation_messages(model_object_sym, attribute_sym = nil) - translation_key = "activerecord.errors.models.#{model_object_sym.downcase}.attributes" - translation_key += if attribute_sym.is_a? Array - ".#{attribute_sym.join('.')}" - else - ".#{attribute_sym}" - end - - result = t(translation_key) - if result.include? 'translation_missing' - translation_key.sub! 'activerecord', 'activemodel' - result = t(translation_key) - end - - return {} if result.include? 'translation_missing' - - result - end - - def ccs_account_panel_row(**options, &) - class_list = ['govuk-grid-row govuk-!-margin-bottom-6 fm-buyer-account-panel__container'] - class_list << options.delete(:class) - - tag.div(class: class_list, **options, &) - end - - def ccs_account_panel(title, title_url, **options, &) - class_list = ['govuk-grid-column-one-third fm-buyer-account-panel'] - class_list << options.delete(:class) - - tag.div(class: class_list, **options) do - capture do - concat(tag.p do - link_to(title, title_url, class: 'ccs-font-weight-semi-bold fm-buyer-account-panel__title_no_link govuk-!-margin-bottom-2 govuk-link--no-visited-state') - end) - concat(tag.p(class: 'govuk-!-top-padding-4', &)) - end - end - end -end diff --git a/app/javascript/packs/ccs.ts b/app/javascript/packs/ccs.ts index f4b35ba06d..2d2ad39914 100644 --- a/app/javascript/packs/ccs.ts +++ b/app/javascript/packs/ccs.ts @@ -11,7 +11,6 @@ import initLimitInputToInteger from '../src/facilitiesManagement/integerInput' import initManagementReport from '../src/facilitiesManagement/rm3830/admin/managementReport' import initNumberWithCommas from '../src/facilitiesManagement/numberWithCommas' import initPasswordStrength from '../src/shared/passwordStrength' -import initResultsToggle from '../src/facilitiesManagement/procurements/resultsToggle' import initRM3830AdminAdminUpload from '../src/facilitiesManagement/rm3830/admin/adminUploadProgress' import initSelectRegion from '../src/facilitiesManagement/procurements/selectRegion' import initStepByStepNav from '../src/shared/stepByStepNav' @@ -20,7 +19,6 @@ import initSupplierDataSnapshot from '../src/facilitiesManagement/rm6232/admin/s $(document).on('turbolinks:load', () => { // Facilities Management - Procurements TS initChooseServicesForBuilding() - initResultsToggle() initSelectRegion() // Facilities Management - RM3830 - Admin TS diff --git a/app/javascript/src/facilitiesManagement/procurements/resultsToggle.ts b/app/javascript/src/facilitiesManagement/procurements/resultsToggle.ts deleted file mode 100644 index 55a15406a0..0000000000 --- a/app/javascript/src/facilitiesManagement/procurements/resultsToggle.ts +++ /dev/null @@ -1,26 +0,0 @@ -const initResultsToggle = (): void => { - const $resultsFilterButton: JQuery = $('#results-filter-button') - - $resultsFilterButton.on('click', (event: JQuery.ClickEvent) => { - event.preventDefault() - - const $requirementsPlane: JQuery = $('#requirements-list') - const $suppliersPlane: JQuery = $('#supplier-lot-list__container') - - const isHidden: boolean = $requirementsPlane.is(':hidden') - const currentText: string = $resultsFilterButton.text() - - if (isHidden) { - $requirementsPlane.show() - $suppliersPlane.addClass('govuk-grid-column-two-thirds').removeClass('govuk-grid-column-full') - } else { - $requirementsPlane.hide() - $suppliersPlane.addClass('govuk-grid-column-full').removeClass('govuk-grid-column-two-thirds') - } - - $resultsFilterButton.text($resultsFilterButton.attr('alt-text') ?? '') - $resultsFilterButton.attr('alt-text', currentText) - }) -} - -export default initResultsToggle diff --git a/app/javascript/src/shared/checkboxAccordion.ts b/app/javascript/src/shared/checkboxAccordion.ts index 0d0a0e630f..4fab57a21f 100644 --- a/app/javascript/src/shared/checkboxAccordion.ts +++ b/app/javascript/src/shared/checkboxAccordion.ts @@ -101,12 +101,12 @@ class AccordionSection implements AccordionSectionInterface { private readonly selectAllcheckBox: AccordionSelectAllItem constructor (basket: Basket, $section: JQuery) { - $section.find('div.govuk-checkboxes__item:not(.ccs-select-all) > input.govuk-checkboxes__input').each((_index: number, checkBox: HTMLElement) => { + $section.find('input.govuk-checkboxes__input:not(.ccs-select-all)').each((_index: number, checkBox: HTMLElement) => { this.checkBoxes.push(new AccordionNamedItem(this, basket, $(checkBox) as JQuery)) }) this.numberOfCheckboxes = this.checkBoxes.length - this.selectAllcheckBox = new AccordionSelectAllItem(this, basket, $section.find('div.ccs-select-all > input') as JQuery) + this.selectAllcheckBox = new AccordionSelectAllItem(this, basket, $section.find('input.ccs-select-all') as JQuery) } private readonly numberOfCheckedItems = (): number => this.checkBoxes.filter((accordionItem: AccordionNamedItem): boolean => accordionItem.isChecked()).length @@ -162,7 +162,7 @@ class BasketItem implements BasketItemInterface { } class Basket implements BasketInterface { - private readonly $basket: JQuery = $('.basket') + private readonly $basket: JQuery = $('#css-list-basket') private readonly $itemList: JQuery = this.$basket.find('ul') private readonly $numberOfItems: JQuery = this.$basket.find('h3') private readonly $removeAllLink: JQuery = this.$basket.find('div > a') as JQuery @@ -175,7 +175,7 @@ class Basket implements BasketInterface { } constructor () { - $('.govuk-accordion__section.chooser-section').each((_index: number, accordionSection: HTMLElement) => { + $('.govuk-accordion__section').each((_index: number, accordionSection: HTMLElement) => { this.accordionSections.push(new AccordionSection(this, $(accordionSection))) }) @@ -213,7 +213,6 @@ class Basket implements BasketInterface { isShown = false } else if (numberOfItems === 1) { numberOfItemsText = this.textOptions.single_item - isShown = false } else { numberOfItemsText = this.textOptions.plural_items } @@ -223,7 +222,7 @@ class Basket implements BasketInterface { } private readonly toggleRemoveAllButton = (isShown: boolean): void => { - isShown ? this.$removeAllLink.show() : this.$removeAllLink.hide() + this.$removeAllLink.toggle(isShown) } private readonly removeAll = (event: JQuery.ClickEvent): void => { @@ -240,7 +239,7 @@ class Basket implements BasketInterface { } const initCheckboxAccordion = (): void => { - if ($('.govuk-accordion__section.chooser-section').length > 0) new Basket() + if ($('.govuk-accordion.ccs-basket-accordion').length > 0) new Basket() } export default initCheckboxAccordion diff --git a/app/javascript/src/shared/passwordStrength.ts b/app/javascript/src/shared/passwordStrength.ts index af8e0329a2..45073800e8 100644 --- a/app/javascript/src/shared/passwordStrength.ts +++ b/app/javascript/src/shared/passwordStrength.ts @@ -7,11 +7,10 @@ const runTests = ($input: JQuery, theTests: Array<[RegExp, JQuery { - if (test[0].test(inputText)) { - test[1].removeClass('wrong').addClass('correct') - } else { - test[1].removeClass('correct').addClass('wrong') - } + const testPassed: boolean = test[0].test(inputText) + + test[1].toggleClass('wrong', !testPassed) + test[1].toggleClass('correct', testPassed) }) } @@ -20,7 +19,7 @@ const passwordStrength = ($input: JQuery, theTests: Array<[RegExp, } const initPasswordStrength = (): void => { - if ($('#passwordrules').length) { + if ($('#ccs-password-rules').length) { const theTests: Array<[RegExp, JQuery]> = [ [cReg, $('#passeight')], [pReg, $('#passsymbol')], diff --git a/app/services/cognito/confirm_sign_up.rb b/app/services/cognito/confirm_sign_up.rb index 4e68fe804f..00fdc14a23 100644 --- a/app/services/cognito/confirm_sign_up.rb +++ b/app/services/cognito/confirm_sign_up.rb @@ -4,7 +4,7 @@ class ConfirmSignUp < BaseService attr_reader :email, :confirmation_code attr_accessor :user - validates_presence_of :email, :confirmation_code + validates_presence_of :confirmation_code, :email validates :confirmation_code, presence: true, format: { with: /\A\d+\z/, message: :invalid_format }, diff --git a/app/services/cognito/forgot_password.rb b/app/services/cognito/forgot_password.rb index c60fe97f12..5ef4df0629 100644 --- a/app/services/cognito/forgot_password.rb +++ b/app/services/cognito/forgot_password.rb @@ -3,7 +3,7 @@ class ForgotPassword < BaseService include ActiveModel::Validations attr_reader :email, :error - validates :email, format: { with: /\A([\w+\d-].?)+@[a-z\d-]+(\.[a-z]+)*\.[a-z]+\z/i } + validates :email, format: { with: /\A([\w+-].?)+@[a-z\d-]+(\.[a-z]+)*\.[a-z]+\z/i } def initialize(email) @email = email.try(:downcase) @@ -11,21 +11,17 @@ def initialize(email) end def call - if valid? - forgot_password - else - @error = I18n.t('cognito/cog_forgot_password_request.attributes.please_enter_a_valid_email_address') - end + forgot_password if valid? rescue Aws::CognitoIdentityProvider::Errors::UserNotFoundException - @error = nil + # To prevent user enumeration, continue if the email does not exist rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException - @error = I18n.t('cognito/cog_forgot_password_request.attributes.please_enter_a_valid_email_address') + errors.add(:email, :invalid) rescue Aws::CognitoIdentityProvider::Errors::ServiceError => e - @error = e.message + errors.add(:base, e.message) end def success? - error.nil? + errors.none? end private diff --git a/app/services/cognito/sign_in_user.rb b/app/services/cognito/sign_in_user.rb index 9c081835bc..af27c6a1dc 100644 --- a/app/services/cognito/sign_in_user.rb +++ b/app/services/cognito/sign_in_user.rb @@ -19,20 +19,17 @@ def initialize(email, password, cookies_disabled) def call initiate_auth if valid? rescue Aws::CognitoIdentityProvider::Errors::PasswordResetRequiredException => e - @error = e.message errors.add(:base, e.message) @needs_password_reset = true rescue Aws::CognitoIdentityProvider::Errors::UserNotConfirmedException => e - @error = e.message errors.add(:base, e.message) @needs_confirmation = true rescue Aws::CognitoIdentityProvider::Errors::ServiceError - @error = I18n.t('facilities_management.users.sign_in_error') - errors.add(:base, @error) + errors.add(:base, :sign_in_error) end def success? - @auth_response.present? && @error.nil? + @auth_response.present? && errors.none? end def challenge? diff --git a/app/services/transient_session_info.rb b/app/services/transient_session_info.rb deleted file mode 100644 index 318b96c85d..0000000000 --- a/app/services/transient_session_info.rb +++ /dev/null @@ -1,28 +0,0 @@ -class TransientSessionInfo - @dict = {} - - class << self - attr_reader :dict - - def self.initialize - @dict = {} - end - end - - def self.[](key1, key2 = nil) - return @dict[key1] if key2.nil? - return nil unless @dict[key1] - - @dict[key1][key2] - end - - def self.[]=(key1, key2 = nil, value) - @dict ||= {} - @dict[key1] ||= {} - if key2 - @dict[key1][key2] = value - else - @dict[key1] = value - end - end -end diff --git a/app/views/base/passwords/edit.html.erb b/app/views/base/passwords/edit.html.erb index 23ff378d75..185c36196d 100644 --- a/app/views/base/passwords/edit.html.erb +++ b/app/views/base/passwords/edit.html.erb @@ -1,71 +1,88 @@ -<%= content_for :page_title, t(".heading") %> +<%= content_for :page_title, t('.heading') %> +
<%= render partial: 'shared/error_summary', locals: { errors: @response.errors } %> -

- <%= t('.heading') %> -

- -

- <%= t('.heading1') %> -

- -

- <%= t('.lead1') %> -

- -

- <%= t('.text_html') %> -

- -

- <%= t('.lead') %> <%= @response.email %> -

- - <%= form_tag edit_password_path, class: 'ccs-form', id: 'cog_forgot_password_reset_form', method: :put do %> - -
- -
- -

<%= t('.password') %>:

- - <%= render '/layouts/password-strength', text: 'password01' %> - - - - <%= display_error(@response, :password) %> - <%= password_field_tag :password, nil, class: "govuk-input govuk-!-width-three-quarters", id: "password01", autocomplete: "off" %> -
- -
- - - <%= display_error(@response, :password_confirmation) %> - <%= password_field_tag :password_confirmation, nil, class: "govuk-input govuk-!-width-three-quarters", id: "password02", autocomplete: "off" %> -
- -
- - - <%= display_error(@response, :confirmation_code) %> - <%= text_field_tag :confirmation_code, nil,:maxlength => 6, class: "govuk-input govuk-!-width-three-quarters", id: "confirmation-code" %> -
- -
- - <%= hidden_field_tag :email, @response.email %> - - <%= submit_tag t('common.reset_password'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('common.reset_password')}" %> - + <%= govuk_fieldset( + legend: { + text: t('.heading'), + classes: 'govuk-fieldset__legend--l', + is_page_heading: true + } + ) do %> +

+ <%= t('.email_has_been_sent') %> +

+ +

+ <%= t('.if_the_email_address_entered') %> +

+ +

+ <%= t('.text_html') %> +

+ +

+ <%= t('.reset_password_for_html', email_link: mail_to(@response.email, @response.email, class: 'govuk-link')) %> +

+ + <%= form_with url: edit_password_path, model: @response, method: :put, html: { novalidate: true } do |f| %> + <%= govuk_input( + :password, + form: f, + label: { + text: t('.new_password'), + classes: 'govuk-label--m' + }, + hint: { + text: capture do + concat(tag.p(t('.password'), class: 'govuk-body')) + concat(render('/layouts/password-strength', text: 'password01')) + end + }, + field_type: :password, + classes: 'govuk-!-width-three-quarters', + attributes: { + id: "password01", + autocomplete: 'off', + } + ) %> + + <%= govuk_input( + :password_confirmation, + form: f, + label: { + text: t('.confirm_new_password'), + classes: 'govuk-label--m' + }, + field_type: :password, + classes: 'govuk-!-width-three-quarters', + attributes: { + id: "password02", + autocomplete: 'off', + } + ) %> + + <%= govuk_input( + :confirmation_code, + form: f, + label: { + text: t('.verify_code'), + classes: 'govuk-label--m' + }, + field_type: :number, + classes: 'govuk-!-width-three-quarters', + attributes: { + maxlength: '6', + } + ) %> + + <%= f.hidden_field :email, value: @response.email %> + + <%= govuk_button(t('common.reset_password'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7', attributes: { aria: { label: t('common.reset_password') } }) %> + <% end %> <% end %>
diff --git a/app/views/base/passwords/new.html.erb b/app/views/base/passwords/new.html.erb index 3a50402a74..472429efbe 100644 --- a/app/views/base/passwords/new.html.erb +++ b/app/views/base/passwords/new.html.erb @@ -1,23 +1,9 @@ <%= content_for :page_title, t(".heading") %> +
- <% unless flash[:error].nil? %> - <%= govuk_error_summary( - t("common.error_summary_title"), - [ - { - text: flash[:error], - href: "##{error_id('email')}", - attributes: { - data: { - turbolinks: false - } - } - } - ] - ) %> - <% end %> + <%= render partial: 'shared/error_summary', locals: { errors: @response.errors } %>

<%= t('.heading') %> @@ -27,27 +13,28 @@ <%= t('.lead') %>

- <%= form_tag edit_password_path, class: 'ccs-form', id: 'cog_forgot_password_request_form', specialvalidation: true, novalidate: true, method: :post do %> - -
- - -
- <%= t('.email_hint_html') %> -
- - <% unless flash[:error].nil? %> - - <%= flash[:error] %> - - <% end %> - - -
+ <%= form_with url: edit_password_path, model: @response, method: :post, html: { novalidate: true } do |f| %> + <%= govuk_input( + :email, + form: f, + label: { + text: t('.email'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.email_hint') + }, + field_type: :email, + classes: 'govuk-!-width-three-quarters', + attributes: { + autofocus: true, + autocomplete: 'off', + spellcheck: false, + required: true + } + ) %> - <%= submit_tag t('common.send_reset_email'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('common.send_reset_email')}" %> + <%= govuk_button(t('common.send_reset_email'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7', attributes: { aria: { label: t('common.send_reset_email') } }) %> <% end %>

diff --git a/app/views/base/passwords/password_reset_success.html.erb b/app/views/base/passwords/password_reset_success.html.erb index 34f4aa9a9f..ef9cc0bfc9 100644 --- a/app/views/base/passwords/password_reset_success.html.erb +++ b/app/views/base/passwords/password_reset_success.html.erb @@ -1,7 +1,6 @@ <%= content_for :page_title, t(".heading") %>
-

<%= t('.heading') %>

@@ -10,7 +9,6 @@ <%= t('.lead') %>

- <%= link_to t('common.sign_in'), new_user_session_path, id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('common.sign_in')}" %> - + <%= govuk_button(t('common.sign_in'), href: new_user_session_path, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7') %>
diff --git a/app/views/base/registrations/domain_not_on_safelist.html.erb b/app/views/base/registrations/domain_not_on_safelist.html.erb index a04778930c..99ab7d1681 100644 --- a/app/views/base/registrations/domain_not_on_safelist.html.erb +++ b/app/views/base/registrations/domain_not_on_safelist.html.erb @@ -1,7 +1,7 @@ +<%= content_for :page_title, t('.heading') %> +
- -

<%= t('.heading') %>

@@ -27,7 +27,6 @@ - <%= link_to 'Back to create a Buyer account', sign_up_path, class: 'govuk-button govuk-!-margin-top-4 govuk-!-margin-bottom-8 govuk-!-padding-left-5 govuk-!-padding-right-5', 'aria-label': "Back to create a Buyer account" %> - + <%= govuk_button(t('.back_to_create'), href: sign_up_path, classes: 'govuk-!-margin-top-4 govuk-!-margin-bottom-8 govuk-!-padding-left-5 govuk-!-padding-right-5') %>
diff --git a/app/views/base/registrations/new.html.erb b/app/views/base/registrations/new.html.erb index e43ea0e7cb..89b634e188 100644 --- a/app/views/base/registrations/new.html.erb +++ b/app/views/base/registrations/new.html.erb @@ -1,64 +1,79 @@ +<%= content_for :page_title, t('.heading') %> +
<%= render partial: 'shared/error_summary', locals: { errors: @result.errors }%>

- <%= t('.heading') %> + <%= t('.heading_html') %>

<%= t('.lead') %>

- <%= form_for resource, as: resource_name, url: sign_up_path, html: {specialvalidation: true, novalidate: true, class: 'ccs-form', id: 'cop_register'}, method: :post do |f| %> -
- -
- - -
- <%= t('.email_hint') %> -
- - <%= display_error(@result, :email) %> - <%= f.email_field :email, autofocus: true, autocomplete: "off", class:"govuk-input govuk-!-width-three-quarters", id: "email", spellcheck: false, required: true, aria: {describedby: "email-hint"} %> -
- -
- -
- - - - -
- -

Your password must have:

- - <%= render '/layouts/password-strength', text: 'password01' %> - - <%= display_error(@result, :password) %> - <%= f.password_field :password, autocomplete: "off", id: "password01", class: "govuk-input govuk-!-width-three-quarters" %> -
- -
- - - <%= display_error(@result, :password_confirmation) %> - <%= f.password_field :password_confirmation, autocomplete: "off", id: "password02", class: "govuk-input govuk-!-width-three-quarters" %> -
- -
- - <%= f.submit t('common.create_account'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7 govuk-!-margin-bottom-8", name: 'Create account', 'aria-label': t('common.create_account') %> + <%= form_with url: sign_up_path, model: @result, method: :post, html: { novalidate: true } do |f| %> + <%= govuk_input( + :email, + form: f, + label: { + text: t('.email'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.email_hint') + }, + field_type: :email, + classes: 'govuk-!-width-three-quarters', + attributes: { + name: "#{resource_name}[email]", + autofocus: true, + autocomplete: 'off', + spellcheck: false, + required: true + } + ) %> + + <%= govuk_input( + :password, + form: f, + label: { + text: t('.create_password'), + classes: 'govuk-label--m' + }, + hint: { + text: capture do + concat(tag.p(t('.your_password_must_have'), class: 'govuk-body')) + concat(render('/layouts/password-strength', text: 'password01')) + end + }, + field_type: :password, + classes: 'govuk-!-width-three-quarters', + attributes: { + name: "#{resource_name}[password]", + id: "password01", + autocomplete: 'off', + } + ) %> + + <%= govuk_input( + :password_confirmation, + form: f, + label: { + text: t('.confirm_password'), + classes: 'govuk-label--m' + }, + field_type: :password, + classes: 'govuk-!-width-three-quarters', + attributes: { + name: "#{resource_name}[password_confirmation]", + id: "password02", + autocomplete: 'off', + } + ) %> + + <%= govuk_button(t('common.create_account'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7 govuk-!-margin-bottom-8', attributes: { aria: { label: t('common.create_account') } }) %> <% end %> -
diff --git a/app/views/base/sessions/new.html.erb b/app/views/base/sessions/new.html.erb index feec445323..d5db2391fe 100644 --- a/app/views/base/sessions/new.html.erb +++ b/app/views/base/sessions/new.html.erb @@ -1,61 +1,60 @@ +<%= content_for :page_title, local_header_text %> +
<%= govuk_warning_text(t('.session_expired')) if params[:expired] == 'true' %> <%= render partial: 'shared/error_summary', locals: { errors: @result.errors } %> -
-
- -
-
- <% unless local_header_text.nil? %> - <%= content_for :page_title, local_header_text %> -

- <%= local_header_text %> -

- <% end %> -
-
- -
-
- <%= form_for resource, as: resource_name, url: new_user_session_path, method: :post, html: { specialvalidation: true, novalidate: true, class: 'ccs-form', id: 'cop_sign_in_form'} do |f| %> - -
- -
- <%= local_email_hint_text %> -
- - - <%= t('.please_enter_a_valid_email_address') %> - - <%= display_error(@result, :email) %> - <%= f.email_field :email, value: "#{ @result.email unless @result.email.nil? }", class:"govuk-input govuk-!-width-two-thirds", id:"email", autocomplete: "off", spellcheck:'false', aria: {describedby: "email-hint"} %> -
-
- +

+ <%= local_header_text %> +

- - <%= t('.enter_your_password') %> - - <%= display_error(@result, :password) %> - <%= f.password_field :password, class: "govuk-input govuk-!-width-two-thirds", id: "password", autocomplete: "off" %> + <%= form_with url: new_user_session_path, model: @result, method: :post, html: { novalidate: true } do |f| %> + <%= hidden_field_tag :expired, params[:expired] %> -
+ <%= govuk_input( + :email, + form: f, + label: { + text: t('.email_address'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.email_hint') + }, + field_type: :email, + classes: 'govuk-!-width-two-thirds', + attributes: { + name: "#{resource_name}[email]", + autofocus: true, + autocomplete: 'off', + spellcheck: false, + required: true + } + ) %> - <%= f.submit t('common.sign_in'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('common.sign_in')}" %> + <%= govuk_input( + :password, + form: f, + label: { + text: t('.password'), + classes: 'govuk-label--m' + }, + field_type: :password, + classes: 'govuk-!-width-two-thirds', + attributes: { + name: "#{resource_name}[password]", + autocomplete: 'off', + } + ) %> + <%= govuk_button(t('common.sign_in'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7', attributes: { aria: { label: t('common.sign_in') } }) %> <% end %> <% if service_has_registration? %>

- <%= link_to t('.create_ccs_account_html'), sign_up_path, class: "govuk-link" %> + <%= link_to t('.create_ccs_account'), sign_up_path, class: "govuk-link" %>

<% end %> @@ -63,10 +62,8 @@ <%= t('.problems_signing_in') %> -
    -
  • - <%= link_to t('.forgotten_password_html'), new_user_password_path, class: 'govuk-link' %> -
  • -
+

+ <%= link_to t('.forgotten_password'), new_user_password_path, class: 'govuk-link' %> +

diff --git a/app/views/base/users/_new_password_required.html.erb b/app/views/base/users/_new_password_required.html.erb index dc29cf432a..61db23921e 100644 --- a/app/views/base/users/_new_password_required.html.erb +++ b/app/views/base/users/_new_password_required.html.erb @@ -1,3 +1,5 @@ +<%= content_for :page_title, t('.heading') %> +
@@ -11,39 +13,46 @@ <%= t('.intro') %>

- <%= form_tag challenge_user_path, class: 'ccs-form', id: 'cop_change_password_form', method: :post do %> - -
- - - <%= render '/layouts/password-strength', text: 'password01' %> - - <%= display_error(@challenge, :new_password) %> - <%= password_field_tag :new_password, nil, class: "govuk-input govuk-!-width-two-thirds", id: "password01", autocomplete: "off" %> -
- -
- - - <%= display_error(@challenge, :new_password_confirmation) %> - <%= password_field_tag :new_password_confirmation, nil, class: "govuk-input govuk-!-width-two-thirds", id: "password02", autocomplete: "off" %> -
- - <%= hidden_field_tag :session, cookies[:crown_marketplace_challenge_session] %> - - <%= hidden_field_tag :username, cookies[:crown_marketplace_challenge_username] %> + <%= form_with url: challenge_user_path, model: @challenge, method: :post, html: { novalidate: true } do |f| %> + <%= govuk_input( + :new_password, + form: f, + label: { + text: t('.create_your_password'), + classes: 'govuk-label--m' + }, + hint: { + text: render('/layouts/password-strength', text: 'password01') + }, + field_type: :password, + classes: 'govuk-!-width-two-thirds', + attributes: { + id: "password01", + autocomplete: 'off', + } + ) %> + + <%= govuk_input( + :new_password_confirmation, + form: f, + label: { + text: t('.confirm_your_password'), + classes: 'govuk-label--m' + }, + field_type: :password, + classes: 'govuk-!-width-two-thirds', + attributes: { + id: "password02", + autocomplete: 'off', + } + ) %> + + <%= f.hidden_field :session, value: @challenge.session %> + <%= f.hidden_field :username, value: @challenge.username %> <%= hidden_field_tag :challenge_name, params[:challenge_name] %> - <%= submit_tag t('.change_password_and_sign_in'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('.change_password_and_sign_in')}" %> - + <%= govuk_button(t('.change_password_and_sign_in'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7', attributes: { aria: { label: t('.change_password_and_sign_in') } }) %> <% end %> - - -
diff --git a/app/views/base/users/_sms_mfa.html.erb b/app/views/base/users/_sms_mfa.html.erb index 80f68a752b..5b901e892e 100644 --- a/app/views/base/users/_sms_mfa.html.erb +++ b/app/views/base/users/_sms_mfa.html.erb @@ -1,21 +1,8 @@ +<%= content_for :page_title, t('.heading') %> +
- <% if @challenge.errors.any? %> - <%= govuk_error_summary( - t("common.error_summary_title"), - @challenge.errors.attribute_names.map do |attribute| - { - text: @challenge.errors[attribute].first, - href: "##{error_id(attribute)}", - attributes: { - data: { - turbolinks: false - } - } - } - end - ) %> - <% end %> + <%= render partial: 'shared/error_summary', locals: { errors: @challenge.errors } %>

<%= t('.heading') %> @@ -29,38 +16,29 @@ <%= t('.content') %>

- <%= form_tag challenge_user_path, class: 'ccs-form', id: 'cop_confirmation_code', method: :post do %> - -
- - - - <%= t('activemodel.errors.models.cognito/respond_to_challenge.attributes.access_code.blank') %> - - - - <%= t('activemodel.errors.models.cognito/respond_to_challenge.attributes.access_code.invalid_length') %> - - <%= display_error(@challenge, :access_code) %> - <%= text_field_tag :access_code, nil, class: 'govuk-input govuk-!-width-one-third', id: 'confirmation', type: 'number' %> -
- - - <%= hidden_field_tag :session, cookies[:crown_marketplace_challenge_session] %> + <%= form_with url: challenge_user_path, model: @challenge, method: :post, html: { novalidate: true } do |f| %> + <%= govuk_input( + :access_code, + form: f, + label: { + text: t('.access_code'), + classes: 'govuk-label--m' + }, + field_type: :number, + classes: 'govuk-!-width-one-third', + value: nil + ) %> - <%= hidden_field_tag :username, cookies[:crown_marketplace_challenge_username] %> + <%= f.hidden_field :session, value: @challenge.session %> + <%= f.hidden_field :username, value: @challenge.username %> <%= hidden_field_tag :challenge_name, params[:challenge_name] %> - <%= submit_tag t('common.continue'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('common.continue')}" %> - + <%= govuk_button(t('common.continue'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7', attributes: { aria: { label: t('common.continue') } }) %> <% end %>

<%= t('.resend_the_confirmation_code_html', link: new_user_session_path) %>

-

diff --git a/app/views/base/users/confirm_new.html.erb b/app/views/base/users/confirm_new.html.erb index 9731aa24f9..dc54d8b06b 100644 --- a/app/views/base/users/confirm_new.html.erb +++ b/app/views/base/users/confirm_new.html.erb @@ -1,7 +1,8 @@ +<%= content_for :page_title, t('.heading') %> +
- <%= render partial: 'shared/error_summary', locals: { errors: @result.errors }%>

@@ -9,43 +10,59 @@

- <%= t('.lead_start') %> <%= cookies[:crown_marketplace_confirmation_email] %> <%= t('.lead_end') %> + <% if @result.email %> + <%= t('.lead_html', email_link: mail_to(@result.email, @result.email, class: 'govuk-link')) %> + <% else %> + <%= t('.lead_no_email') %> + <% end %>

- <%= form_tag confirm_email_path, class: 'ccs-form', id: 'cop_confirmation_code', specialvalidation: true, novalidate: true, method: :post do %> + <%= form_with url: confirm_email_path, model: @result, method: :post, html: { novalidate: true } do |f| %> + <%= govuk_input( + :confirmation_code, + form: f, + label: { + text: t('.confirmation_code'), + classes: 'govuk-label--m' + }, + field_type: :number, + classes: 'govuk-!-width-one-third', + value: nil, + attributes: { + autocomplete: 'off', + } + ) %> -
- - - <%= display_error(@result, :confirmation_code) %> - <%= text_field_tag :confirmation_code, nil, class: "govuk-input govuk-!-width-one-third", id: 'confirmation', type: 'number' %> -
- - <% if cookies[:crown_marketplace_confirmation_email] %> - <%= hidden_field_tag :email, cookies[:crown_marketplace_confirmation_email], id: 'email' %> + <% if @result.email %> + <%= f.hidden_field :email, value: @result.email, id: 'email' %> <% else %> -
- - - <%= display_error(@result, :email) %> - <%= text_field_tag :email, nil, autofocus: true, autocomplete: "off", class:"govuk-input govuk-!-width-three-quarters", id: "email", spellcheck: false, aria: {describedby: "email-hint"} %> -
+ <%= govuk_input( + :email, + form: f, + label: { + text: t('.email'), + classes: 'govuk-label--m' + }, + field_type: :email, + classes: 'govuk-!-width-two-thirds', + attributes: { + autofocus: true, + autocomplete: 'off', + spellcheck: false, + required: true + } + ) %> <% end %> - <%= submit_tag t('common.continue'), id: "submit", class: "govuk-button govuk-!-padding-left-7 govuk-!-padding-right-7", 'aria-label': "#{t('common.continue')}" %> - + <%= govuk_button(t('common.continue'), form: f, classes: 'govuk-!-padding-left-7 govuk-!-padding-right-7', attributes: { aria: { label: t('common.continue') } }) %> <% end %> - <% if cookies[:crown_marketplace_confirmation_email] %> - <%= form_tag resend_confirmation_email_path, class: 'ccs-form', id: 'cop_resend_confirmation_code', specialvalidation: true, novalidate: true, method: :post do %> - <%= hidden_field_tag :email, cookies[:crown_marketplace_confirmation_email], id: 'resend-email' %> + <% if @result.email %> + <%= form_with url: resend_confirmation_email_path, model: @result, method: :post, html: { novalidate: true } do |f| %> + <%= f.hidden_field :email, value: @result.email, id: 'resend-email' %>

- <%= submit_tag t('.resend_the_confirmation_email'), id: "resend-the-confirmation-email", class: "govuk-link button_as_link", aria: { label: t('.resend_the_confirmation_email') } %> + <%= f.submit t('.resend_the_confirmation_email'), id: "resend-the-confirmation-email", class: "govuk-link button_as_link", aria: { label: t('.resend_the_confirmation_email') } %>

<% end %> <% end %> diff --git a/app/views/crown_marketplace/allow_list/_allow_list_table.html.erb b/app/views/crown_marketplace/allow_list/_allow_list_table.html.erb index 4e3e712d87..8949471f27 100644 --- a/app/views/crown_marketplace/allow_list/_allow_list_table.html.erb +++ b/app/views/crown_marketplace/allow_list/_allow_list_table.html.erb @@ -1,32 +1,56 @@ <%= paginate paginated_allow_list, views_prefix: 'shared', params: { controller: 'allow_list', action: 'index' } %> - - - - - - - - - <% if paginated_allow_list.empty? %> - - - - <% elsif can? :manage, AllowedEmailDomain %> - <% paginated_allow_list.each do |domain| %> - - - - - <% end %> - <% else %> - <% paginated_allow_list.each do |domain| %> - - - - <% end %> - <% end %> - -
<%= t('.email_domain') %>
<%= t('.no_email_domains_found') %>
<%= domain %> - <%= link_to t('.remove'), delete_crown_marketplace_allow_list_index_path(email_domain: domain), class: 'govuk-link--no-visited-state' %> -
<%= domain %>
+ +<% if paginated_allow_list.empty? %> + <%= govuk_table( + [ + { + text: t('.email_domain') + } + ], + [ + [ + { + text: t('.no_email_domains_found') + } + ] + ] + ) %> +<% elsif can? :manage, AllowedEmailDomain %> + <%= govuk_table( + [ + { + text: t('.email_domain') + }, + { + text: t('.remove') + } + ], + paginated_allow_list.map do |domain| + [ + { + text: domain + }, + { + text: link_to(t('.remove'), delete_crown_marketplace_allow_list_index_path(email_domain: domain), class: 'govuk-link--no-visited-state') + } + ] + end + ) %> +<% else %> + <%= govuk_table( + [ + { + text: t('.email_domain') + } + ], + paginated_allow_list.map do |domain| + [ + { + text: domain + } + ] + end + ) %> +<% end %> + <%= paginate paginated_allow_list, views_prefix: 'shared', params: { controller: 'allow_list', action: 'index' } %> diff --git a/app/views/crown_marketplace/allow_list/delete.html.erb b/app/views/crown_marketplace/allow_list/delete.html.erb index 85f6417df6..54ed9734c8 100644 --- a/app/views/crown_marketplace/allow_list/delete.html.erb +++ b/app/views/crown_marketplace/allow_list/delete.html.erb @@ -15,6 +15,8 @@ <%= form_with url: destroy_crown_marketplace_allow_list_index_path, model: @allowed_email_domain, method: :delete, html: { specialvalidation: true } do |f| %> <%= f.hidden_field :email_domain, value: params[:email_domain] %> - <%= f.submit t('.remove'), class: 'govuk-button govuk-button--warning govuk-!-margin-right-4' %> - <%= link_to t('.return_to_allow_list'), crown_marketplace_allow_list_index_path, class: 'govuk-button govuk-button--secondary', 'aria-label': t('.return_to_allow_list') %> +
+ <%= govuk_button(t('.remove'), form: f, classes: 'govuk-button--warning') %> + <%= govuk_button(t('.return_to_allow_list'), href: crown_marketplace_allow_list_index_path, classes: 'govuk-button--secondary', attributes: { aria: { label: t('.return_to_allow_list') } }) %> +
<% end %> \ No newline at end of file diff --git a/app/views/crown_marketplace/allow_list/index.html.erb b/app/views/crown_marketplace/allow_list/index.html.erb index 665c43a9a1..ac67d74b7c 100644 --- a/app/views/crown_marketplace/allow_list/index.html.erb +++ b/app/views/crown_marketplace/allow_list/index.html.erb @@ -42,25 +42,39 @@ <%= t('.you_can_add') %>

- <%= link_to t('.add_new_email_domain'), new_crown_marketplace_allow_list_path, class: 'govuk-button govuk-button' %> + <%= govuk_button(t('.add_new_email_domain'), href: new_crown_marketplace_allow_list_path) %>
<% end %>
-
-
- <%= form_with url: search_allow_list_crown_marketplace_allow_list_index_path, model: @allowed_email_domain, method: :get, html: { specialvalidation: true, remote: true } do |f| %> - <%= hidden_field_tag :email_domain_added, params[:email_domain_added] %> - <%= f.label :email_domain, t('.find_an_email_domain'), class: 'govuk-label--m' %> -

- <%= t('.enter_an_email_domain') %> -

- <%= f.text_field :email_domain, class: 'govuk-input govuk-!-width-three-quarters govuk-!-margin-right-2', type: 'search', aria: { describedby: 'allow-list-search-hint' } %> - <%= f.submit t('.search'), class: 'govuk-button govuk-button--secondary' %> - <% end %> +<%= form_with url: search_allow_list_crown_marketplace_allow_list_index_path, model: @allowed_email_domain, method: :get, html: { specialvalidation: true, remote: true } do |f| %> + <%= hidden_field_tag :email_domain_added, params[:email_domain_added] %> +
+
+ <%= govuk_input( + :email_domain, + form: f, + label: { + text: t('.find_an_email_domain'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.enter_an_email_domain') + }, + classes: 'govuk-!-width-three-quarters', + attributes: { + type: 'search' + } + ) %> +
-
+
+
+ <%= govuk_button(t('.search'), form: f, classes: 'govuk-button--secondary') %> +
+
+<% end %>
diff --git a/app/views/crown_marketplace/allow_list/new.html.erb b/app/views/crown_marketplace/allow_list/new.html.erb index 069d7a157c..4888c2a801 100644 --- a/app/views/crown_marketplace/allow_list/new.html.erb +++ b/app/views/crown_marketplace/allow_list/new.html.erb @@ -13,23 +13,29 @@ <%= t('.heading') %> - <%= form_group_with_error f.object, :email_domain do |displayed_error| %> - <%= f.label(:email_domain, t('.email_domain_label'), class: 'govuk-label govuk-label--m') %> -
- <%= t('.email_domain_hint') %> -
-

<%= t('.email_domain_must') %>

-
    -
  • <%= t('.email_domain_must_1') %>
  • -
  • <%= t('.email_domain_must_2') %>
  • -
  • <%= t('.email_domain_must_3') %>
  • -
- <%= displayed_error %> - <%= f.text_field :email_domain, class: 'govuk-input govuk-input--width-30 govuk-!-margin-top-4', aria: { describedby: 'email_domain-hint' } %> - <% end %> + <%= govuk_input( + :email_domain, + form: f, + label: { + text: t('.email_domain_label'), + classes: 'govuk-label--m' + }, + hint: { + text: capture do + concat(t('.email_domain_hint')) + concat(tag.p(t('.email_domain_must'), class: 'govuk-body govuk-!-margin-top-4')) + concat(tag.ul(class: 'govuk-list govuk-list--bullet') do + concat(tag.li(t('.email_domain_must_1'))) + concat(tag.li(t('.email_domain_must_2'))) + concat(tag.li(t('.email_domain_must_3'))) + end) + end + }, + classes: 'govuk-input--width-30 govuk-!-margin-top-4' + ) %>
- <%= f.submit t('.save_and_continue'), class: 'govuk-button' %> + <%= govuk_button(t('.save_and_continue'), form: f) %>
<%= link_to t('.return_to_allow_list'), crown_marketplace_allow_list_index_path, class: 'govuk-link--no-visited-state govuk-!-font-size-19', 'aria-label': t('.return_to_allow_list') %>
diff --git a/app/views/crown_marketplace/home/index.html.erb b/app/views/crown_marketplace/home/index.html.erb index fc9331389a..21de8a5d64 100644 --- a/app/views/crown_marketplace/home/index.html.erb +++ b/app/views/crown_marketplace/home/index.html.erb @@ -35,36 +35,29 @@
-
-
- <%= t('.user_support_heading') %> -
-
- -
- -<%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.new_user_invite_title'), add_user_crown_marketplace_manage_users_path(section: 'select-role')) do %> - <%= t('.new_user_body') %> - <% end %> - - <%= ccs_account_panel(t('.manage_users_title'), crown_marketplace_manage_users_path) do %> - <%= t('.manage_users_body') %> - <% end %> -<% end %> - -
-
- <%= t('.allow_list_heading') %> -
-
- -
- -<%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.allow_list_heading'), crown_marketplace_allow_list_index_path) do %> - <%= t('.allow_list_body') %> - <% end %> -<% end %> - - +<%= ccs_dashboard_section( + [ + { + title: t('.new_user_invite_title'), + href: add_user_crown_marketplace_manage_users_path(section: 'select-role'), + description: t('.new_user_body') + }, + { + title: t('.manage_users_title'), + href: crown_marketplace_manage_users_path, + description: t('.manage_users_body') + } + ], + t('.user_support_heading') +) %> + +<%= ccs_dashboard_section( + [ + { + title: t('.allow_list_heading'), + href: crown_marketplace_allow_list_index_path, + description: t('.allow_list_body') + } + ], + t('.allow_list_heading') +) %> diff --git a/app/views/crown_marketplace/manage_users/_user_details_summary.html.erb b/app/views/crown_marketplace/manage_users/_user_details_summary.html.erb index f497f626c4..de8c58dc59 100644 --- a/app/views/crown_marketplace/manage_users/_user_details_summary.html.erb +++ b/app/views/crown_marketplace/manage_users/_user_details_summary.html.erb @@ -1,73 +1,93 @@

<%= t('.user_details_summary') %>

-
- <% if allowed_attributes.include?(:roles) %> -
-
- <%= t('.role') %> -
-
- <%= t("crown_marketplace.role_map.#{@user.roles.first}.text") %> -
-
- <% if @current_user_access != :user_support %> - <%= link_to add_users_back_link(@user, 'select-role'), class: 'govuk-link govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.role') %> - <% end %> - <% end %> -
-
- <% end %> - <% if allowed_attributes.include?(:service_access) && role_requires_service_access?(@user.roles) %> -
-
- <%= t('.service_access') %> -
-
-
    - <% @user.service_access.each do |service_access| %> -
  • - <%= t("crown_marketplace.service_access_map.#{service_access}.text") %> -
  • - <% end %> -
-
-
- <%= link_to add_users_back_link(@user, 'select-service-access'), class: 'govuk-link govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.service_access') %> - <% end %> -
-
- <% end %> - <% if allowed_attributes.include?(:user_details) %> -
-
- <%= t('.email_address') %> -
-
- <%= @user.email %> -
-
- <%= link_to add_users_back_link(@user, 'enter-user-details'), class: 'govuk-link govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.email_address') %> - <% end %> -
-
- <% end %> - <% if allowed_attributes.include?(:user_details) && @user.roles != ['buyer'] %> -
-
- <%= t('.telephone_number') %> -
-
- <%= @user.telephone_number %> -
-
- <%= link_to add_users_back_link(@user, 'enter-user-details'), class: 'govuk-link govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.telephone_number') %> - <% end %> -
-
- <% end %> -
+ +<%= govuk_summary_list( + [ + if allowed_attributes.include?(:roles) + { + key: { + text: t('.role') + }, + value: { + text: t("crown_marketplace.role_map.#{@user.roles.first}.text") + }, + actions: if @current_user_access != :user_support + { + items: [ + { + text: t('.change'), + href: add_users_back_link(@user, 'select-role'), + visually_hidden_text: t('.role') + } + ] + } + end + } + end, + if allowed_attributes.include?(:service_access) && role_requires_service_access?(@user.roles) + { + key: { + text: t('.service_access') + }, + value: { + text: tag.ul(class: 'govuk-list') do + @user.service_access.each do |service_access| + concat(tag.li(t("crown_marketplace.service_access_map.#{service_access}.text"))) + end + end + }, + actions: { + items: [ + { + text: t('.change'), + href: add_users_back_link(@user, 'select-service-access'), + visually_hidden_text: t('.service_access') + } + ] + } + } + end, + if allowed_attributes.include?(:user_details) + { + key: { + text: t('.email_address') + }, + value: { + text: @user.email + }, + actions: { + items: [ + { + text: t('.change'), + href: add_users_back_link(@user, 'enter-user-details'), + visually_hidden_text: t('.email_address') + } + ] + } + } + end, + if allowed_attributes.include?(:user_details) && @user.roles != ['buyer'] + { + key: { + text: t('.telephone_number') + }, + value: { + text: @user.telephone_number + }, + actions: { + items: [ + { + text: t('.change'), + href: add_users_back_link(@user, 'enter-user-details'), + visually_hidden_text: t('.telephone_number') + } + ] + } + } + end + ].compact, + attributes: { + id: 'add-user-details-summary' + } +) %> diff --git a/app/views/crown_marketplace/manage_users/_users_table.html.erb b/app/views/crown_marketplace/manage_users/_users_table.html.erb index e7a906a8b3..4d2746baa3 100644 --- a/app/views/crown_marketplace/manage_users/_users_table.html.erb +++ b/app/views/crown_marketplace/manage_users/_users_table.html.erb @@ -1,28 +1,56 @@ <% if !(@search[:error] || params[:email].blank?) %> - - - - - - - - - - <% if users.empty? %> - - - - <% else %> - <% users.each do |user| %> - - - - - - <% end %> - <% end %> - -
<%= t('.email') %><%= t('.status') %>
<%= t('.no_users_found') %>
<%= user[:email] %><%= govuk_tag(*enabled_disabled_status_tag(user[:account_status])) %> - <%= link_to(t('.view_user'), crown_marketplace_manage_user_path(cognito_uuid: user[:cognito_uuid]), class: 'govuk-link govuk-link--no-visited-state', aria: { label: t('.view_user_email', email: user[:email]) }) %> -
+ <%= govuk_table( + [ + { + text: t('.email'), + attributes: { + width: '60%' + } + }, + { + text: t('.status'), + attributes: { + width: '15%' + } + }, + { + text: t('.view_user'), + attributes: { + width: '15%' + } + } + ], + if users.empty? + [ + [ + { + text: t('.no_users_found'), + attributes: { + colspan: 3 + } + } + ] + ] + else + users.map do |user| + [ + { + text: user[:email], + classes: 'govuk-!-padding-right-2', + attributes: { + style: 'word-break: break-all;' + } + }, + { + text: govuk_tag(*enabled_disabled_status_tag(user[:account_status])), + classes: 'govuk-!-padding-right-2' + }, + { + text: link_to(t('.view_user'), crown_marketplace_manage_user_path(cognito_uuid: user[:cognito_uuid]), class: 'govuk-link govuk-link--no-visited-state', aria: { label: t('.view_user_email', email: user[:email]) }), + classes: 'govuk-!-padding-right-2' + } + ] + end + end + ) %> <% end %> diff --git a/app/views/crown_marketplace/manage_users/add_user.html.erb b/app/views/crown_marketplace/manage_users/add_user.html.erb index 5ff0ecf00f..7357c9dcb7 100644 --- a/app/views/crown_marketplace/manage_users/add_user.html.erb +++ b/app/views/crown_marketplace/manage_users/add_user.html.erb @@ -18,7 +18,7 @@ <%= form_with model: @user, url: create_add_user_crown_marketplace_manage_users_path(section: section), method: :post, html: { novalidate: true } do |f| %> <%= render partial: "crown_marketplace/manage_users/add_user_partials/#{section}", locals: { f: f } %> - <%= f.submit t('.submit'), class: 'govuk-button' %> + <%= govuk_button(t('.submit'), form: f) %> <% end %>
diff --git a/app/views/crown_marketplace/manage_users/add_user_partials/_enter_user_details.html.erb b/app/views/crown_marketplace/manage_users/add_user_partials/_enter_user_details.html.erb index bb653ba602..856f1e389a 100644 --- a/app/views/crown_marketplace/manage_users/add_user_partials/_enter_user_details.html.erb +++ b/app/views/crown_marketplace/manage_users/add_user_partials/_enter_user_details.html.erb @@ -1,45 +1,37 @@ <%= render partial: 'user_details_summary', locals: { allowed_attributes: %i[roles service_access] } %> <%= render partial: 'hidden_answers', locals: { f: f, allow_anyway: true } %> -<%= govuk_text_input( - f, +<%= govuk_input( :email, - { - label: { - classes: 'govuk-label--m', - text: t('.email_address') - }, - input: { - classes: 'govuk-input--width-20', - attributes: { - autocomplete: 'off', - spellcheck: false, - required: true - } - } + form: f, + label: { + text: t('.email_address'), + classes: 'govuk-label--m' + }, + classes: 'govuk-input--width-20', + attributes: { + autocomplete: 'off', + spellcheck: false, + required: true } ) %> -<%= govuk_text_input( - f, +<%= govuk_input( :telephone_number, - { - label: { - classes: 'govuk-label--m', - text: t('.telephone_number.label') - }, - hint: { - text: t('.telephone_number.hint') - }, - input: { - classes: 'govuk-input--width-10 ccs-integer-field', - attributes: { - autocomplete: 'off', - spellcheck: false, - required: true, - type: 'number', - maxlength: 11 - } - } + form: f, + label: { + text: t('.telephone_number.label'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.telephone_number.hint') + }, + classes: 'govuk-input--width-10 ccs-integer-field', + attributes: { + autocomplete: 'off', + spellcheck: false, + required: true, + type: 'number', + maxlength: 11 } ) if @user.roles != ['buyer'] %> diff --git a/app/views/crown_marketplace/manage_users/add_user_partials/_select_role.html.erb b/app/views/crown_marketplace/manage_users/add_user_partials/_select_role.html.erb index 294006b78d..6ccbb45aea 100644 --- a/app/views/crown_marketplace/manage_users/add_user_partials/_select_role.html.erb +++ b/app/views/crown_marketplace/manage_users/add_user_partials/_select_role.html.erb @@ -1,24 +1,32 @@ <%= render partial: 'hidden_answers', locals: { f: f, allow_anyway: true } %> -<%= form_group_with_error(@user, :roles) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= t('.hint') %> -
- <%= displayed_error %> -
- <% available_roles.each do |role| %> -
- <%= f.radio_button :roles, role, multiple: true, class: 'govuk-radios__input', checked: @user.roles&.first == role %> - <%= f.label :roles, t("crown_marketplace.role_map.#{role}.text"), value: role, class: 'govuk-label govuk-radios__label' %> -
- <%= t("crown_marketplace.role_map.#{role}.hint") %> -
-
- <% end %> -
-
-<% end %> +<%= govuk_radios( + :roles, + available_roles.map do |role| + { + value: role, + label: { + text: t("crown_marketplace.role_map.#{role}.text") + }, + hint: { + text: t("crown_marketplace.role_map.#{role}.hint") + }, + attributes: { + multiple: true, + name: "#{f.object_name}[roles][]" + }, + checked: @user.roles&.first == role + } + end, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.hint') + }, + classes: 'govuk-radios--inline', + error_message: f.object.errors[:roles].first +) %> diff --git a/app/views/crown_marketplace/manage_users/add_user_partials/_select_service_access.html.erb b/app/views/crown_marketplace/manage_users/add_user_partials/_select_service_access.html.erb index 6c08b1957e..2a6a12c7df 100644 --- a/app/views/crown_marketplace/manage_users/add_user_partials/_select_service_access.html.erb +++ b/app/views/crown_marketplace/manage_users/add_user_partials/_select_service_access.html.erb @@ -1,22 +1,24 @@ <%= render partial: 'user_details_summary', locals: { allowed_attributes: %i[roles] } %> <%= render partial: 'hidden_answers', locals: { f: f, allow_anyway: true } %> -<%= form_group_with_error(@user, :service_access) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= t('.hint') %> -
- <%= displayed_error %> -
- <% Cognito::Admin::Roles::SERVICE_ROLES_ACCESS.each do |service_access| %> -
- <%= f.check_box(:service_access, { class: 'govuk-checkboxes__input', multiple: true, include_hidden: false }, service_access) %> - <%= f.label(:service_access, t("crown_marketplace.service_access_map.#{service_access}.text"), value: service_access, class: 'govuk-label govuk-checkboxes__label') %> -
- <% end %> -
-
-<% end %> +<%= govuk_checkboxes( + :service_access, + Cognito::Admin::Roles::SERVICE_ROLES_ACCESS.map do |service_access| + { + value: service_access, + label: { + text: t("crown_marketplace.service_access_map.#{service_access}.text") + } + } + end, + form: f, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.hint') + } +) %> diff --git a/app/views/crown_marketplace/manage_users/edit.html.erb b/app/views/crown_marketplace/manage_users/edit.html.erb index 2cfa2599be..09e4d5aa97 100644 --- a/app/views/crown_marketplace/manage_users/edit.html.erb +++ b/app/views/crown_marketplace/manage_users/edit.html.erb @@ -21,7 +21,7 @@ <%= form_with model: @user, url: update_crown_marketplace_manage_user_path, method: :put, html: { novalidate: true } do |f| %> <%= render partial: "crown_marketplace/manage_users/edit_partials/#{section}", locals: { f: f } %> - <%= f.submit t('.save_and_return'), class: "govuk-button", aria: { label: t('.save_and_return') } %> + <%= govuk_button(t('.save_and_return'), form: f, attributes: { aria: { label: t('.save_and_return') } }) %> <% end %> diff --git a/app/views/crown_marketplace/manage_users/edit_partials/_account_status.html.erb b/app/views/crown_marketplace/manage_users/edit_partials/_account_status.html.erb index 4c797ed1a5..0ec6658137 100644 --- a/app/views/crown_marketplace/manage_users/edit_partials/_account_status.html.erb +++ b/app/views/crown_marketplace/manage_users/edit_partials/_account_status.html.erb @@ -1,28 +1,28 @@ -<%= form_group_with_error(f.object, :account_status) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= govuk_hint( +<%= govuk_radios( + :account_status, + [ { - text: t('.hint'), - id: 'account-status-hint' + value: true, + label: { + text: govuk_tag(*enabled_disabled_status_tag(true)) + } + }, + { + value: false, + label: { + text: govuk_tag(*enabled_disabled_status_tag(false)) + } + } + ], + form: f, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' } - ) %> - <%= displayed_error %> -
-
- <%= f.radio_button :account_status, true, class: 'govuk-radios__input', required: true, aria: { describedby: 'account-status-hint' } %> - <%= f.label :account_status, value: true, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(*enabled_disabled_status_tag(true)) %> - <% end %> -
-
- <%= f.radio_button :account_status, false, class: 'govuk-radios__input', required: true, aria: { describedby: 'account-status-hint' } %> - <%= f.label :account_status, value: false, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(*enabled_disabled_status_tag(false)) %> - <% end %> -
-
-<% end %> + }, + hint: { + text: t('.hint') + }, + classes: 'govuk-radios--inline' +) %> diff --git a/app/views/crown_marketplace/manage_users/edit_partials/_email_verified.html.erb b/app/views/crown_marketplace/manage_users/edit_partials/_email_verified.html.erb index f27961bf95..9b35b997cf 100644 --- a/app/views/crown_marketplace/manage_users/edit_partials/_email_verified.html.erb +++ b/app/views/crown_marketplace/manage_users/edit_partials/_email_verified.html.erb @@ -1,28 +1,28 @@ -<%= form_group_with_error(f.object, :email_verified) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= govuk_hint( +<%= govuk_radios( + :email_verified, + [ { - text: t('.hint'), - id: 'email-verified-hint' + value: true, + label: { + text: govuk_tag(*verified_unverified_status_tag(true)) + } + }, + { + value: false, + label: { + text: govuk_tag(*verified_unverified_status_tag(false)) + } + } + ], + form: f, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' } - ) %> - <%= displayed_error %> -
-
- <%= f.radio_button :email_verified, true, class: 'govuk-radios__input', required: true, aria: { describedby: 'email-verified-hint' } %> - <%= f.label :email_verified, value: true, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(*verified_unverified_status_tag(true)) %> - <% end %> -
-
- <%= f.radio_button :email_verified, false, class: 'govuk-radios__input', required: true, aria: { describedby: 'email-verified-hint' } %> - <%= f.label :email_verified, value: false, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(*verified_unverified_status_tag(false)) %> - <% end %> -
-
-<% end %> + }, + hint: { + text: t('.hint') + }, + classes: 'govuk-radios--inline' +) %> diff --git a/app/views/crown_marketplace/manage_users/edit_partials/_mfa_enabled.html.erb b/app/views/crown_marketplace/manage_users/edit_partials/_mfa_enabled.html.erb index 67457780a5..295ff4e7ad 100644 --- a/app/views/crown_marketplace/manage_users/edit_partials/_mfa_enabled.html.erb +++ b/app/views/crown_marketplace/manage_users/edit_partials/_mfa_enabled.html.erb @@ -1,28 +1,28 @@ -<%= form_group_with_error(f.object, :mfa_enabled) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= govuk_hint( +<%= govuk_radios( + :mfa_enabled, + [ { - text: t('.hint'), - id: 'mfa-enabled-hint' + value: true, + label: { + text: govuk_tag(*enabled_disabled_status_tag(true)) + } + }, + { + value: false, + label: { + text: govuk_tag(*enabled_disabled_status_tag(false)) + } + } + ], + form: f, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' } - ) %> - <%= displayed_error %> -
-
- <%= f.radio_button :mfa_enabled, true, class: 'govuk-radios__input', required: true, aria: { describedby: 'mfa-enabled-hint' } %> - <%= f.label :mfa_enabled, value: true, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(*enabled_disabled_status_tag(true)) %> - <% end %> -
-
- <%= f.radio_button :mfa_enabled, false, class: 'govuk-radios__input', required: true, aria: { describedby: 'mfa-enabled-hint' } %> - <%= f.label :mfa_enabled, value: false, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(*enabled_disabled_status_tag(false)) %> - <% end %> -
-
-<% end %> + }, + hint: { + text: t('.hint') + }, + classes: 'govuk-radios--inline' +) %> diff --git a/app/views/crown_marketplace/manage_users/edit_partials/_roles.html.erb b/app/views/crown_marketplace/manage_users/edit_partials/_roles.html.erb index 0a184a5863..dcbf713936 100644 --- a/app/views/crown_marketplace/manage_users/edit_partials/_roles.html.erb +++ b/app/views/crown_marketplace/manage_users/edit_partials/_roles.html.erb @@ -1,25 +1,24 @@ -<%= form_group_with_error(f.object, :roles) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= govuk_hint( +<%= govuk_checkboxes( + :roles, + available_roles.map do |role| { - text: t('.hint'), - id: 'roles-hint' + value: role, + label: { + text: t("crown_marketplace.role_map.#{role}.text") + }, + hint: { + text: t("crown_marketplace.role_map.#{role}.hint") + } } - ) %> - <%= displayed_error %> -
- <% available_roles.each do |role| %> -
- <%= f.check_box(:roles, { class: 'govuk-checkboxes__input', multiple: true, include_hidden: false }, role) %> - <%= f.label(:roles, t("crown_marketplace.role_map.#{role}.text"), value: role, class: 'govuk-label govuk-checkboxes__label') %> -
- <%= t("crown_marketplace.role_map.#{role}.hint") %> -
-
- <% end %> -
-<% end %> + end, + form: f, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.hint') + } +) %> diff --git a/app/views/crown_marketplace/manage_users/edit_partials/_service_access.html.erb b/app/views/crown_marketplace/manage_users/edit_partials/_service_access.html.erb index 72b904ad06..f9db4d4c5d 100644 --- a/app/views/crown_marketplace/manage_users/edit_partials/_service_access.html.erb +++ b/app/views/crown_marketplace/manage_users/edit_partials/_service_access.html.erb @@ -1,22 +1,21 @@ -<%= form_group_with_error(f.object, :service_access) do |displayed_error| %> -
- - <%= t('.legend') %> - -
- <%= govuk_hint( +<%= govuk_checkboxes( + :service_access, + Cognito::Admin::Roles::SERVICE_ROLES_ACCESS.map do |service_access| { - text: t('.hint'), - id: 'service-access-hint' + value: service_access, + label: { + text: t("crown_marketplace.service_access_map.#{service_access}.text") + } } - ) %> - <%= displayed_error %> -
- <% Cognito::Admin::Roles::SERVICE_ROLES_ACCESS.each do |service_access| %> -
- <%= f.check_box(:service_access, { class: 'govuk-checkboxes__input', multiple: true, include_hidden: false }, service_access) %> - <%= f.label(:service_access, t("crown_marketplace.service_access_map.#{service_access}.text"), value: service_access, class: 'govuk-label govuk-checkboxes__label') %> -
- <% end %> -
-<% end %> + end, + form: f, + fieldset: { + legend: { + text: t('.legend'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.hint') + } +) %> diff --git a/app/views/crown_marketplace/manage_users/edit_partials/_telephone_number.html.erb b/app/views/crown_marketplace/manage_users/edit_partials/_telephone_number.html.erb index f73000e854..a1a498754e 100644 --- a/app/views/crown_marketplace/manage_users/edit_partials/_telephone_number.html.erb +++ b/app/views/crown_marketplace/manage_users/edit_partials/_telephone_number.html.erb @@ -1,23 +1,19 @@ -<%= govuk_text_input( - f, +<%= govuk_input( :telephone_number, - { - label: { - classes: 'govuk-label--m', - text: t('.label') - }, - hint: { - text: t('.hint') - }, - input: { - classes: 'govuk-input--width-10 ccs-integer-field', - attributes: { - autocomplete: 'off', - spellcheck: false, - required: true, - type: 'number', - maxlength: 11 - } - } + form: f, + label: { + text: t('.label'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.hint') + }, + classes: 'govuk-input--width-10 ccs-integer-field', + attributes: { + autocomplete: 'off', + spellcheck: false, + required: true, + type: 'number', + maxlength: 11 } ) %> diff --git a/app/views/crown_marketplace/manage_users/index.html.erb b/app/views/crown_marketplace/manage_users/index.html.erb index 75c4c6facb..aef02c6089 100644 --- a/app/views/crown_marketplace/manage_users/index.html.erb +++ b/app/views/crown_marketplace/manage_users/index.html.erb @@ -9,43 +9,33 @@ -
-
- <%= form_with url: crown_marketplace_manage_users_path, method: :get, html: { specialvalidation: true, remote: true } do |f| %> -
- <%= govuk_label( - f, - :email, - { - text: t('.find_a_user'), - classes: 'govuk-label--m', - id: 'email-search-label' - } - ) %> - <%= govuk_error_message_format(:email, @search[:error]) if @search[:error] %> - <%= govuk_hint( - { - text: t('.enter_an_email'), - id: 'email_hint' - } - ) %> - <%= govuk_input( - f, - :email, - false, - { - classes: 'govuk-input--width-20 govuk-!-margin-right-2', - attributes: { - type: 'search', - value: params[:email] - } - } - ) %> - <%= f.submit t('.search'), class: 'govuk-button govuk-button--secondary' %> -
- <% end %> +<%= form_with url: crown_marketplace_manage_users_path, method: :get, html: { specialvalidation: true, remote: true } do |f| %> +
+
+ <%= govuk_input( + :email, + label: { + text: t('.find_a_user'), + classes: 'govuk-label--m', + }, + hint: { + text: t('.enter_an_email') + }, + classes: 'govuk-input--width-20', + field_type: 'search', + attributes: { + value: params[:email] + }, + error_message: @search[:error] + ) %> +
-
+
+
+ <%= govuk_button(t('.search'), form: f, classes: 'govuk-button--secondary') %> +
+
+<% end %>
diff --git a/app/views/crown_marketplace/manage_users/index.js.erb b/app/views/crown_marketplace/manage_users/index.js.erb index a056e61027..4cc2b72b11 100644 --- a/app/views/crown_marketplace/manage_users/index.js.erb +++ b/app/views/crown_marketplace/manage_users/index.js.erb @@ -1,7 +1,7 @@ <% if @search[:error] %> if ($("#email-error").length === 0) { $("#email-form-group").addClass("govuk-form-group--error"); - $("#email-search-label").after("<%= escape_javascript(govuk_error_message_format(:email, @search[:error])) %>"); + $("#email-hint").after("<%= escape_javascript(govuk_error_message(@search[:error], :email)) %>"); } <% else %> if ($("#email-error").length > 0) { diff --git a/app/views/crown_marketplace/manage_users/new.html.erb b/app/views/crown_marketplace/manage_users/new.html.erb index 27bc7432d3..f80601b3ae 100644 --- a/app/views/crown_marketplace/manage_users/new.html.erb +++ b/app/views/crown_marketplace/manage_users/new.html.erb @@ -19,7 +19,7 @@ <%= render partial: 'user_details_summary', locals: { allowed_attributes: %i[roles service_access user_details] } %> <%= render partial: 'hidden_answers', locals: { f: f, allow_anyway: false } %> - <%= f.submit t('.submit'), class: 'govuk-button' %> + <%= govuk_button(t('.submit'), form: f) %> <% end %>
diff --git a/app/views/crown_marketplace/manage_users/show.html.erb b/app/views/crown_marketplace/manage_users/show.html.erb index 3e7d20a444..035c31695b 100644 --- a/app/views/crown_marketplace/manage_users/show.html.erb +++ b/app/views/crown_marketplace/manage_users/show.html.erb @@ -37,7 +37,7 @@

<%= t('.resend_temporary_password.description') %>

- <%= link_to(t('.resend_temporary_password.link'), resend_temporary_password_crown_marketplace_manage_user_path, id: 'resend-temporary-password-button', class: 'govuk-button govuk-button--secondary', data: { module: 'govuk-button' }, method: :put) %> + <%= govuk_button(t('.resend_temporary_password.link'), href: resend_temporary_password_crown_marketplace_manage_user_path, classes: 'govuk-button--secondary', attributes: { id: 'resend-temporary-password-button', method: :put }) %> <% end %> <% else %> <%= govuk_warning_text( @@ -53,141 +53,157 @@
-
-
-
- <%= t('.email') %> -
-
- <%= @user.email %> -
-
-
-
- <%= t('.email_status') %> -
-
- <%= govuk_tag(*verified_unverified_status_tag(@user.email_verified)) %> -
- <% if can_edit_user? %> -
- <%= link_to(edit_crown_marketplace_manage_user_path(section: 'email-verified'), class: 'govuk-link govuk-link--no-visited-state') do %> - <%= t('.change') %> - <%= t('.email_status') %> - <% end %> -
- <% end %> -
-
-
- <%= t('.account_status') %> -
-
- <%= govuk_tag(*enabled_disabled_status_tag(@user.account_status)) %> -
- <% if can_edit_user? %> -
- <%= link_to(edit_crown_marketplace_manage_user_path(section: 'account_status'), class: 'govuk-link govuk-link--no-visited-state') do %> - <%= t('.change') %> - <%= t('.account_status') %> - <% end %> -
- <% end %> -
-
-
- <%= t('.confirmation_status') %> -
-
- <%= govuk_tag(*user_confirmation_status_tag(@user.confirmation_status)) %> -
-
-
-
- <%= t('.telephone_number') %> -
-
- <%= @user.telephone_number.blank? ? t('.none') : @user.telephone_number %> -
- <% if can_edit_user? && permitted_sections.include?(:telephone_number) %> -
- <%= link_to(edit_crown_marketplace_manage_user_path(section: 'telephone-number'), class: 'govuk-link govuk-link--no-visited-state') do %> - <%= t('.change') %> - <%= t('.telephone_number') %> - <% end %> -
- <% end %> -
- <% unless @user.telephone_number.blank? %> -
-
- <%= t('.mfa_status') %> -
-
- <%= govuk_tag(*enabled_disabled_status_tag(@user.mfa_enabled)) %> -
- <% if can_edit_user? && permitted_sections.include?(:mfa_enabled) %> -
- <%= link_to(edit_crown_marketplace_manage_user_path(section: 'mfa-enabled'), class: 'govuk-link govuk-link--no-visited-state') do %> - <%= t('.change') %> - <%= t('.mfa_status') %> - <% end %> -
- <% end %> -
- <% end %> -
-
- <%= t('.roles') %> -
-
- <% if @user.roles.any? %> -
    - <% @user.roles.each do |role| %> -
  • - <%= t("crown_marketplace.role_map.#{role}.text") %> -
  • - <% end %> -
- <% else %> - <%= t('.none') %> - <% end %> -
- <% if can_edit_user? && permitted_sections.include?(:roles) %> -
- <%= link_to(edit_crown_marketplace_manage_user_path(section: 'roles'), class: 'govuk-link govuk-link--no-visited-state') do %> - <%= t('.change') %> - <%= t('.roles') %> - <% end %> -
- <% end %> -
-
-
- <%= t('.service_access') %> -
-
- <% if @user.service_access.any? %> -
    - <% @user.service_access.each do |service_access| %> -
  • - <%= t("crown_marketplace.service_access_map.#{service_access}.text") %> -
  • - <% end %> -
- <% else %> - <%= t('.none') %> - <% end %> -
- <% if can_edit_user? %> -
- <%= link_to(edit_crown_marketplace_manage_user_path(section: 'service-access'), class: 'govuk-link govuk-link--no-visited-state') do %> - <%= t('.change') %> - <%= t('.service_access') %> - <% end %> -
- <% end %> -
-
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.email') + }, + value: { + text: @user.email + } + }, + { + key: { + text: t('.email_status') + }, + value: { + text: govuk_tag(*verified_unverified_status_tag(@user.email_verified)) + }, + actions: if can_edit_user? + { + items: [ + { + text: t('.change'), + href: edit_crown_marketplace_manage_user_path(section: 'email-verified'), + visually_hidden_text: t('.email_status') + } + ] + } + end + }, + { + key: { + text: t('.account_status') + }, + value: { + text: govuk_tag(*enabled_disabled_status_tag(@user.account_status)) + }, + actions: if can_edit_user? + { + items: [ + { + text: t('.change'), + href: edit_crown_marketplace_manage_user_path(section: 'account_status'), + visually_hidden_text: t('.account_status') + } + ] + } + end + }, + { + key: { + text: t('.confirmation_status') + }, + value: { + text: govuk_tag(*user_confirmation_status_tag(@user.confirmation_status)) + } + }, + { + key: { + text: t('.telephone_number') + }, + value: { + text: @user.telephone_number.blank? ? t('.none') : @user.telephone_number + }, + actions: if can_edit_user? && permitted_sections.include?(:telephone_number) + { + items: [ + { + text: t('.change'), + href: edit_crown_marketplace_manage_user_path(section: 'telephone-number'), + visually_hidden_text: t('.telephone_number') + } + ] + } + end + }, + unless @user.telephone_number.blank? + { + key: { + text: t('.mfa_status') + }, + value: { + text: govuk_tag(*enabled_disabled_status_tag(@user.mfa_enabled)) + }, + actions: if can_edit_user? && permitted_sections.include?(:mfa_enabled) + { + items: [ + { + text: t('.change'), + href: edit_crown_marketplace_manage_user_path(section: 'mfa-enabled'), + visually_hidden_text: t('.mfa_status') + } + ] + } + end + } + end, + { + key: { + text: t('.roles') + }, + value: { + text: if @user.roles.any? + tag.ul(class: 'govuk-list') do + @user.roles.each do |role| + concat(tag.li(t("crown_marketplace.role_map.#{role}.text"))) + end + end + else + t('.none') + end + }, + actions: if can_edit_user? && permitted_sections.include?(:roles) + { + items: [ + { + text: t('.change'), + href: edit_crown_marketplace_manage_user_path(section: 'roles'), + visually_hidden_text: t('.roles') + } + ] + } + end + }, + { + key: { + text: t('.service_access') + }, + value: { + text: if @user.service_access.any? + tag.ul(class: 'govuk-list') do + @user.service_access.each do |service_access| + concat(tag.li(t("crown_marketplace.service_access_map.#{service_access}.text"))) + end + end + else + t('.none') + end + }, + actions: if can_edit_user? + { + items: [ + { + text: t('.change'), + href: edit_crown_marketplace_manage_user_path(section: 'service-access'), + visually_hidden_text: t('.service_access') + } + ] + } + end + }, + ].compact + ) %>
-
\ No newline at end of file +
diff --git a/app/views/facilities_management/admin/management_reports/index.html.erb b/app/views/facilities_management/admin/management_reports/index.html.erb index 04c1afb80b..3569e5b14c 100644 --- a/app/views/facilities_management/admin/management_reports/index.html.erb +++ b/app/views/facilities_management/admin/management_reports/index.html.erb @@ -13,37 +13,48 @@

<%= t('.you_can_generate_a_new_report') %>

- <%= link_to t('.generate_a_new_report'), new_path, class: 'govuk-button', aria: { label: t('.generate_a_new_report') } %> + <%= govuk_button(t('.generate_a_new_report'), href: new_path, attributes: { aria: { label: t('.generate_a_new_report') } }) %> <% if @management_reports.any? %>
- - - - - - - - - - <% @management_reports.each do |management_report| %> - - - - - - <% end %> - -
<%= t('.management_report') %><%= t('.created_at') %><%= t('.user') %>
- <%= link_to management_report.short_id, show_path(management_report.id), class: 'govuk-link govuk-link--no-visited-state' %> - - <%= format_date_time management_report.created_at %> - - <%= management_report&.user&.email || t('.user_deleted') %> -
+ <%= govuk_table( + [ + { + text: t('.management_report'), + attributes: { + width: '15%' + } + }, + { + text: t('.created_at'), + attributes: { + width: '20%' + } + }, + { + text: t('.user'), + attributes: { + width: '40%' + } + } + ], + @management_reports.map do |management_report| + [ + { + text: link_to(management_report.short_id, show_path(management_report.id), class: 'govuk-link govuk-link--no-visited-state') + }, + { + text: format_date_time(management_report.created_at) + }, + { + text: management_report&.user&.email || t('.user_deleted') + } + ] + end + ) %> <%= paginate @management_reports, views_prefix: 'shared' %>
diff --git a/app/views/facilities_management/admin/management_reports/new.html.erb b/app/views/facilities_management/admin/management_reports/new.html.erb index 6545120906..607afb1141 100644 --- a/app/views/facilities_management/admin/management_reports/new.html.erb +++ b/app/views/facilities_management/admin/management_reports/new.html.erb @@ -20,35 +20,39 @@

<%= t('.to_generate_file') %>

- <%= form_group_with_error f.object, :start_date do |displayed_error| %> -
- - <%= t('.from') %> - -
- <%= t('.from_example') %> -
- <%= displayed_error %> - <%= f.gov_uk_date_field :start_date, legend_options: { page_heading: false, visually_hidden: true } %> -
- <% end %> + <%= govuk_date_input( + :start_date, + form: f, + fieldset: { + legend: { + text: t('.from'), + classes: 'govuk-fieldset__legend--l' + } + }, + hint: { + text: t('.from_example') + }, + date_items: govuk_date_items + ) %> - <%= form_group_with_error f.object, :end_date do |displayed_error| %> -
- - <%= t('.to') %> - -
- <%= t('.to_example') %> -
+ <%= govuk_date_input( + :end_date, + form: f, + fieldset: { + legend: { + text: t('.to'), + classes: 'govuk-fieldset__legend--l' + } + }, + hint: { + text: t('.to_example') + }, + date_items: govuk_date_items + ) %> - <%= displayed_error %> - <%= f.gov_uk_date_field :end_date, legend_options: { page_heading: false, visually_hidden: true } %> -
- <% end %>
- <%= f.submit t('.generate_report'), class: 'govuk-button', data: { module: 'govuk-button' }, aria: { label: t('.generate_report') } %> + <%= govuk_button(t('.generate_report'), form: f, attributes: { aria: { label: t('.generate_report') } }) %> <% end %> diff --git a/app/views/facilities_management/admin/supplier_details/_additional_supplier_information.html.erb b/app/views/facilities_management/admin/supplier_details/_additional_supplier_information.html.erb index d8fadf4e60..54b777c817 100644 --- a/app/views/facilities_management/admin/supplier_details/_additional_supplier_information.html.erb +++ b/app/views/facilities_management/admin/supplier_details/_additional_supplier_information.html.erb @@ -1,17 +1,31 @@ -<%= form_group_with_error(f.object, :duns) do |displayed_error, any_errors| %> - <%= f.label(:duns, t('.duns_question'), class: 'govuk-label govuk-label--m') %> -
- <%= t('.duns_info') %> -
- <%= displayed_error %> - <%= f.text_field :duns, class: "govuk-input govuk-input--width-10 ccs-integer-field govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }", maxlength: 9 %> -<% end %> +<%= govuk_input( + :duns, + form: f, + label: { + text: t('.duns_question'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.duns_info') + }, + classes: 'govuk-input--width-10 ccs-integer-field', + attributes: { + maxlength: 9 + } +) %> -<%= form_group_with_error(f.object, :registration_number) do |displayed_error, any_errors| %> - <%= f.label(:registration_number, t('.registration_number_question'), class: 'govuk-label govuk-label--m') %> -
- <%= t('.registration_number_info') %> -
- <%= displayed_error %> - <%= f.text_field :registration_number, class: "govuk-input govuk-input--width-10 govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }", maxlength: 8 %> -<% end %> \ No newline at end of file +<%= govuk_input( + :registration_number, + form: f, + label: { + text: t('.registration_number_question'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.registration_number_info') + }, + classes: 'govuk-input--width-10 ccs-integer-field', + attributes: { + maxlength: 8 + } +) %> diff --git a/app/views/facilities_management/admin/supplier_details/_supplier_address.html.erb b/app/views/facilities_management/admin/supplier_details/_supplier_address.html.erb index 3ec7274af8..1d43789b60 100644 --- a/app/views/facilities_management/admin/supplier_details/_supplier_address.html.erb +++ b/app/views/facilities_management/admin/supplier_details/_supplier_address.html.erb @@ -1,25 +1,61 @@ -<%= form_group_with_error(f.object, :address_line_1) do |displayed_error, any_errors| %> - <%= f.label :address_line_1, t('.building_and_street'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :address_line_1, class: "govuk-input govuk-input--width-30 #{'govuk-input--error' if any_errors}", maxlength: 100 %> -<% end %> -<%= form_group_with_error(f.object, :address_line_2) do |displayed_error, any_errors| %> - <%= f.label :address_line_2, class: 'govuk-visually-hidden' %> - <%= displayed_error %> - <%= f.text_field :address_line_2, class: "govuk-input govuk-input--width-30 #{'govuk-input--error' if any_errors}", maxlength: 100 %> -<% end %> -<%= form_group_with_error(f.object, :address_town) do |displayed_error, any_errors| %> - <%= f.label :address_town, t('.town_or_city'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :address_town, class: "govuk-input govuk-input--width-20 #{'govuk-input--error' if any_errors}", maxlength: 50 %> -<% end %> -<%= form_group_with_error(f.object, :address_county) do |displayed_error, any_errors| %> - <%= f.label :address_county, t('.county'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :address_county, class: "govuk-input govuk-input--width-20 #{'govuk-input--error' if any_errors}", maxlength: 50 %> -<% end %> -<%= form_group_with_error(f.object, :address_postcode) do |displayed_error, any_errors| %> - <%= f.label :address_postcode, t('.postcode'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :address_postcode, class: "govuk-input govuk-input--width-10 #{'govuk-input--error' if any_errors}", maxlength: 10 %> -<% end %> +<%= govuk_input( + :address_line_1, + form: f, + label: { + text: t('.building_and_street') + }, + classes: 'govuk-input--width-30', + attributes: { + maxlength: 100 + } +) %> + +<%= govuk_input( + :address_line_2, + form: f, + label: { + text: t('.building_and_street_line_2'), + classes: 'govuk-visually-hidden' + }, + classes: 'govuk-input--width-30', + attributes: { + maxlength: 100 + } +) %> + +<%= govuk_input( + :address_town, + form: f, + label: { + text: t('.town_or_city') + }, + classes: 'govuk-input--width-20', + attributes: { + maxlength: 50 + } +) %> + +<%= govuk_input( + :address_county, + form: f, + label: { + text: t('.county') + }, + classes: 'govuk-input--width-20', + attributes: { + maxlength: 50 + } +) %> + +<%= govuk_input( + :address_postcode, + form: f, + label: { + text: t('.postcode') + }, + classes: 'govuk-input--width-10', + attributes: { + maxlength: 10 + } +) %> + diff --git a/app/views/facilities_management/admin/supplier_details/_supplier_contact_information.html.erb b/app/views/facilities_management/admin/supplier_details/_supplier_contact_information.html.erb index da48a883eb..971226b354 100644 --- a/app/views/facilities_management/admin/supplier_details/_supplier_contact_information.html.erb +++ b/app/views/facilities_management/admin/supplier_details/_supplier_contact_information.html.erb @@ -1,20 +1,35 @@ -<%= form_group_with_error(f.object, :contact_name) do |displayed_error, any_errors| %> - <%= f.label(:contact_name, t('.contact_name_question'), class: 'govuk-heading-m govuk-!-margin-bottom-0 govuk-!-padding-left-0') %> - <%= displayed_error %> - <%= f.text_field :contact_name, class: "govuk-input govuk-input--width-30 govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }", maxlength: 100 %> -<% end %> +<%= govuk_input( + :contact_name, + form: f, + label: { + text: t('.contact_name_question'), + classes: 'govuk-label--m' + }, + classes: 'govuk-input--width-30', + attributes: { + maxlength: 100 + } +) %> -<%= form_group_with_error(f.object, :contact_email) do |displayed_error, any_errors| %> - <%= f.label(:contact_email, t('.contact_email_question'), class: 'govuk-label govuk-label--m') %> -
- <%= t('.contact_email_info') %> -
- <%= displayed_error %> - <%= f.text_field :contact_email, class: "govuk-input govuk-input--width-20 govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }" %> -<% end %> +<%= govuk_input( + :contact_email, + form: f, + label: { + text: t('.contact_email_question'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.contact_email_info') + }, + classes: 'govuk-input--width-20', +) %> -<%= form_group_with_error(f.object, :contact_phone) do |displayed_error, any_errors| %> - <%= f.label(:contact_phone, t('.contact_phone_question'), class: 'govuk-heading-m govuk-!-margin-bottom-0 govuk-!-padding-left-0') %> - <%= displayed_error %> - <%= f.text_field :contact_phone, class: "govuk-input govuk-input--width-20 govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }" %> -<% end %> \ No newline at end of file +<%= govuk_input( + :contact_phone, + form: f, + label: { + text: t('.contact_phone_question'), + classes: 'govuk-label--m' + }, + classes: 'govuk-input--width-20', +) %> diff --git a/app/views/facilities_management/admin/supplier_details/_supplier_name.html.erb b/app/views/facilities_management/admin/supplier_details/_supplier_name.html.erb index 4045b01ffa..2e58285949 100644 --- a/app/views/facilities_management/admin/supplier_details/_supplier_name.html.erb +++ b/app/views/facilities_management/admin/supplier_details/_supplier_name.html.erb @@ -1,5 +1,12 @@ -<%= form_group_with_error(f.object, :supplier_name) do |displayed_error, any_errors| %> - <%= f.label(:supplier_name, t('.supplier_name_question'), class: 'govuk-heading-m govuk-!-margin-bottom-0 govuk-!-padding-left-0') %> - <%= displayed_error %> - <%= f.text_field :supplier_name, class: "govuk-input govuk-input--width-30 govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }", maxlength: 100 %> -<% end %> \ No newline at end of file +<%= govuk_input( + :supplier_name, + form: f, + label: { + text: t('.supplier_name_question'), + classes: 'govuk-label--m' + }, + classes: 'govuk-input--width-30', + attributes: { + maxlength: 100 + } +) %> diff --git a/app/views/facilities_management/admin/supplier_details/_supplier_status.html.erb b/app/views/facilities_management/admin/supplier_details/_supplier_status.html.erb index dcd964a004..eff5a640ed 100644 --- a/app/views/facilities_management/admin/supplier_details/_supplier_status.html.erb +++ b/app/views/facilities_management/admin/supplier_details/_supplier_status.html.erb @@ -1,20 +1,29 @@ -<%= form_group_with_error(f.object, :active) do |displayed_error, any_errors| %> - <%= f.hidden_field :active %> - <%= f.label(:active, t('.supplier_status_question'), class: 'govuk-heading-m govuk-!-margin-bottom-0 govuk-!-padding-left-0') %> -

<%= t('.status_hint') %>

- <%= displayed_error %> -
-
- <%= f.radio_button :active, true, class: 'govuk-radios__input', required: true %> - <%= f.label :active, value: true, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(t('.active')) %> - <% end %> -
-
- <%= f.radio_button :active, false, class: 'govuk-radios__input', required: true %> - <%= f.label :active, value: false , class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(t('.inactive'), :red) %> - <% end %> -
-
-<% end %> +<%= f.hidden_field :active %> +<%= govuk_radios( + :active, + [ + { + value: true, + label: { + text: govuk_tag(t('.active')) + } + }, + { + value: false, + label: { + text: govuk_tag(t('.inactive'), :red) + } + } + ], + form: f, + fieldset: { + legend: { + text: t('.supplier_status_question'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.status_hint') + }, + classes: 'govuk-radios--inline' +) %> diff --git a/app/views/facilities_management/admin/supplier_details/_supplier_user.html.erb b/app/views/facilities_management/admin/supplier_details/_supplier_user.html.erb index f77edd0dda..368db21a92 100644 --- a/app/views/facilities_management/admin/supplier_details/_supplier_user.html.erb +++ b/app/views/facilities_management/admin/supplier_details/_supplier_user.html.erb @@ -1,11 +1,20 @@ -<%= form_group_with_error(f.object, :user_email) do |displayed_error, any_errors| %> - <%= f.label(:user_email, t('.user_email_question'), class: 'govuk-heading-m govuk-!-margin-bottom-0 govuk-!-padding-left-0') %> -

<%= t('.email_must') %>

-
    -
  • <%= t('.email_must_1') %>
  • -
  • <%= t('.email_must_2') %>
  • -
  • <%= t('.email_must_3') %>
  • -
- <%= displayed_error %> - <%= f.text_field :user_email, class: "govuk-input govuk-input--width-20 govuk-!-margin-top-2 #{'govuk-input--error' if any_errors }" %> -<% end %> \ No newline at end of file +<%= govuk_input( + :user_email, + form: f, + label: { + text: t('.user_email_question'), + classes: 'govuk-label--m' + }, + hint: { + text: capture do + concat(tag.p(t('.email_must'), class: 'govuk-body govuk-!-margin-top-4')) + concat(tag.ul(class: 'govuk-list govuk-list--bullet') do + concat(tag.li(t('.email_must_1'))) + concat(tag.li(t('.email_must_2'))) + concat(tag.li(t('.email_must_3'))) + end) + end + }, + classes: 'govuk-input--width-20', + field_type: :email +) %> diff --git a/app/views/facilities_management/admin/supplier_details/edit.html.erb b/app/views/facilities_management/admin/supplier_details/edit.html.erb index 19c3fc946c..37372807ae 100644 --- a/app/views/facilities_management/admin/supplier_details/edit.html.erb +++ b/app/views/facilities_management/admin/supplier_details/edit.html.erb @@ -22,7 +22,7 @@
- <%= f.submit t('.save_and_return'), class: 'govuk-button', 'aria-label': t('.save_and_return') %> + <%= govuk_button(t('.save_and_return'), form: f, attributes: { aria: { label: t('.save_and_return') } }) %>
<%= link_to t('.cancel_text'), facilities_management_admin_supplier_detail_path, class: 'govuk-link--no-visited-state govuk-!-font-size-19', 'aria-label': t('.cancel_text') %>
diff --git a/app/views/facilities_management/admin/supplier_details/show.html.erb b/app/views/facilities_management/admin/supplier_details/show.html.erb index 9d25475d41..3c9e1f7443 100644 --- a/app/views/facilities_management/admin/supplier_details/show.html.erb +++ b/app/views/facilities_management/admin/supplier_details/show.html.erb @@ -24,21 +24,28 @@ <%= t('.supplier_account_information')%>
-
-
-
- <%= t('.current_user') %> -
-
- <%= supplier_user_email %> -
- <% unless @framework_has_expired %> -
- <%= link_to(t('.change'), edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_user), class: 'govuk-link--no-visited-state') %> -
- <% end %> -
-
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.current_user') + }, + value: { + text: supplier_user_email + }, + actions: unless @framework_has_expired + { + items: [ + { + text: t('.change'), + href: edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_user) + } + ] + } + end + } + ] + ) %>
<% end %> @@ -50,21 +57,28 @@ <%= t('.supplier_status')%>
-
-
-
- <%= t('.current_status') %> -
-
- <%= govuk_tag(*@supplier.current_status) %> -
- <% unless @framework_has_expired %> -
- <%= link_to(t('.change'), edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_status), class: 'govuk-link--no-visited-state') %> -
- <% end %> -
-
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.current_status') + }, + value: { + text: govuk_tag(*@supplier.current_status) + }, + actions: unless @framework_has_expired + { + items: [ + { + text: t('.change'), + href: edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_status) + } + ] + } + end + } + ] + ) %> <% end %> @@ -75,38 +89,51 @@ <%= t('.supplier_contact_information')%>
-
-
-
- <%= t('.supplier_name') %> -
-
- <%= contact_detail(:supplier_name) %> -
- <% unless @framework_has_expired %> -
- <%= link_to(t('.change'), edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_name), class: 'govuk-link--no-visited-state') %> -
- <% end %> -
- <% if params[:framework] == 'RM3830' %> - <% %i[contact_name contact_email contact_phone].each do |attribute| %> -
-
- <%= t(".#{attribute}") %> -
-
- <%= contact_detail(attribute) %> -
- <% unless @framework_has_expired %> -
- <%= link_to(t('.change'), edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_contact_information), class: 'govuk-link--no-visited-state') %> -
- <% end %> -
- <% end %> - <% end %> -
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.supplier_name') + }, + value: { + text: contact_detail(:supplier_name) + }, + actions: unless @framework_has_expired + { + items: [ + { + text: t('.change'), + href: edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_name) + } + ] + } + end + } + ] + if params[:framework] == 'RM3830' + %i[contact_name contact_email contact_phone].map do |attribute| + { + key: { + text: t(".#{attribute}") + }, + value: { + text: contact_detail(attribute) + }, + actions: unless @framework_has_expired + { + items: [ + { + text: t('.change'), + href: edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_contact_information) + } + ] + } + end + } + end + else + [] + end + ) %> @@ -116,35 +143,46 @@ <%= t('.additional_supplier_information')%>
-
- <% %i[duns registration_number].each do |attribute| %> -
-
- <%= t(".#{attribute}") %> -
-
- <%= contact_detail(attribute) %> -
- <% unless @framework_has_expired %> -
- <%= link_to(t('.change'), edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :additional_supplier_information), class: 'govuk-link--no-visited-state') %> -
- <% end %> -
- <% end %> -
-
- <%= t('.full_address') %> -
-
- <%= full_address %> -
- <% unless @framework_has_expired %> -
- <%= link_to(t('.change'), edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_address), class: 'govuk-link--no-visited-state') %> -
- <% end %> -
-
+ <%= govuk_summary_list( + %i[duns registration_number].map do |attribute| + { + key: { + text: t(".#{attribute}") + }, + value: { + text: contact_detail(attribute) + }, + actions: unless @framework_has_expired + { + items: [ + { + text: t('.change'), + href: edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :additional_supplier_information) + } + ] + } + end + } + end + [ + { + key: { + text: t('.full_address') + }, + value: { + text: full_address + }, + actions: unless @framework_has_expired + { + items: [ + { + text: t('.change'), + href: edit_facilities_management_admin_supplier_detail_path(@framework, @supplier, page: :supplier_address) + } + ] + } + end + } + ] + ) %> diff --git a/app/views/facilities_management/buyer_details/edit.html.erb b/app/views/facilities_management/buyer_details/edit.html.erb index 8a1b891d8a..96297a6141 100644 --- a/app/views/facilities_management/buyer_details/edit.html.erb +++ b/app/views/facilities_management/buyer_details/edit.html.erb @@ -6,88 +6,73 @@ <%= govuk_back_link( t('.back'), facilities_management_index_path) unless (current_user.nil? || current_user.fm_buyer_details_incomplete?) %> <%= render partial: 'shared/error_summary', locals: {errors: f.object.errors } %> -
- <%= current_user.email %> -
-
-

- - <%= t('.buyer_details') %> - -

- + <%= govuk_fieldset( + legend: { + text: t('.buyer_details'), + classes: 'govuk-fieldset__legend--l', + is_page_heading: true, + caption: { + text: current_user.email, + classes: 'govuk-caption-l' + } + } + ) do %>

<%= t('.your_details') %>

- <%= govuk_text_input( - f, + <%= govuk_input( :full_name, - { - label: { - text: t('.name') - }, - input: { - attributes: { - required: true, - maxlength: 255, - autocomplete: 'off', - } - } + form: f, + label: { + text: t('.name') + }, + attributes: { + required: true, + maxlength: 255, + autocomplete: 'off', } - )%> + ) %> - <%= govuk_text_input( - f, + <%= govuk_input( :job_title, - { - label: { - text: t('.job_title') - }, - input: { - attributes: { - maxlength: 255 - } - } + form: f, + label: { + text: t('.job_title') + }, + attributes: { + maxlength: 255, } - )%> + ) %> - <%= govuk_text_input( - f, + <%= govuk_input( :telephone_number, - { - label: { - text: t('.telephone_number') - }, - input: { - classes: 'govuk-!-width-one-half', - attributes: { - required: true, - autocomplete: "off" - } - } + form: f, + label: { + text: t('.telephone_number') + }, + classes: 'govuk-!-width-one-half', + attributes: { + required: true, + autocomplete: "off" } - )%> + ) %>

<%= t('.organisation_details') %>

- <%= govuk_text_input( - f, + <%= govuk_input( :organisation_name, - { - label: { - text: t('.organisation_name') - }, - input: { - attributes: { - required: true, - maxlength: 255 - } - } + form: f, + label: { + text: t('.organisation_name') + }, + attributes: { + required: true, + maxlength: 255 } - )%> + ) %> <%= render partial: 'facilities_management/shared/find_address/find_address', locals: { f: f, @@ -99,52 +84,61 @@
- <%= form_group_with_error(f.object, :sector) do |displayed_error| %> -
- - <%= t('.sector.legend') %> - - <%= displayed_error %> -
- <% FacilitiesManagement::BuyerDetail::SECTORS.each do |sector| %> -
- <%= f.radio_button :sector, sector, class: 'govuk-radios__input' %> - <%= f.label :sector, t(".sector.options.#{sector}"), value: sector, class: 'govuk-label govuk-radios__label' %> -
- <% end %> -
-
- <% end %> + <%= govuk_radios( + :sector, + FacilitiesManagement::BuyerDetail::SECTORS.map do |sector| + { + value: sector, + label: { + text: t(".sector.options.#{sector}") + } + } + end, + form: f, + fieldset: { + legend: { + text: t('.sector.legend'), + classes: 'govuk-fieldset__legend--m' + } + }, + ) %>
- <%= form_group_with_error(f.object, :contact_opt_in) do |displayed_error| %> -
- - <%= t('.contact_opt_in.legend') %> - -
- <%= t('.contact_opt_in.hint') %> -
- <%= displayed_error %> -
-
- <%= f.radio_button :contact_opt_in, true, class: 'govuk-radios__input' %> - <%= f.label :contact_opt_in, t('.contact_opt_in.options.true'), value: true, class: 'govuk-label govuk-radios__label' %> -
-
- <%= f.radio_button :contact_opt_in, false, class: 'govuk-radios__input' %> - <%= f.label :contact_opt_in, t('.contact_opt_in.options.false'), value: false, class: 'govuk-label govuk-radios__label' %> -
-
-
- <% end %> + <%= govuk_radios( + :contact_opt_in, + [ + { + value: true, + label: { + text: t('.contact_opt_in.options.true') + } + }, + { + value: false, + label: { + text: t('.contact_opt_in.options.false') + } + } + ], + form: f, + fieldset: { + legend: { + text: t('.contact_opt_in.legend'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.contact_opt_in.hint') + }, + classes: 'govuk-radios--inline' + ) %>
- <%= f.submit t('.submit'), class: "govuk-button", 'aria-label': t('.submit') %> + <%= govuk_button(t('.submit'), form: f, attributes: { aria: { label: t('.submit') } }) %>
-
+ <% end %> <% end %> diff --git a/app/views/facilities_management/buyer_details/edit_address.html.erb b/app/views/facilities_management/buyer_details/edit_address.html.erb index c7f639b6e6..e94b2fb9e5 100644 --- a/app/views/facilities_management/buyer_details/edit_address.html.erb +++ b/app/views/facilities_management/buyer_details/edit_address.html.erb @@ -16,38 +16,75 @@

<%= t('.add_address') %>

-
-

- <%= t('.your_details') %> -

- <%= form_group_with_error(f.object, :organisation_address_line_1) do |displayed_error, any_errors| %> - <%= f.label :organisation_address_line_1, t('.building_and_street'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :organisation_address_line_1, class: "govuk-input #{'govuk-input--error' if any_errors}", maxlength: 255 %> - <% end %> - <%= form_group_with_error(f.object, :organisation_address_line_2) do |displayed_error, any_errors| %> - <%= f.label :organisation_address_line_2, class: 'govuk-visually-hidden' %> - <%= displayed_error %> - <%= f.text_field :organisation_address_line_2, class: "govuk-input #{'govuk-input--error' if any_errors}", maxlength: 255 %> - <% end %> - <%= form_group_with_error(f.object, :organisation_address_town) do |displayed_error, any_errors| %> - <%= f.label :organisation_address_town, t('.town_or_city'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :organisation_address_town, class: "govuk-input #{'govuk-input--error' if any_errors}", maxlength: 255 %> - <% end %> - <%= form_group_with_error(f.object, :organisation_address_county) do |displayed_error, any_errors| %> - <%= f.label :organisation_address_county, t('.county'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :organisation_address_county, class: "govuk-input #{'govuk-input--error' if any_errors}", maxlength: 255 %> - <% end %> - <%= form_group_with_error(f.object, :organisation_address_postcode) do |displayed_error, any_errors| %> - <%= f.label :organisation_address_postcode, t('.postcode'), class: 'govuk-label' %> - <%= displayed_error %> - <%= f.text_field :organisation_address_postcode, class: "govuk-input govuk-input--width-10 #{'govuk-input--error' if any_errors}", maxlength: 10 %> - <% end %> -
+ <%= govuk_fieldset( + legend: { + text: t('.your_details'), + classes: 'govuk-fieldset__legend--m' + } + ) do %> + <%= govuk_input( + :organisation_address_line_1, + form: f, + label: { + text: t('.building_and_street') + }, + classes: 'govuk-input--width-30', + attributes: { + maxlength: 255 + } + ) %> + + <%= govuk_input( + :organisation_address_line_2, + form: f, + label: { + text: t('.building_and_street_line_2'), + classes: 'govuk-visually-hidden' + }, + classes: 'govuk-input--width-30', + attributes: { + maxlength: 255 + } + ) %> + + <%= govuk_input( + :organisation_address_town, + form: f, + label: { + text: t('.town_or_city') + }, + classes: 'govuk-input--width-20', + attributes: { + maxlength: 255 + } + ) %> + + <%= govuk_input( + :organisation_address_county, + form: f, + label: { + text: t('.county') + }, + classes: 'govuk-input--width-20', + attributes: { + maxlength: 255 + } + ) %> + + <%= govuk_input( + :organisation_address_postcode, + form: f, + label: { + text: t('.postcode') + }, + classes: 'govuk-input--width-10', + attributes: { + maxlength: 10 + } + ) %> + <% end %>
- <%= f.submit t('.submit'), class: "govuk-button", 'aria-label': t('.submit') %> + <%= govuk_button(t('.submit'), form: f, attributes: { aria: { label: t('.submit') } }) %>
<% end %> diff --git a/app/views/facilities_management/rm3830/admin/home/index.html.erb b/app/views/facilities_management/rm3830/admin/home/index.html.erb index 893861993d..c0ccd0b46e 100644 --- a/app/views/facilities_management/rm3830/admin/home/index.html.erb +++ b/app/views/facilities_management/rm3830/admin/home/index.html.erb @@ -5,44 +5,46 @@

<%= t('.dashboard_header') %> -
-
- <%= t('.dashboard_assessed_value') %> -
-
-
- <%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.dashboard_average_rate'), facilities_management_rm3830_admin_service_rate_path(slug: 'average-framework-rates')) do %> - <%= t('.dashboard_manage_rate') %> - <% end %> - <%= ccs_account_panel(t('.dashboard_calloff_rate'), facilities_management_rm3830_admin_service_rate_path(slug: 'call-off-benchmark-rates')) do %> - <%= t('.dashboard_manage_calloff_rate') %> - <% end %> - <% end %> + <%= ccs_dashboard_section( + [ + { + title: t('.dashboard_average_rate'), + href: facilities_management_rm3830_admin_service_rate_path(slug: 'average-framework-rates'), + description: t('.dashboard_manage_rate') + }, + { + title: t('.dashboard_calloff_rate'), + href: facilities_management_rm3830_admin_service_rate_path(slug: 'call-off-benchmark-rates'), + description: t('.dashboard_manage_calloff_rate') + } + ], + t('.dashboard_assessed_value') + ) %> -
-
- <%= t('.dashboard_supplier_data') %> -
-
-
- <%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.dashboard_supplier_framework_data'), facilities_management_rm3830_admin_supplier_framework_data_path) do %> - <%= t('.dashboard_supplier_prices') %> - <% end %> - <%= ccs_account_panel(t('.dashboard_supplier_details'), facilities_management_rm3830_admin_supplier_details_path) do %> - <%= t('.dashboard_manage_supplier_details') %> - <% end %> - <% end %> -
-
- <%= t('.dashboard_management_report_header') %> -
-
-
- <%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.dashboard_management_report_header'), facilities_management_rm3830_admin_management_reports_path) do %> - <%= t('.dashboard_management_report_detail') %> - <% end %> - <% end %> + <%= ccs_dashboard_section( + [ + { + title: t('.dashboard_supplier_framework_data'), + href: facilities_management_rm3830_admin_supplier_framework_data_path, + description: t('.dashboard_supplier_prices') + }, + { + title: t('.dashboard_supplier_details'), + href: facilities_management_rm3830_admin_supplier_details_path, + description: t('.dashboard_manage_supplier_details') + } + ], + t('.dashboard_supplier_data') + ) %> + + <%= ccs_dashboard_section( + [ + { + title: t('.dashboard_management_report_header'), + href: facilities_management_rm3830_admin_management_reports_path, + description: t('.dashboard_management_report_detail') + } + ], + t('.dashboard_management_report_header') + ) %> diff --git a/app/views/facilities_management/rm3830/admin/service_rates/_average-framework-rates.html.erb b/app/views/facilities_management/rm3830/admin/service_rates/_average-framework-rates.html.erb index 6b5959735b..b6f7c8b9c3 100644 --- a/app/views/facilities_management/rm3830/admin/service_rates/_average-framework-rates.html.erb +++ b/app/views/facilities_management/rm3830/admin/service_rates/_average-framework-rates.html.erb @@ -11,29 +11,33 @@ <% @full_services.each do |service| %> <% rate_is_money = service['value_type'] == 'money' %> + <%= govuk_table( + [ + { + text: service['name'], + classes: 'app-custom-class govuk-!-font-weight-bold govuk-!-width-two-thirds left' + }, + { + text: t('.rate'), + classes: 'app-custom-class govuk-!-font-weight-bold left' + } + ], + service['work_package'].map do |work_pckg| + rate = work_pckg['rate_standard_a_or_blank'].read_attribute_before_type_cast(:framework) - - - - - - - - - <% service['work_package'].each do |work_pckg| %> - - - - - <% end %> - -
<%= service['name'] %><%= t('.rate') %>
- <%= "#{work_pckg['code']} #{work_pckg['name']}" %> - - <% rate = work_pckg['rate_standard_a_or_blank'].read_attribute_before_type_cast(:framework) %> - - <%= "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" if rate %> -
+ [ + { + text: "#{work_pckg['code']} #{work_pckg['name']}", + classes: 'govuk-!-font-weight-regular supplier-rates-td' + }, + { + text: rate ? "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" : '', + classes: 'supplier-rates-td' + } + ] + end, + first_cell_is_header: true + ) %> <% end %>

diff --git a/app/views/facilities_management/rm3830/admin/service_rates/_call-off-benchmark-rates.html.erb b/app/views/facilities_management/rm3830/admin/service_rates/_call-off-benchmark-rates.html.erb index 3c0ffa98d3..12dbcedf55 100644 --- a/app/views/facilities_management/rm3830/admin/service_rates/_call-off-benchmark-rates.html.erb +++ b/app/views/facilities_management/rm3830/admin/service_rates/_call-off-benchmark-rates.html.erb @@ -10,52 +10,67 @@ <% @full_services.each do |service| %> <% rate_is_money = service['value_type'] == 'money' %> - - - - - <% if rate_is_money && service['standard_b'] || service['standard_c']%> - - <% else %> - - <% end %> - - <% if service['standard_b'] %> - - <% end %> - <% if service['standard_c'] %> - - <% end %> - - - - <% service['work_package'].each do |work_pckg| %> - - + <%= govuk_table( + [ + { + text: service['name'], + classes: 'app-custom-class govuk-!-font-weight-bold govuk-!-width-two-thirds left' + } + ] + if rate_is_money && service['standard_b'] || service['standard_c'] + [ + { + text: t('.rate_a'), + classes: 'app-custom-class govuk-!-font-weight-bold left' + }, + { + text: t('.rate_b'), + classes: 'app-custom-class govuk-!-font-weight-bold left' + }, + { + text: t('.rate_c'), + classes: 'app-custom-class govuk-!-font-weight-bold left' + } + ] + else + [ + { + text: t('.rate'), + classes: 'app-custom-class govuk-!-font-weight-bold left', + attributes: { + colspan: 3 + } + } + ] + end, + service['work_package'].map do |work_pckg| + [ + { + text: "#{work_pckg['code']} #{work_pckg['name']}", + classes: 'govuk-!-font-weight-regular supplier-rates-td' + } + ] + [ + Proc.new {|rate| rate.standard.blank? || rate.standard == 'A'}, + Proc.new {|rate| rate.standard == 'B'}, + Proc.new {|rate| rate.standard == 'C'} + ].map do |selector| + rate = rate = work_pckg['rates'].find(&selector) - <% [Proc.new {|rate| rate.standard.blank? || rate.standard == 'A'}, - Proc.new {|rate| rate.standard == 'B'}, - Proc.new {|rate| rate.standard == 'C'}].each do |selector| %> - - <% end %> - - <% end %> - -
<%= service['name'] %> - <%= t('.rate_a') %> - - <%= t('.rate') %> - <%= t('.rate_b') %> <%= t('.rate_c') %>
- <%= "#{work_pckg['code']} #{work_pckg['name']}" %> - - <% rate = rate = work_pckg['rates'].find(&selector) %> - - <%= "#{rate_is_money ? '£' : ''}#{rate.read_attribute_before_type_cast(:benchmark) * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" if rate && rate.read_attribute_before_type_cast(:benchmark)%> -
+ { + text: if rate && rate.read_attribute_before_type_cast(:benchmark) + "#{rate_is_money ? '£' : ''}#{rate.read_attribute_before_type_cast(:benchmark) * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" + else + '' + end, + classes: 'supplier-rates-td' + } + end + end, + first_cell_is_header: true + ) %> <% end %>

<%= t('.heading_two') %>

-

+

<%= t('.benchmark_text') %>

diff --git a/app/views/facilities_management/rm3830/admin/service_rates/_variance_table.html.erb b/app/views/facilities_management/rm3830/admin/service_rates/_variance_table.html.erb index c6ebf4a57f..9e8d87cb93 100644 --- a/app/views/facilities_management/rm3830/admin/service_rates/_variance_table.html.erb +++ b/app/views/facilities_management/rm3830/admin/service_rates/_variance_table.html.erb @@ -1,27 +1,28 @@ - - - - - - - - - <% @variances.each do |rate_label, variance_rate| %> - - - - - <% end %> - -
- <%= t('.item') %> - - <%= t('.rate') %> -
- <%= t(".#{rate_label}").html_safe %> - - <% rate = variance_rate.read_attribute_before_type_cast(attribue) %> - <% rate_is_money = rate_label == :td_cleaning %> +<%= govuk_table( + [ + { + text: t('.item'), + classes: 'app-custom-class govuk-!-font-weight-bold govuk-!-width-two-thirds left' + }, + { + text: t('.rate'), + classes: 'app-custom-class govuk-!-font-weight-bold left' + } + ], + @variances.map do |rate_label, variance_rate| + rate = variance_rate.read_attribute_before_type_cast(attribue) + rate_is_money = rate_label == :td_cleaning - <%= "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" if rate %> -
+ [ + { + text: t(".#{rate_label}").html_safe, + classes: 'govuk-!-font-weight-regular supplier-rates-td' + }, + { + text: rate ? "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" : '', + classes: 'supplier-rates-td' + } + ] + end, + first_cell_is_header: true +) %> diff --git a/app/views/facilities_management/rm3830/admin/sublot_regions/show.html.erb b/app/views/facilities_management/rm3830/admin/sublot_regions/show.html.erb index c723f05714..2d3db2d468 100644 --- a/app/views/facilities_management/rm3830/admin/sublot_regions/show.html.erb +++ b/app/views/facilities_management/rm3830/admin/sublot_regions/show.html.erb @@ -16,29 +16,34 @@
<% @regions.each do |region, region_name| %> - - - - - - - - - - <% @subregions.each do |sub_region, sub_region_name| %> - <% if sub_region.start_with?(region) %> - - - - - <% end %> - <% end %> - -
<%= region_name %>
<%= t('.region') %><%= t('.selected') %>
<%= sub_region_name %> - <% if @selected_supplier_regions[sub_region] %> - - <% end %> -
+ <%= govuk_table( + [ + { + text: t('.region'), + classes: 'govuk-!-width-three-quarters' + }, + { + text: t('.selected') + } + ], + @subregions.select { |sub_region, _sub_region_name| sub_region.start_with?(region) }.map do |sub_region, sub_region_name| + [ + { + text: sub_region_name, + classes: 'supplier-rates-td' + }, + { + text: @selected_supplier_regions[sub_region] ? tag.span('', class: 'supplier-lot-data__true'): '', + classes: 'supplier-rates-td supplier-lot-data' + } + ] + end, + first_cell_is_header: true, + caption: { + text: region_name, + classes: 'govuk-table__caption--m' + } + ) %> <% end %>

diff --git a/app/views/facilities_management/rm3830/admin/sublot_services/_services.html.erb b/app/views/facilities_management/rm3830/admin/sublot_services/_services.html.erb index 9f109f7f1b..44cca747ba 100644 --- a/app/views/facilities_management/rm3830/admin/sublot_services/_services.html.erb +++ b/app/views/facilities_management/rm3830/admin/sublot_services/_services.html.erb @@ -18,33 +18,34 @@

<% @full_services.each do |service| %> - - - - - - - - - - <% service['work_package'].each do |work_pckg| %> - - - - - <% end %> - -
<%= service['name'] %>
- <%= t('.service') %> - - <%= t('.selected') %> -
- <%= "#{work_pckg['code']} #{work_pckg['name']}" %> - - <% if @supplier_rate_data_checkboxes[work_pckg['code']] %> - - <% end %> -
+ <%= govuk_table( + [ + { + text: t('.service'), + classes: 'govuk-!-width-three-quarters' + }, + { + text: t('.selected') + } + ], + service['work_package'].map do |work_pckg| + [ + { + text: "#{work_pckg['code']} #{work_pckg['name']}", + classes: 'supplier-rates-td' + }, + { + text: @supplier_rate_data_checkboxes[work_pckg['code']] ? tag.span('', class: 'supplier-lot-data__true') : '', + classes: 'supplier-rates-td supplier-lot-data' + } + ] + end, + first_cell_is_header: true, + caption: { + text: service['name'], + classes: 'govuk-table__caption--m' + } + ) %> <% end %>

diff --git a/app/views/facilities_management/rm3830/admin/sublot_services/_services_prices_and_variances.html.erb b/app/views/facilities_management/rm3830/admin/sublot_services/_services_prices_and_variances.html.erb index e18a4fc2db..1064b20f3e 100644 --- a/app/views/facilities_management/rm3830/admin/sublot_services/_services_prices_and_variances.html.erb +++ b/app/views/facilities_management/rm3830/admin/sublot_services/_services_prices_and_variances.html.erb @@ -21,46 +21,47 @@

<% @full_services.each do |service| %> - - - - - - - <% list_service_types(service['code']).each do |service_type| %> - - <% end %> - - - - <% service['work_package'].each do |work_pckg| %> - - - - <% list_service_types_price.each do |service_type| %> - <% rate = determine_rate_card_service_price_text(service_type, work_pckg['code'], @supplier_data_ratecard_prices, @supplier_data_ratecard_discounts) %> - <% rate_is_money = service_type != 'Direct Award Discount (%)' %> - - - <% end %> - - <% end %> - -
<%= service['name'] %>
- <%= t('.service') %> - - <%= t('.selected') %> - - <%= service_type[..-4] %> -
- <%= "#{work_pckg['code']} #{work_pckg['name']}" %> - - <% if @supplier_rate_data_checkboxes[work_pckg['code']] %> - - <% end %> - - <%= "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" if rate.present? %> -
+ <%= govuk_table( + [ + { + text: t('.service'), + attributes: { + style: 'width: 500px !important;' + } + }, + { + text: t('.selected') + } + ] + list_service_types(service['code']).map do |service_type| + { + text: service_type[..-4] + } + end, + service['work_package'].map do |work_pckg| + [ + { + text: "#{work_pckg['code']} #{work_pckg['name']}", + classes: 'supplier-rates-td' + }, + { + text: @supplier_rate_data_checkboxes[work_pckg['code']] ? tag.span('', class: 'supplier-lot-data__true') : '', + classes: 'supplier-rates-td supplier-lot-data' + } + ] + list_service_types_price.map do |service_type| + rate = determine_rate_card_service_price_text(service_type, work_pckg['code'], @supplier_data_ratecard_prices, @supplier_data_ratecard_discounts) + rate_is_money = service_type != 'Direct Award Discount (%)' + { + text: rate.present? ? "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" : '', + classes: 'supplier-rates-td' + } + end + end, + first_cell_is_header: true, + caption: { + text: service['name'], + classes: 'govuk-table__caption--m' + } + ) %> <% end %>
@@ -68,33 +69,37 @@

<%= t('.variances') %>

- - - - - - - - - <% variances.each.with_index do |variance, index| %> - - - - - <% end %> - -
- <%= t('.item') %> - - <%= t('.rate') %> -
- <%= t(".#{variance_names[index]}") %> - - <% rate = @variance_supplier_data[variance_values[index].to_sym] %> - <% rate_is_money = variance_names[index] == 'td_cleaning_html'%> + <%= govuk_table( + [ + { + text: t('.item'), + classes: 'app-custom-class govuk-!-font-weight-bold govuk-!-width-two-thirds left', + attributes: { + style: 'width: 500px !important;' + } + }, + { + text: t('.rate'), + classes: 'app-custom-class govuk-!-font-weight-bold left' + } + ], + variances.map.with_index do |variance, index| + rate = @variance_supplier_data[variance_values[index].to_sym] + rate_is_money = variance_names[index] == 'td_cleaning_html' - <%= "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" if rate %> -
+ [ + { + text: t(".#{variance_names[index]}"), + classes: 'govuk-!-font-weight-regular supplier-rates-td' + }, + { + text: rate ? "#{rate_is_money ? '£' : ''}#{rate * (rate_is_money ? 1.0 : 100.0)}#{rate_is_money ? '' : '%'}" : '', + classes: 'supplier-rates-td' + } + ] + end, + first_cell_is_header: true + ) %> <%= link_to t('.return_link'), facilities_management_rm3830_admin_supplier_framework_data_path, class: 'govuk-link govuk-!-font-size-19' %>
diff --git a/app/views/facilities_management/rm3830/admin/supplier_details/index.html.erb b/app/views/facilities_management/rm3830/admin/supplier_details/index.html.erb index 8a5b0fc46c..427573bc22 100644 --- a/app/views/facilities_management/rm3830/admin/supplier_details/index.html.erb +++ b/app/views/facilities_management/rm3830/admin/supplier_details/index.html.erb @@ -14,23 +14,29 @@
- - - - - - - - - <% @suppliers.each do |supplier| %> - - - - - <% end %> - -
<%= t('.supplier_name') %><%= t('.supplier_contact_email') %>
- <%= link_to supplier.supplier_name, facilities_management_admin_supplier_detail_path(id: supplier.supplier_id), class: 'govuk-link--no-visited-state' %> - <%= contact_detail(:contact_email, supplier) %>
+ <%= govuk_table( + [ + { + text: t('.supplier_name') + }, + { + text: t('.supplier_contact_email') + } + ], + @suppliers.map do |supplier| + [ + { + text: link_to(supplier.supplier_name, facilities_management_admin_supplier_detail_path(id: supplier.supplier_id), class: 'govuk-link govuk-link--no-visited-state') + }, + { + text: contact_detail(:contact_email, supplier) + } + ] + end, + first_cell_is_header: true, + attributes: { + id: 'fm-table-filter' + } + ) %>
diff --git a/app/views/facilities_management/rm3830/admin/supplier_framework_data/index.html.erb b/app/views/facilities_management/rm3830/admin/supplier_framework_data/index.html.erb index 4e04447818..b91a91bc16 100644 --- a/app/views/facilities_management/rm3830/admin/supplier_framework_data/index.html.erb +++ b/app/views/facilities_management/rm3830/admin/supplier_framework_data/index.html.erb @@ -10,22 +10,28 @@

- <%= govuk_accordion('supplier-framework-data', @fm_suppliers) do |data| %> - <% supplier_id = data[:supplier_id] %> + <%= govuk_accordion( + 'supplier-framework-data', + @fm_suppliers.map do |fm_supplier| + supplier_id = fm_supplier[:supplier_id] - <% %w[1a 1b 1c].each do |lot_number| %> - <% if (@supplier_present[lot_number][supplier_id]) %> -
- - <%= t(".sub_lot.#{lot_number}") %> - -
- <%= link_to lot_number == '1a' ? t('.service_prices') : t('.services'), facilities_management_rm3830_admin_supplier_framework_datum_sublot_service_path(supplier_id, lot_number), class: 'govuk-link govuk-!-font-size-19 govuk-!-margin-right-3' %> - <%= link_to t('.regions'), facilities_management_rm3830_admin_supplier_framework_datum_sublot_region_path(supplier_id, lot_number), class: 'govuk-link govuk-!-font-size-19' %> -
- <% end %> - <% end %> - <% end %> + { + heading: fm_supplier[:name], + content: capture do + %w[1a 1b 1c].each do |lot_number| + if (@supplier_present[lot_number][supplier_id]) + concat( + tag.div(class: 'govuk-!-margin-bottom-5') do + concat(tag.span(t(".sub_lot.#{lot_number}"), class: 'govuk-body govuk-!-font-size-19 govuk-!-margin-bottom-5 govuk-!-font-weight-bold')) + concat(tag.br) + concat(link_to(lot_number == '1a' ? t('.service_prices') : t('.services'), facilities_management_rm3830_admin_supplier_framework_datum_sublot_service_path(supplier_id, lot_number), class: 'govuk-link govuk-!-font-size-19 govuk-!-margin-right-3')) + concat(link_to(t('.regions'), facilities_management_rm3830_admin_supplier_framework_datum_sublot_region_path(supplier_id, lot_number), class: 'govuk-link govuk-!-font-size-19')) + end + ) + end + end + end + } + end + ) %>
- -<%= link_to t('.return_link'), facilities_management_rm3830_admin_path, class: 'govuk-button govuk-button--secondary govuk-!-margin-top-5' %> diff --git a/app/views/facilities_management/rm3830/admin/uploads/_failed.html.erb b/app/views/facilities_management/rm3830/admin/uploads/_failed.html.erb index 3735d087b4..41c880f469 100644 --- a/app/views/facilities_management/rm3830/admin/uploads/_failed.html.erb +++ b/app/views/facilities_management/rm3830/admin/uploads/_failed.html.erb @@ -9,27 +9,26 @@
- - - - - - - - - <% @upload.import_errors.each do |error| %> - - - - - <% end %> - -
<%= t('.issue') %><%= t('.details') %>
<%= t(".error_name.#{error[:error]}") %> - <% if error[:details] %> - <%= get_admin_upload_error_details(error[:error], error[:details]) %> - <% else %> - <%= t(".error_details.#{error[:error]}") %> - <% end %> -
+ <%= govuk_table( + [ + { + text: t('.issue'), + classes: 'govuk-!-width-one-quarter' + }, + { + text: t('.details') + } + ], + @upload.import_errors.map do |error| + [ + { + text: t(".error_name.#{error[:error]}") + }, + { + text: error[:details] ? get_admin_upload_error_details(error[:error], error[:details]) : t(".error_details.#{error[:error]}") + } + ] + end + ) %>
\ No newline at end of file diff --git a/app/views/facilities_management/rm3830/admin/uploads/_upload.html.erb b/app/views/facilities_management/rm3830/admin/uploads/_upload.html.erb deleted file mode 100644 index 9f207d9838..0000000000 --- a/app/views/facilities_management/rm3830/admin/uploads/_upload.html.erb +++ /dev/null @@ -1,5 +0,0 @@ - - <%= link_to t('.upload_name', number: upload.short_uuid), facilities_management_rm3830_admin_upload_path(upload) %> - <%= format_date_time upload.created_at %> - <%= govuk_tag(*upload_status_tag(upload.aasm_state)) %> - diff --git a/app/views/facilities_management/rm3830/admin/uploads/index.html.erb b/app/views/facilities_management/rm3830/admin/uploads/index.html.erb index 1d7c96493b..61aed23885 100644 --- a/app/views/facilities_management/rm3830/admin/uploads/index.html.erb +++ b/app/views/facilities_management/rm3830/admin/uploads/index.html.erb @@ -6,7 +6,7 @@
<%= t('.caption') %>

<%= t('.heading') %>

- <%= link_to(t('.create_new'), new_facilities_management_rm3830_admin_upload_path, class: 'govuk-button') unless @framework_has_expired %> + <%= govuk_button(t('.create_new'), href: new_facilities_management_rm3830_admin_upload_path) unless @framework_has_expired %>
@@ -14,42 +14,70 @@ <% if @latest_upload.present? %>
- - - - - - - - - - - - - - - - -
<%= t('.current_data') %>
<%= t('.name') %><%= t('.date') %>
<%= t('.file_name') %><%= format_date_time @latest_upload.created_at %><%= link_to_file_for_download("#{rails_blob_path(@latest_upload.supplier_data_file, disposition: 'attachment', key: :rm3830_admin_upload_id, value: @latest_upload.id)}&format=xlsx", :xlsx, t('.download'), false) %>
+ <%= govuk_table( + [ + { + text: t('.name') + }, + { + text: t('.date') + }, + { + text: t('.download') + } + ], + [ + [ + { + text: t('.file_name') + }, + { + text: format_date_time(@latest_upload.created_at) + }, + { + text: link_to_file_for_download("#{rails_blob_path(@latest_upload.supplier_data_file, disposition: 'attachment', key: :rm3830_admin_upload_id, value: @latest_upload.id)}&format=xlsx", :xlsx, t('.download'), false) + } + ] + ], + caption: { + text: t('.current_data') + } + ) %>
<% end %>
- - - - - - - - - - - <%= render partial: 'upload', collection: @uploads %> - -
<%= t('.table_caption') %>
<%= t('.name') %><%= t('.date') %><%= t('.status') %>
+ <%= govuk_table( + [ + { + text: t('.name') + }, + { + text: t('.date') + }, + { + text: t('.status') + } + ], + @uploads.map do |upload| + [ + { + text: link_to(t('.upload_name', number: upload.short_uuid), facilities_management_rm3830_admin_upload_path(upload)) + }, + { + text: format_date_time(upload.created_at) + }, + { + text: govuk_tag(*upload_status_tag(upload.aasm_state)) + } + ] + end, + caption: { + text: t('.table_caption') + } + ) %> <%= paginate @uploads, views_prefix: 'shared', window: 0, outer_window: 2 %>
diff --git a/app/views/facilities_management/rm3830/admin/uploads/new.html.erb b/app/views/facilities_management/rm3830/admin/uploads/new.html.erb index 3c9941a895..f780df9e14 100644 --- a/app/views/facilities_management/rm3830/admin/uploads/new.html.erb +++ b/app/views/facilities_management/rm3830/admin/uploads/new.html.erb @@ -27,17 +27,14 @@ <%= t('.upload_caption') %> <%= form_with model: @upload, url: facilities_management_rm3830_admin_uploads_path, method: :post, html: { specialvalidation: true, novalidate: true } do |f| %> - <%= govuk_form_group_with_optional_error(f.object, :supplier_data_file) do %> - <%= f.label :supplier_data_file, t('.file_label'), class: 'govuk-label' %> -
- <%= display_error f.object, :supplier_data_file %> - <%= tag(:hr, class: 'govuk-section-break govuk-!-margin-top-4') if f.object.errors[:supplier_data_file].any? %> - - <%= f.file_field :supplier_data_file, class: 'govuk-file-upload' %> - -
- <% end %> - <%= f.submit t('.upload_data'), class: 'govuk-button', name: t('.upload_data') %> + <%= govuk_file_upload( + :supplier_data_file, + form: f, + label: { + text: t('.file_label') + } + ) %> + <%= govuk_button(t('.upload_data'), form: f, attributes: { name: t('.upload_data') }) %>
<%= link_to t('.return'), facilities_management_rm3830_admin_uploads_path, class: 'govuk-link--no-visited-state govuk-!-font-size-19' %> <% end %> diff --git a/app/views/facilities_management/rm3830/admin/uploads/show.html.erb b/app/views/facilities_management/rm3830/admin/uploads/show.html.erb index d8139bd00b..185a23874d 100644 --- a/app/views/facilities_management/rm3830/admin/uploads/show.html.erb +++ b/app/views/facilities_management/rm3830/admin/uploads/show.html.erb @@ -8,24 +8,27 @@ <%= t('.caption') %>

<%= t('.heading', number: @upload.short_uuid) %>

-
-
-
- <%= t('.status') %> -
-
- <%= govuk_tag(*upload_status_tag(@upload.aasm_state)) %> -
-
-
-
- <%= t('.datetime') %> -
-
- <%= format_date_time @upload.created_at %> -
-
-
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.status') + }, + value: { + text: govuk_tag(*upload_status_tag(@upload.aasm_state)) + } + }, + { + key: { + text: t('.datetime') + }, + value: { + text: format_date_time(@upload.created_at) + } + } + ], + classes: 'govuk-summary-list--no-border' + ) %>
@@ -36,21 +39,29 @@
- - - - - - - - - - - - - - -
<%= t('.files') %>
<%= t('.name') %><%= t('.download') %>
<%= t('.file_name') %><%= link_to_file_for_download("#{rails_blob_path(@upload.supplier_data_file, disposition: 'attachment', key: :rm3830_admin_upload_id, value: @upload.id)}&format=xlsx", :xlsx, t('.download'), false) %>
+ <%= govuk_table( + [ + { + text: t('.name') + }, + { + text: t('.download') + } + ], + [ + [ + { + text: t('.file_name') + }, + { + text: link_to_file_for_download("#{rails_blob_path(@upload.supplier_data_file, disposition: 'attachment', key: :rm3830_admin_upload_id, value: @upload.id)}&format=xlsx", :xlsx, t('.download'), false) + } + ] + ], + caption: { + text: t('.files') + } + ) %> <%= link_to t('.return'), facilities_management_rm3830_admin_uploads_path, class: 'govuk-link--no-visited-state govuk-!-font-size-19' %>
diff --git a/app/views/facilities_management/rm6232/admin/change_logs/_details.html.erb b/app/views/facilities_management/rm6232/admin/change_logs/_details.html.erb index 2b9539b6e8..872b844609 100644 --- a/app/views/facilities_management/rm6232/admin/change_logs/_details.html.erb +++ b/app/views/facilities_management/rm6232/admin/change_logs/_details.html.erb @@ -3,25 +3,36 @@
- - - - - - - - - - - - <% @change_log.data.each do |item| %> - - - - - - <% end %> - -
<%= t('.below_are_the_changes') %>
<%= t('.attribute') %><%= t('.prev_value') %><%= t('.new_value') %>
<%= t(".attribute_name.#{item['attribute']}") %><%= get_attribute_value(item['attribute'], @change_log.previous_supplier_data[item['attribute']]) %><%= get_attribute_value(item['attribute'], item['value']) %>
+ <%= govuk_table( + [ + { + text: t('.attribute') + }, + { + text: t('.prev_value') + }, + { + text: t('.new_value') + } + ], + @change_log.data.map do |item| + [ + { + text: t(".attribute_name.#{item['attribute']}") + }, + { + text: get_attribute_value(item['attribute'], @change_log.previous_supplier_data[item['attribute']]) + }, + { + text: get_attribute_value(item['attribute'], item['value']) + } + ] + end, + caption: { + text: t('.below_are_the_changes'), + classes: 'govuk-table__caption--m' + }, + first_cell_is_header: true + ) %>
diff --git a/app/views/facilities_management/rm6232/admin/change_logs/_lot_data.html.erb b/app/views/facilities_management/rm6232/admin/change_logs/_lot_data.html.erb index 5381bd737f..0c5c6d3ff8 100644 --- a/app/views/facilities_management/rm6232/admin/change_logs/_lot_data.html.erb +++ b/app/views/facilities_management/rm6232/admin/change_logs/_lot_data.html.erb @@ -3,23 +3,33 @@ <% if @change_log.data['attribute'] == 'active' %>
- - - - - - - - - - - - - - - - -
<%= t('.attribute') %><%= t('.prev_value') %><%= t('.new_value') %>
<%= t('.lot_status') %><%= get_attribute_value(@change_log.data['attribute'], @change_log.data['removed']) %><%= get_attribute_value(@change_log.data['attribute'], @change_log.data['added']) %>
+ <%= govuk_table( + [ + { + text: t('.attribute') + }, + { + text: t('.prev_value') + }, + { + text: t('.new_value') + } + ], + [ + [ + { + text: t('.lot_status') + }, + { + text: get_attribute_value(@change_log.data['attribute'], @change_log.data['removed']) + }, + { + text: get_attribute_value(@change_log.data['attribute'], @change_log.data['added']) + } + ] + ], + first_cell_is_header: true + ) %>
<% else %> diff --git a/app/views/facilities_management/rm6232/admin/change_logs/index.html.erb b/app/views/facilities_management/rm6232/admin/change_logs/index.html.erb index 064bd8f300..ed0fdae3ff 100644 --- a/app/views/facilities_management/rm6232/admin/change_logs/index.html.erb +++ b/app/views/facilities_management/rm6232/admin/change_logs/index.html.erb @@ -13,7 +13,7 @@

<%= t('.you_can_download') %>

- <%= link_to t('.download_logs'), "#{facilities_management_rm6232_admin_change_logs_path}?format=csv", class: 'govuk-button govuk-button--secondary', aria: { label: t('.download_logs') }, download: '' %> + <%= govuk_button(t('.download_logs'), href: "#{facilities_management_rm6232_admin_change_logs_path}?format=csv", classes: 'govuk-button--secondary', attributes: { download: '', aria: { label: t('.download_logs') } }) %>

<%= t('.you_can_get_a_snapshot_html', snapshot_link: link_to(t('.supplier_data_snapshot'), new_facilities_management_rm6232_admin_supplier_data_snapshot_path, class: 'govuk-link govuk-link--no-visited-state')) %>

@@ -22,34 +22,50 @@
- - - - - - - - - - - <% @audit_logs.each do |audit_log| %> - - - - - - - <% end %> - -
<%= t('.change_log_item') %><%= t('.date_of_change') %><%= t('.user') %><%= t('.change') %>
- <%= link_to audit_log[:short_id], facilities_management_rm6232_admin_change_log_show_path(audit_log[:id], audit_log[:change_type]), class: 'govuk-link govuk-link--no-visited-state' %> - - <%= format_date_time audit_log[:created_at] %> - - <%= audit_log[:user_email] || t('.during_a_deployment') %> - - <%= t(".change_made.#{audit_log[:true_change_type]}") %> -
+ <%= govuk_table( + [ + { + text: t('.change_log_item'), + attributes: { + width: '15%' + } + }, + { + text: t('.date_of_change'), + attributes: { + width: '20%' + } + }, + { + text: t('.user'), + attributes: { + width: '40%' + } + }, + { + text: t('.change'), + attributes: { + width: '25%' + } + } + ], + @audit_logs.map do |audit_log| + [ + { + text: link_to(audit_log[:short_id], facilities_management_rm6232_admin_change_log_show_path(audit_log[:id], audit_log[:change_type]), class: 'govuk-link govuk-link--no-visited-state') + }, + { + text: format_date_time(audit_log[:created_at]) + }, + { + text: audit_log[:user_email] || t('.during_a_deployment') + }, + { + text: t(".change_made.#{audit_log[:true_change_type]}") + } + ] + end + ) %> <%= paginate @audit_logs, views_prefix: 'shared' %>
diff --git a/app/views/facilities_management/rm6232/admin/home/index.html.erb b/app/views/facilities_management/rm6232/admin/home/index.html.erb index 230d8674da..7c44950a7d 100644 --- a/app/views/facilities_management/rm6232/admin/home/index.html.erb +++ b/app/views/facilities_management/rm6232/admin/home/index.html.erb @@ -7,30 +7,30 @@ -
-
- <%= t('.supplier_data') %> -
-
-
- <%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.supplier_data'), facilities_management_rm6232_admin_supplier_data_path) do %> - <%= t('.manage_supplier_data') %> - <% end %> + <%= ccs_dashboard_section( + [ + { + title: t('.supplier_data'), + href: facilities_management_rm6232_admin_supplier_data_path, + description: t('.manage_supplier_data') + }, + { + title: t('.audit_logs'), + href: facilities_management_rm6232_admin_change_logs_path, + description: t('.view_logs') + } + ], + t('.supplier_data') + ) %> - <%= ccs_account_panel(t('.audit_logs'), facilities_management_rm6232_admin_change_logs_path) do %> - <%= t('.view_logs') %> - <% end %> - <% end %> -
-
- <%= t('.management_report') %> -
-
-
- <%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.management_report'), facilities_management_rm6232_admin_management_reports_path) do %> - <%= t('.management_report_detail') %> - <% end %> - <% end %> + <%= ccs_dashboard_section( + [ + { + title: t('.management_report'), + href: facilities_management_rm6232_admin_management_reports_path, + description: t('.management_report_detail') + } + ], + t('.management_report') + ) %> diff --git a/app/views/facilities_management/rm6232/admin/supplier_data/index.html.erb b/app/views/facilities_management/rm6232/admin/supplier_data/index.html.erb index 8722acc97d..c96977ebf0 100644 --- a/app/views/facilities_management/rm6232/admin/supplier_data/index.html.erb +++ b/app/views/facilities_management/rm6232/admin/supplier_data/index.html.erb @@ -21,29 +21,38 @@
- - - - - - - - - - <% @suppliers.each do |supplier| %> - - - - - - <% end %> - -
<%= t('.supplier_name') %>
- <%= supplier.supplier_name %> - - <%= link_to t('.view_details'), facilities_management_admin_supplier_detail_path(id: supplier.id), class: 'govuk-link govuk-link--no-visited-state' %> - - <%= link_to t('.view_lot_data'), facilities_management_rm6232_admin_supplier_lot_datum_path(supplier.id), class: 'govuk-link govuk-link--no-visited-state' %> -
+ <%= govuk_table( + [ + { + text: t('.supplier_name'), + classes: 'govuk-!-font-weight-bold govuk-!-width-one-half' + }, + { + text: t('.view_details'), + classes: 'govuk-!-width-one-quarter' + }, + { + text: t('.view_lot_data'), + classes: 'govuk-!-width-one-quarter' + } + ], + @suppliers.map do |supplier| + [ + { + text: supplier.supplier_name + }, + { + text: link_to(t('.view_details'), facilities_management_admin_supplier_detail_path(id: supplier.id), class: 'govuk-link govuk-link--no-visited-state') + }, + { + text: link_to(t('.view_lot_data'), facilities_management_rm6232_admin_supplier_lot_datum_path(supplier.id), class: 'govuk-link govuk-link--no-visited-state') + } + ] + end, + first_cell_is_header: true, + attributes: { + id: 'fm-table-filter' + } + ) %>
diff --git a/app/views/facilities_management/rm6232/admin/supplier_data_snapshots/new.html.erb b/app/views/facilities_management/rm6232/admin/supplier_data_snapshots/new.html.erb index 503c2bbcb2..b4d51acb48 100644 --- a/app/views/facilities_management/rm6232/admin/supplier_data_snapshots/new.html.erb +++ b/app/views/facilities_management/rm6232/admin/supplier_data_snapshots/new.html.erb @@ -26,40 +26,60 @@
<%= form_with model: @snapshot, url: facilities_management_rm6232_admin_supplier_data_snapshots_path, method: :post, id: 'generate-supplier-zip', html: { specialvalidation: true, novalidate: true } do |f| %> - <%= form_group_with_error f.object, :snapshot_date_time do |displayed_date_time_error| %> - <%= displayed_date_time_error %> + <%= govuk_form_group( + :snapshot_date_time, + model: f.object + ) do |error_message| %> + <%= error_message %> - <%= form_group_with_error f.object, :snapshot_date do |displayed_error| %> - <%= f.label :snapshot_date, t('.snapshot_date_label'), class: 'govuk-label govuk-label--m' %> - <%= displayed_error %> - <%= f.gov_uk_date_field :snapshot_date, legend_options: { page_heading: false, visually_hidden: true } %> - <% end %> + <%= govuk_date_input( + :snapshot_date, + form: f, + fieldset: { + legend: { + text: t('.snapshot_date_label'), + classes: 'govuk-fieldset__legend--m' + } + }, + date_items: govuk_date_items + ) %> - <%= form_group_with_error f.object, :snapshot_time do |displayed_error| %> - <%= f.label :snapshot_time, t('.snapshot_time_label'), class: 'govuk-label govuk-label--m' %> - <%= displayed_error %> - -
-
-
- <%= f.label :snapshot_time_hh, t('.hour'), class: 'govuk-label govuk-date-input__label' %> - <%= f.text_field :snapshot_time_hh, class: "govuk-input govuk-date-input__input govuk-input--width-2 #{ 'govuk-input--error' if f.object.errors[:snapshot_time].any? }", inputmode: :numeric %> -
-
-
- : -
-
-
- <%= f.label :snapshot_time_mm, t('.minute'), class: 'govuk-label govuk-date-input__label' %> - <%= f.text_field :snapshot_time_mm, class: "govuk-input govuk-date-input__input govuk-input--width-2 #{ 'govuk-input--error' if f.object.errors[:snapshot_time].any? }", inputmode: :numeric %> -
-
-
- <% end %> + <%= govuk_date_input( + :snapshot_time, + form: f, + fieldset: { + legend: { + text: t('.snapshot_time_label'), + classes: 'govuk-fieldset__legend--m' + } + }, + date_items: [ + { + name: 'hh', + input: { + classes: 'govuk-input--width-2' + }, + label: { + text: t('.hour') + } + }, + { + name: 'mm', + input: { + classes: 'govuk-input--width-2' + }, + label: { + text: t('.minute') + }, + attributes: { + inputmode: :numeric + } + }, + ] + ) %> <% end %> - <%= f.submit t('.generate_spreadsheets'), class: 'govuk-button', id: 'generate-supplier-zip-button', data: { module: 'govuk-button' }, aria: { label: t('.generate_spreadsheets')} %> + <%= govuk_button(t('.generate_spreadsheets'), form: f, attributes: { id: 'generate-supplier-zip-button', aria: { label: t('.generate_spreadsheets') } }) %> <% end %>
\ No newline at end of file diff --git a/app/views/facilities_management/rm6232/admin/supplier_lot_data/_lot_status.html.erb b/app/views/facilities_management/rm6232/admin/supplier_lot_data/_lot_status.html.erb index 8936b7e598..7211b691ab 100644 --- a/app/views/facilities_management/rm6232/admin/supplier_lot_data/_lot_status.html.erb +++ b/app/views/facilities_management/rm6232/admin/supplier_lot_data/_lot_status.html.erb @@ -1,24 +1,33 @@
- <%= form_group_with_error(f.object, :active) do |displayed_error, any_errors| %> - <%= f.hidden_field :active %> - <%= f.label(:active, t('.supplier_status_question'), class: 'govuk-heading-m govuk-!-margin-bottom-0 govuk-!-padding-left-0') %> -

<%= t('.status_hint') %>

- <%= displayed_error %> -
-
- <%= f.radio_button :active, true, class: 'govuk-radios__input', required: true %> - <%= f.label :active, value: true, class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(t('.active')) %> - <% end %> -
-
- <%= f.radio_button :active, false, class: 'govuk-radios__input', required: true %> - <%= f.label :active, value: false , class: 'govuk-label govuk-radios__label' do %> - <%= govuk_tag(t('.inactive'), :red) %> - <% end %> -
-
- <% end %> + <%= f.hidden_field :active %> + <%= govuk_radios( + :active, + [ + { + value: true, + label: { + text: govuk_tag(t('.active')) + } + }, + { + value: false, + label: { + text: govuk_tag(t('.inactive'), :red) + } + } + ], + form: f, + fieldset: { + legend: { + text: t('.supplier_status_question'), + classes: 'govuk-fieldset__legend--m' + } + }, + hint: { + text: t('.status_hint') + }, + classes: 'govuk-radios--inline' + ) %>
diff --git a/app/views/facilities_management/rm6232/admin/supplier_lot_data/edit.html.erb b/app/views/facilities_management/rm6232/admin/supplier_lot_data/edit.html.erb index 5ace7c1bc8..e9f06827a3 100644 --- a/app/views/facilities_management/rm6232/admin/supplier_lot_data/edit.html.erb +++ b/app/views/facilities_management/rm6232/admin/supplier_lot_data/edit.html.erb @@ -25,12 +25,15 @@
<%= form_with model: @lot_data, url: facilities_management_rm6232_admin_supplier_lot_datum_update_path, method: :put, html: { specialvalidation: true, novalidate: true } do |f| %> - <%= form_group_with_error(f.object, @lot_data_type.to_sym) do |displayed_error, any_errors| %> - <%= displayed_error %> + <%= govuk_form_group( + @lot_data_type.to_sym, + model: f.object + ) do |error_message| %> + <%= error_message %> <%= render(partial: "#{@lot_data_type}", locals: { f: f }) %> <% end %> - <%= f.submit t('.save_and_return'), class: "govuk-button", 'aria-label': t('.save_and_return') %> + <%= govuk_button(t('.save_and_return'), form: f, attributes: { aria: { label: t('.save_and_return') } }) %> <% end %>
diff --git a/app/views/facilities_management/rm6232/admin/supplier_lot_data/show.html.erb b/app/views/facilities_management/rm6232/admin/supplier_lot_data/show.html.erb index f5d6da978e..4d885c5135 100644 --- a/app/views/facilities_management/rm6232/admin/supplier_lot_data/show.html.erb +++ b/app/views/facilities_management/rm6232/admin/supplier_lot_data/show.html.erb @@ -25,63 +25,73 @@ <%= t('.lot_code', lot_code: lot_data[:lot_code]) %>
-
-
-
- <%= t('.status') %> -
-
- <%= govuk_tag(*lot_data[:current_status]) %> -
-
- <%= link_to facilities_management_rm6232_admin_supplier_lot_datum_edit_path(supplier_lot_datum_id: lot_data[:id], lot_data_type: 'lot_status'), class: 'govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.lot_status', lot_code: lot_data[:lot_code]) %> - <% end %> -
-
-
-
- <%= t('.services') %> -
-
- <%= govuk_details(t('.show_services')) do %> -
    - <% lot_data[:service_names].each do |service_name| %> -
  • - <%= service_name %> -
  • - <% end %> -
- <% end %> -
-
- <%= link_to facilities_management_rm6232_admin_supplier_lot_datum_edit_path(supplier_lot_datum_id: lot_data[:id], lot_data_type: 'service_codes'), class: 'govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.lot_services', lot_code: lot_data[:lot_code]) %> - <% end %> -
-
-
-
- <%= t('.regions') %> -
-
- <%= govuk_details(t('.show_regions')) do %> -
    - <% lot_data[:region_names].each do |region_name| %> -
  • - <%= region_name %> -
  • - <% end %> -
- <% end %> -
-
- <%= link_to facilities_management_rm6232_admin_supplier_lot_datum_edit_path(supplier_lot_datum_id: lot_data[:id], lot_data_type: 'region_codes'), class: 'govuk-link--no-visited-state' do %> - <%= t('.change') %> <%= t('.lot_regions', lot_code: lot_data[:lot_code]) %> - <% end %> -
-
-
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.status') + }, + value: { + text: govuk_tag(*lot_data[:current_status]) + }, + actions: { + items: [ + { + text: t('.change'), + href: facilities_management_rm6232_admin_supplier_lot_datum_edit_path(supplier_lot_datum_id: lot_data[:id], lot_data_type: 'lot_status'), + visually_hidden_text: t('.lot_status', lot_code: lot_data[:lot_code]) + } + ] + } + }, + { + key: { + text: t('.services') + }, + value: { + text: govuk_details(t('.show_services')) do + tag.ul(class: 'govuk-list govuk-list--bullet') do + lot_data[:service_names].each do |service_name| + concat(tag.li(service_name)) + end + end + end + }, + actions: { + items: [ + { + text: t('.change'), + href: facilities_management_rm6232_admin_supplier_lot_datum_edit_path(supplier_lot_datum_id: lot_data[:id], lot_data_type: 'service_codes'), + visually_hidden_text: t('.lot_services', lot_code: lot_data[:lot_code]) + } + ] + } + }, + { + key: { + text: t('.regions') + }, + value: { + text: govuk_details(t('.show_regions')) do + tag.ul(class: 'govuk-list govuk-list--bullet') do + lot_data[:region_names].each do |region_name| + concat(tag.li(region_name)) + end + end + end + }, + actions: { + items: [ + { + text: t('.change'), + href: facilities_management_rm6232_admin_supplier_lot_datum_edit_path(supplier_lot_datum_id: lot_data[:id], lot_data_type: 'region_codes'), + visually_hidden_text: t('.lot_regions', lot_code: lot_data[:lot_code]) + } + ] + } + }, + ], + ) %> <% end %> diff --git a/app/views/facilities_management/rm6232/admin/uploads/_failed.html.erb b/app/views/facilities_management/rm6232/admin/uploads/_failed.html.erb index d1f52eeae6..6f9c2a73eb 100644 --- a/app/views/facilities_management/rm6232/admin/uploads/_failed.html.erb +++ b/app/views/facilities_management/rm6232/admin/uploads/_failed.html.erb @@ -8,27 +8,26 @@
- - - - - - - - - <% @upload.import_errors.each do |error| %> - - - - - <% end %> - -
<%= t('.issue') %><%= t('.details') %>
<%= t(".error_name.#{error[:error]}") %> - <% if error[:details] %> - <%= get_admin_upload_error_details(error[:error], error[:details]) %> - <% else %> - <%= t(".error_details.#{error[:error]}") %> - <% end %> -
+ <%= govuk_table( + [ + { + text: t('.issue'), + classes: 'govuk-!-width-one-quarter' + }, + { + text: t('.details') + } + ], + @upload.import_errors.map do |error| + [ + { + text: t(".error_name.#{error[:error]}") + }, + { + text: error[:details] ? get_admin_upload_error_details(error[:error], error[:details]) : t(".error_details.#{error[:error]}") + } + ] + end + ) %>
diff --git a/app/views/facilities_management/rm6232/admin/uploads/_upload.html.erb b/app/views/facilities_management/rm6232/admin/uploads/_upload.html.erb deleted file mode 100644 index 3850ce5c7a..0000000000 --- a/app/views/facilities_management/rm6232/admin/uploads/_upload.html.erb +++ /dev/null @@ -1,5 +0,0 @@ - - <%= link_to t('.upload_name', number: upload.short_uuid), upload %> - <%= format_date_time upload.created_at %> - <%= govuk_tag(*upload_status_tag(upload.aasm_state)) %> - diff --git a/app/views/facilities_management/rm6232/admin/uploads/index.html.erb b/app/views/facilities_management/rm6232/admin/uploads/index.html.erb index 30a5a0051e..de10cb08f3 100644 --- a/app/views/facilities_management/rm6232/admin/uploads/index.html.erb +++ b/app/views/facilities_management/rm6232/admin/uploads/index.html.erb @@ -8,7 +8,7 @@
<%= t('.caption') %>

<%= t('.heading') %>

- <%= link_to t('.create_new'), new_facilities_management_rm6232_admin_upload_path, class: 'govuk-button' %> + <%= govuk_button(t('.create_new'), href: new_facilities_management_rm6232_admin_upload_path) %>
@@ -16,44 +16,69 @@ <% if @latest_upload.present? %>
- - - - - - - - - - - <% FacilitiesManagement::RM6232::Admin::Upload::ATTRIBUTES.each do |file| %> - <% next unless @latest_upload.send(file).attached? %> - - - - - - <% end %> - -
<%= t('.current_data') %>
<%= t('.name') %><%= t('.date') %>
<%= t(".file_name.#{file}") %><%= format_date_time @latest_upload.created_at %><%= link_to_file_for_download("#{rails_blob_path(@latest_upload.send(file), disposition: 'attachment', key: :rm6232_admin_upload_id, value: @latest_upload.id)}&format=xlsx", :xlsx, t('.download'), false) %>
+ <%= govuk_table( + [ + { + text: t('.name') + }, + { + text: t('.date') + }, + { + text: t('.download') + } + ], + FacilitiesManagement::RM6232::Admin::Upload::ATTRIBUTES.select { |file| @latest_upload.send(file).attached? }.map do |file| + [ + { + text:t(".file_name.#{file}") + }, + { + text: format_date_time(@latest_upload.created_at) + }, + { + text: link_to_file_for_download("#{rails_blob_path(@latest_upload.send(file), disposition: 'attachment', key: :rm6232_admin_upload_id, value: @latest_upload.id)}&format=xlsx", :xlsx, t('.download'), false) + } + ] + end, + caption: { + text: t('.current_data') + } + ) %>
- - - - - - - - - - - <%= render partial: 'upload', collection: @uploads %> - -
<%= t('.table_caption') %>
<%= t('.name') %><%= t('.date') %><%= t('.status') %>
+ <%= govuk_table( + [ + { + text: t('.name') + }, + { + text: t('.date') + }, + { + text: t('.status') + } + ], + @uploads.map do |upload| + [ + { + text: link_to(t('.upload_name', number: upload.short_uuid), upload) + }, + { + text: format_date_time(upload.created_at) + }, + { + text: govuk_tag(*upload_status_tag(upload.aasm_state)) + } + ] + end, + caption: { + text: t('.table_caption') + } + ) %> <%= paginate @uploads, views_prefix: 'shared', window: 0, outer_window: 2 %>
diff --git a/app/views/facilities_management/rm6232/admin/uploads/new.html.erb b/app/views/facilities_management/rm6232/admin/uploads/new.html.erb index 6304a048fc..c3430a074b 100644 --- a/app/views/facilities_management/rm6232/admin/uploads/new.html.erb +++ b/app/views/facilities_management/rm6232/admin/uploads/new.html.erb @@ -28,18 +28,15 @@ <%= form_with model: @upload, url: facilities_management_rm6232_admin_uploads_path, method: :post, html: { specialvalidation: true, novalidate: true } do |f| %> <% FacilitiesManagement::RM6232::Admin::Upload::ATTRIBUTES.each do |file| %> - <%= govuk_form_group_with_optional_error(f.object, file) do %> - <%= f.label file, t(".file_label.#{file}"), class: 'govuk-label' %> -
- <%= display_error f.object, file%> - <%= tag(:hr, class: 'govuk-section-break govuk-!-margin-top-4') if f.object.errors[file].any? %> - - <%= f.file_field file, class: 'govuk-file-upload' %> - -
- <% end %> + <%= govuk_file_upload( + file, + form: f, + label: { + text: t(".file_label.#{file}") + } + ) %> <% end %> - <%= f.submit t('.upload_data'), class: 'govuk-button', name: t('.upload_data') %> + <%= govuk_button(t('.upload_data'), form: f, attributes: { name: t('.upload_data') }) %>
<%= link_to t('.return'), facilities_management_rm6232_admin_uploads_path, class: 'govuk-link--no-visited-state govuk-!-font-size-19' %> <% end %> diff --git a/app/views/facilities_management/rm6232/admin/uploads/show.html.erb b/app/views/facilities_management/rm6232/admin/uploads/show.html.erb index ae8f5a4257..e63470c726 100644 --- a/app/views/facilities_management/rm6232/admin/uploads/show.html.erb +++ b/app/views/facilities_management/rm6232/admin/uploads/show.html.erb @@ -10,32 +10,35 @@ <%= t('.caption') %>

<%= t('.heading', number: @upload.short_uuid) %>

-
-
-
- <%= t('.status') %> -
-
- <%= govuk_tag(*upload_status_tag(@upload.aasm_state)) %> -
-
-
-
- <%= t('.datetime') %> -
-
- <%= format_date_time @upload.created_at %> -
-
-
-
- <%= t('.uploaded_by') %> -
-
- <%= @upload.user.email %> -
-
-
+ <%= govuk_summary_list( + [ + { + key: { + text: t('.status') + }, + value: { + text: govuk_tag(*upload_status_tag(@upload.aasm_state)) + } + }, + { + key: { + text: t('.datetime') + }, + value: { + text: format_date_time(@upload.created_at) + } + }, + { + key: { + text: t('.uploaded_by') + }, + value: { + text: @upload.user.email + } + } + ], + classes: 'govuk-summary-list--no-border' + ) %> @@ -46,24 +49,29 @@
- - - - - - - - - - <% FacilitiesManagement::RM6232::Admin::Upload::ATTRIBUTES.each do |file| %> - <% next unless @upload.send(file).attached? %> - - - - - <% end %> - -
<%= t('.files') %>
<%= t('.name') %><%= t('.download') %>
<%= t(".file_name.#{file}") %><%= link_to_file_for_download("#{rails_blob_path(@upload.send(file), disposition: 'attachment', key: :rm6232_admin_upload_id, value: @upload.id)}&format=xlsx", :xlsx, t('.download'), false) %>
+ <%= govuk_table( + [ + { + text: t('.name') + }, + { + text: t('.download') + } + ], + FacilitiesManagement::RM6232::Admin::Upload::ATTRIBUTES.select { |file| @upload.send(file).attached? }.map do |file| + [ + { + text: t(".file_name.#{file}") + }, + { + text: link_to_file_for_download("#{rails_blob_path(@upload.send(file), disposition: 'attachment', key: :rm6232_admin_upload_id, value: @upload.id)}&format=xlsx", :xlsx, t('.download'), false) + } + ] + end, + caption: { + text: t('.files') + } + ) %> <%= link_to t('.return'), facilities_management_rm6232_admin_uploads_path, class: 'govuk-link--no-visited-state govuk-!-font-size-19' %>
diff --git a/app/views/facilities_management/rm6232/buyer_account/index.html.erb b/app/views/facilities_management/rm6232/buyer_account/index.html.erb index fcdce5e63d..d52f08af66 100644 --- a/app/views/facilities_management/rm6232/buyer_account/index.html.erb +++ b/app/views/facilities_management/rm6232/buyer_account/index.html.erb @@ -1,37 +1,38 @@ <% content_for :page_title, t('.buyer_account_dashboard') %> -
-
-
-

- <%= @current_login_email %> - <%= t('.buyer_account_title') %> -

-
+ +
+
+

+ <%= @current_login_email %> + <%= t('.buyer_account_title') %> +

- <%= ccs_account_panel_row do %> - <%= ccs_account_panel(t('.search_for_suppliers_link'), facilities_management_journey_question_path(slug: 'choose-services')) do %> - <%= t('.search_for_suppliers_desc') %> - <% end %> - <%= ccs_account_panel(t('.view_your_searches_link'), facilities_management_rm6232_procurements_path) do %> - <%= t('.view_your_searches_desc') %> - <% end %> - <% end %> -
-
- <%= link_to t('.manage_account_link'), edit_facilities_management_buyer_detail_path(params[:framework], @buyer_detail), class: 'govuk-!-font-size-19 fm-buyer-account-panel__title govuk-link--no-visited-state' %> -

- <%= t('.manage_account_desc') %> -

-
-
-
-
-

- <%= t('.further_information_help_html', fm_link: link_to(t('.further_information_link_description'), t('.further_information_link'), class: 'govuk-!-font-size-19 fm-buyer-account-panel__title govuk-link--no-visited-state', target: '_blank')) %> -

-
-
-
+
+ +<%= ccs_dashboard_section( + [ + { + title: t('.search_for_suppliers_link'), + href: facilities_management_journey_question_path(slug: 'choose-services'), + description: t('.search_for_suppliers_desc') + }, + { + title: t('.view_your_searches_link'), + href: facilities_management_rm6232_procurements_path, + description: t('.view_your_searches_desc') + } + ] +) %> + +
+
+ <%= link_to t('.manage_account_link'), edit_facilities_management_buyer_detail_path(params[:framework], @buyer_detail), class: 'govuk-!-font-size-19 govuk-link govuk-link--no-visited-state' %> +

+ <%= t('.manage_account_desc') %> +

+

+ <%= t('.further_information_help_html', fm_link: link_to(t('.further_information_link_description'), t('.further_information_link'), class: 'govuk-!-font-size-19 govuk-link govuk-link--no-visited-state', target: '_blank')) %> +

<%= t('.return_to_page') %> diff --git a/app/views/facilities_management/rm6232/home/index.html.erb b/app/views/facilities_management/rm6232/home/index.html.erb index 0dcbcab9d8..8d20a90566 100644 --- a/app/views/facilities_management/rm6232/home/index.html.erb +++ b/app/views/facilities_management/rm6232/home/index.html.erb @@ -11,14 +11,18 @@
-

<%= t('.subheading') %>

+

+ <%= t('.subheading') %> +

  • <%= t('.usagelist.item_1') %>
  • <%= t('.usagelist.item_2') %>
  • <%= t('.usagelist.item_3') %>
-

<%= t('.beforeyoustart') %>

+

+ <%= t('.beforeyoustart') %> +

<%= t('.youneedtoknow') %>

  • <%= t('.startlist.item_1') %>
  • @@ -27,7 +31,7 @@ <%= link_to t('.further_information'), 'https://www.crowncommercial.gov.uk/agreements/rm6232', target: "_blank", class: 'govuk-link--no-visited-state' %>
    - <%= govuk_button_start(t('.startnow'), facilities_management_rm6232_new_user_session_path, class: 'govuk-!-margin-top-6 govuk-!-margin-bottom-8', aria: { label: t('.startnow') }) %> + <%= govuk_button(t('.startnow'), href: facilities_management_rm6232_new_user_session_path, is_start_button: true, classes: 'govuk-!-margin-top-6 govuk-!-margin-bottom-8', attributes: { aria: { label: t('.startnow') } }) %>
diff --git a/app/views/facilities_management/rm6232/journey/annual_contract_value.html.erb b/app/views/facilities_management/rm6232/journey/annual_contract_value.html.erb index 031c5ba069..7a6521cbf0 100644 --- a/app/views/facilities_management/rm6232/journey/annual_contract_value.html.erb +++ b/app/views/facilities_management/rm6232/journey/annual_contract_value.html.erb @@ -3,30 +3,35 @@
- <%= form_with url: @form_path, method: :get, html: { specialvalidation: true, novalidate: true } do %> -
- <%= hidden_fields_for_previous_steps_and_responses(@journey) %> - <%= govuk_form_group_with_optional_error(@journey, :annual_contract_value) do %> -

- <%= t('.heading') %> -

- <%= label_tag :annual_contract_value, t('.question'), class: 'govuk-label' %> - - <%= t('.subtitle') %> - -
- <%= display_error(@journey.steps[2], :annual_contract_value) %> -
- - <%= text_field_tag :annual_contract_value, @journey.steps[2].annual_contract_value, class: "govuk-input ccs-number-field ccs-integer-field govuk-input--width-20 #{'govuk-input--error' if @journey.steps[2].errors[:annual_contract_value].any? }", maxlength: 15 %> -
- <% end %> -
- <%= submit_tag t('common.submit'), class: "govuk-button", aria: { label: t('common.submit') } %> -

- <%= link_to t('.return_text'), facilities_management_rm6232_path, class: 'govuk-link' %> -

-
+ <%= form_with url: @form_path, method: :get, html: { specialvalidation: true, novalidate: true } do |f| %> + <%= hidden_fields_for_previous_steps_and_responses(@journey) %> +
+

+ <%= t('.heading') %> +

+ <%= govuk_input( + :annual_contract_value, + model: @journey.current_step, + label: { + text: t('.question') + }, + hint: { + text: t('.subtitle') + }, + prefix: { + text: '£' + }, + classes: 'ccs-number-field ccs-integer-field govuk-input--width-20', + attributes: { + maxlength: 15 + } + ) %> + + <%= govuk_button(t('common.submit'), form: f, attributes: { aria: { label: t('common.submit') } }) %> +

+ <%= link_to t('.return_text'), facilities_management_rm6232_path, class: 'govuk-link' %> +

+
<% end %>
diff --git a/app/views/facilities_management/rm6232/journey/choose_locations.html.erb b/app/views/facilities_management/rm6232/journey/choose_locations.html.erb index 9a37b8aa26..b0ac6f2f68 100644 --- a/app/views/facilities_management/rm6232/journey/choose_locations.html.erb +++ b/app/views/facilities_management/rm6232/journey/choose_locations.html.erb @@ -2,57 +2,89 @@ <% content_for :page_title, t('.question') %>
-
-
- <%= form_with url: @form_path, method: :get, html: { specialvalidation: true, novalidate: true } do %> -
- <%= hidden_fields_for_previous_steps_and_responses(@journey) %> - <%= govuk_form_group_with_optional_error(@journey, :region_codes) do %> - <%= govuk_fieldset_with_optional_error(@journey, :region_codes) do %> - - - -

- <%= t('.heading') %> -

-

- <%= t('.question') %> -

- - <%= t('.subtitle') %> - -

- <%= govuk_details(t('.need_help')) do %> -

- <%= t('.the_regions') %> -

-

- <%= t('.more_information.sentence_html', ons_link: link_to(t('.more_information.link_text'), t('.more_information.link_url'), class: 'govuk-link govuk-link--no-visited-state')) %> -

- <% end %> -

- <%= display_error(@journey.steps[0], :service_codes)%> -
-
- <%= govuk_accordion_with_checkboxes( - 'choose-locations', - accordion_region_items(@journey.current_step.region_codes, with_overseas: true), - 'region', - 'region_codes' - ) %> -
+
+ <%= form_with url: @form_path, method: :get, html: { specialvalidation: true, novalidate: true } do |f| %> +
+ <%= hidden_fields_for_previous_steps_and_responses(@journey) %> + <%= govuk_form_group(:region_codes, model: @journey) do |error_message|%> + <%= govuk_fieldset( + legend: { + text: t('.heading'), + is_page_heading: true, + classes: 'govuk-fieldset__legend--l' + } + ) do %> +

+ <%= t('.question') %> +

+
+ <%= t('.subtitle') %> +
+ <%= govuk_details(t('.need_help')) do %> +

+ <%= t('.the_regions') %> +

+

+ <%= t('.more_information.sentence_html', ons_link: link_to(t('.more_information.link_text'), t('.more_information.link_url'), class: 'govuk-link govuk-link--no-visited-state')) %> +

<% end %> +
+ <%= error_message %> +
+ <%= govuk_accordion( + 'choose-locations', + accordion_region_items(@journey.current_step.region_codes, with_overseas: true).map do |section_id, section| + { + heading: section[:name], + content: govuk_checkboxes( + :region_codes, + section[:items] + if section[:items].length > 1 + [ + { + divider: t('common.radio_driver') + }, + { + value: '', + label: { + text: 'Select all' + }, + classes: 'ccs-select-all', + attributes: { + id: "regions_#{section_id}_all", + name: "section-checkbox_select_all" + } + } + ] + else + [] + end, + fieldset: { + legend: { + text: t('.checkbox_legend', section: section[:name]), + classes: 'govuk-visually-hidden' + } + }, + attributes: { + 'data-section': section_id, + 'data-sectionname': section[:name] + } + ) + } + end, + classes: 'ccs-basket-accordion' + ) %> +
<% end %> - <%= hidden_field_tag :annual_contract_value, params[:annual_contract_value] if params[:annual_contract_value] %> - <%= submit_tag t('common.submit'), class: "govuk-button", aria: { label: t('common.submit') } %> -

- <%= link_to t('.return_text'), facilities_management_rm6232_path, class: 'govuk-link' %> -

-
-
- <%= render partial: 'facilities_management/shared/baskets/regions_basket' %> -
- <% end %> -
+ <% end %> + <%= hidden_field_tag :annual_contract_value, params[:annual_contract_value] if params[:annual_contract_value] %> + <%= govuk_button(t('common.submit'), form: f, attributes: { aria: { label: t('common.submit') } }) %> +

+ <%= link_to t('.return_text'), facilities_management_rm6232_path, class: 'govuk-link' %> +

+
+
+ <%= render partial: 'facilities_management/shared/baskets/regions_basket' %> +
+ <% end %>
diff --git a/app/views/facilities_management/rm6232/journey/choose_services.html.erb b/app/views/facilities_management/rm6232/journey/choose_services.html.erb index f721b41168..705fc57920 100644 --- a/app/views/facilities_management/rm6232/journey/choose_services.html.erb +++ b/app/views/facilities_management/rm6232/journey/choose_services.html.erb @@ -2,63 +2,94 @@ <%= render partial: 'shared/error_summary', locals: { errors: @journey.errors } %>
-
-
- <%= form_with url: @form_path, method: :get, html: { specialvalidation: true, novalidate: true } do %> -
- <%= hidden_fields_for_previous_steps_and_responses(@journey) %> - <%= govuk_form_group_with_optional_error(@journey, :service_codes) do %> - <%= govuk_fieldset_with_optional_error(@journey, :service_codes) do %> -
- -

- <%= t('.heading') %> -

-
-

- <%= t('.question') %> -

-

- <%= t('.caption') %> -

-

- <%= service_specification_document('rm6232') %> -

-
-
- <%= form_tag 'choose-services/answer', method: :get do %> - <%= display_error(@journey.steps[0], :service_codes)%> -
- <%= govuk_accordion_with_checkboxes( - 'choose-services', - rm6232_accordion_service_items(@journey.current_step.service_codes), - 'service', - 'service_codes' - ) do |section_id, item| %> - <%= link_to t('.learn_more'), facilities_management_rm6232_service_specification_path(item[:code]), target: '_blank' %> - <% end %> -
- <% end %> -
- <% end %> - <% end %> -
- <% params[:region_codes]&.split(" ") do |region_code| %> - <%= hidden_field_tag "region_codes[]", region_code %> - <% end %> - <%= hidden_field_tag :annual_contract_value, params[:annual_contract_value] if params[:annual_contract_value] %> -
-
- <%= submit_tag t('common.submit'), class: "govuk-button govuk-!-margin-bottom-4", aria: { label: t('common.submit') } %> +
+ <%= form_with url: @form_path, method: :get, html: { specialvalidation: true, novalidate: true } do |f| %> +
+ <%= hidden_fields_for_previous_steps_and_responses(@journey) %> + <%= govuk_form_group(:service_codes, model: @journey) do |error_message|%> + <%= govuk_fieldset( + legend: { + text: t('.heading'), + is_page_heading: true, + classes: 'govuk-fieldset__legend--l' + } + ) do %> +

+ <%= t('.question') %> +

+
+ <%= t('.caption') %> +

- <%= link_to t('.return_text'), facilities_management_rm6232_path, class: 'govuk-link' %> + <%= service_specification_document('rm6232') %>

-
+
+ <%= form_tag 'choose-services/answer', method: :get do %> + <%= error_message %> +
+ <%= govuk_accordion( + 'choose-services', + rm6232_accordion_service_items(@journey.current_step.service_codes).map do |section_id, section| + { + heading: section[:name], + content: govuk_checkboxes( + :service_codes, + section[:items] + if section[:items].length > 1 + [ + { + divider: t('common.radio_driver') + }, + { + value: '', + label: { + text: 'Select all' + }, + classes: 'ccs-select-all', + attributes: { + id: "services_#{section_id}_all", + name: "section-checkbox_select_all" + } + } + ] + else + [] + end, + fieldset: { + legend: { + text: t('.checkbox_legend', section: section[:name]), + classes: 'govuk-visually-hidden' + } + }, + attributes: { + 'data-section': section_id, + 'data-sectionname': section[:name] + } + ) + } + end, + classes: 'ccs-basket-accordion' + ) %> +
+ <% end %> +
+ <% end %> + <% end %> +
+ <% params[:region_codes]&.split(" ") do |region_code| %> + <%= hidden_field_tag "region_codes[]", region_code %> + <% end %> + <%= hidden_field_tag :annual_contract_value, params[:annual_contract_value] if params[:annual_contract_value] %>
-
- <%= render partial: 'facilities_management/shared/baskets/services_basket' %> +
+ <%= govuk_button(t('common.submit'), form: f, attributes: { aria: { label: t('common.submit') } }) %> +

+ <%= link_to t('.return_text'), facilities_management_rm6232_path, class: 'govuk-link' %> +

- <% end %> -
+
+
+ <%= render partial: 'facilities_management/shared/baskets/services_basket' %> +
+ <% end %>
diff --git a/app/views/facilities_management/rm6232/procurements/index.html.erb b/app/views/facilities_management/rm6232/procurements/index.html.erb index d52acf70a8..e6faad1dd9 100644 --- a/app/views/facilities_management/rm6232/procurements/index.html.erb +++ b/app/views/facilities_management/rm6232/procurements/index.html.erb @@ -13,30 +13,36 @@
<% if @searches.length > 0 %> - - - - - - - - - - <% @searches.each do |search| %> - - - - - <% end %> - -
<%= t('.name') %><%= t('.ref_number') %><%= t('.date_saved') %>
- <%= link_to search.contract_name, facilities_management_rm6232_procurement_path(search), class: ' govuk-link--no-visited-state' %> - - - <%= search.contract_number %> - - <%= format_date_time(search.updated_at) %> -
+ <%= govuk_table( + [ + { + text: t('.name'), + classes: 'govuk-!-width-one-quarter' + }, + { + text: t('.ref_number'), + classes: 'govuk-!-width-one-quarter' + }, + { + text: t('.date_saved'), + classes: 'govuk-!-width-two-quarters' + } + ], + @searches.map do |search| + [ + { + text: link_to(search.contract_name, facilities_management_rm6232_procurement_path(search), class: 'govuk-link govuk-link--no-visited-state') + }, + { + text: search.contract_number + }, + { + text: format_date_time(search.updated_at) + } + ] + end, + first_cell_is_header: true + ) %> <% else %>

diff --git a/app/views/facilities_management/rm6232/procurements/new.html.erb b/app/views/facilities_management/rm6232/procurements/new.html.erb index d8506ceaa0..e3d6a2df63 100644 --- a/app/views/facilities_management/rm6232/procurements/new.html.erb +++ b/app/views/facilities_management/rm6232/procurements/new.html.erb @@ -108,17 +108,20 @@ <% end %> <%= f.hidden_field :annual_contract_value %> + <%= govuk_input( + :contract_name, + form: f, + label: { + text: t('.contract_name_label'), + classes: 'govuk-label--m' + }, + hint: { + text: t('.contract_name_hint') + }, + classes: 'govuk-input--width-20', + ) %> - <%= form_group_with_error(f.object, :contract_name) do |displayed_error, any_errors| %> - <%= f.label :contract_name, t('.contract_name_label'), class: 'govuk-label govuk-label--m' %> - <%= displayed_error %> -

- <%= t('.contract_name_hint') %> -
- <%= f.text_field :contract_name, class: "govuk-input govuk-input--width-20 #{'govuk-input--error' if any_errors}" %> - <% end %> - - <%= f.submit t('.save_and_continue'), class: 'govuk-button govuk-!-margin-right-4', name: 'save_and_continue' %> + <%= govuk_button(t('.save_and_continue'), form: f, attributes: { name: 'save_and_continue' }) %>

<%= link_to t('.return_to_dashboard'), facilities_management_rm6232_path, class: 'govuk-body govuk-link--no-visited-state' %>

diff --git a/app/views/facilities_management/shared/baskets/_basket.html.erb b/app/views/facilities_management/shared/baskets/_basket.html.erb index ccf47e3339..01f40244c1 100644 --- a/app/views/facilities_management/shared/baskets/_basket.html.erb +++ b/app/views/facilities_management/shared/baskets/_basket.html.erb @@ -1,28 +1,12 @@ -
+
-

- - 0 - - - <%= number_selected_text[:many] %> - +

+ +

- + -
-
    -
+
    diff --git a/app/views/facilities_management/shared/find_address/_find_address.html.erb b/app/views/facilities_management/shared/find_address/_find_address.html.erb index a408c30409..58be521730 100644 --- a/app/views/facilities_management/shared/find_address/_find_address.html.erb +++ b/app/views/facilities_management/shared/find_address/_find_address.html.erb @@ -3,39 +3,35 @@
    @@ -58,41 +54,36 @@
    <%= govuk_select( - f, :base, - { - label: { - text: t('.select_an_address'), - class: 'govuk-heading-s govuk-!-margin-bottom-1', - for: 'address-results-container' - }, - select: { - selected: find_address_helper.address_line1, - prompt: t('.option_text', number: find_address_helper.address_count, location: 'address'.pluralize(find_address_helper.address_count)), - options: find_address_helper.valid_addresses.map do |address| - { - value: address['summary_line'], - attributes: { - data: { - address_line1: address['address_line_1'], - address_line2: address['address_line_2'], - address_town: address['address_town'], - address_postcode: address['address_postcode'] - } - } - } - end, + find_address_helper.valid_addresses.map do |address| + { + value: address['summary_line'], attributes: { - id: 'address-results-container', - tabindex: input_visible?(find_address_helper.select_an_address_visible?), data: { - text_single: t('.address_singular'), - text_plural: t('.address_plural') + address_line1: address['address_line_1'], + address_line2: address['address_line_2'], + address_town: address['address_town'], + address_postcode: address['address_postcode'] } } } - } - )%> + end, + label: { + text: t('.select_an_address'), + classes: 'govuk-heading-s govuk-!-margin-bottom-1' + }, + selected: find_address_helper.address_line1, + attributes: { + id: 'address-results-container', + tabindex: input_visible?(find_address_helper.select_an_address_visible?), + prompt: t('.option_text', number: find_address_helper.address_count, location: 'address'.pluralize(find_address_helper.address_count)), + data: { + text_single: t('.address_singular'), + text_plural: t('.address_plural') + } + }, + error_message: f.object.errors[:base].first + ) %>
    diff --git a/app/views/facilities_management/shared/find_address/_find_region.html.erb b/app/views/facilities_management/shared/find_address/_find_region.html.erb index 68bf64deeb..acff9a6ad3 100644 --- a/app/views/facilities_management/shared/find_address/_find_region.html.erb +++ b/app/views/facilities_management/shared/find_address/_find_region.html.erb @@ -4,43 +4,38 @@
    <%= govuk_select( - f, :address_region, - { - label: { - text: t('.region'), - class: 'govuk-heading-s govuk-!-margin-bottom-1', - for: 'regions-results-container' - }, - hint: { - text: t('.region_desc') - }, - select: { - selected: f.object.address_region_code, - prompt: t('.option_text', number: valid_regions.length, location: 'region'.pluralize(valid_regions.length)), - options: valid_regions.map do |region| - { - value: region[:code], - text: region[:region], - attributes: { - data: { - address_region: region[:region], - address_region_code: region[:code] - } - } - } - end, + valid_regions.map do |region| + { + value: region[:code], + text: region[:region], attributes: { - id: 'regions-results-container', - tabindex: input_visible?(select_a_region_visible?), data: { - text_single: t('.region_singular'), - text_plural: t('.region_plural') + address_region: region[:region], + address_region_code: region[:code] } } } - } - )%> + end, + label: { + text: t('.region'), + classes: 'govuk-heading-s govuk-!-margin-bottom-1' + }, + hint: { + text: t('.region_desc') + }, + selected: f.object.address_region_code, + attributes: { + id: 'regions-results-container', + tabindex: input_visible?(select_a_region_visible?), + prompt: t('.option_text', number: valid_regions.length, location: 'region'.pluralize(valid_regions.length)), + data: { + text_single: t('.region_singular'), + text_plural: t('.region_plural') + } + }, + error_message: f.object.errors[:address_region].first + ) %>
    diff --git a/app/views/home/cookie_policy.html.erb b/app/views/home/cookie_policy.html.erb index 16969f816e..2be8908b8d 100644 --- a/app/views/home/cookie_policy.html.erb +++ b/app/views/home/cookie_policy.html.erb @@ -42,24 +42,35 @@ <%= t('.ga_sets_following_cookies') %>

    - - - - - - - - - - <% (1..3).each do |i| %> - - - - - - <% end %> - -
    <%= t('home.cookies.name') %><%= t('home.cookies.purpose') %><%= t('home.cookies.expires') %>
    <%= t(".ga_cookies.row_#{i}.name") %><%= t(".ga_cookies.row_#{i}.purpose") %><%= t(".ga_cookies.row_#{i}.expires") %>
    + <%= govuk_table( + [ + { + text: t('home.cookies.name') + }, + { + text: t('home.cookies.purpose') + }, + { + text: t('home.cookies.expires') + } + ], + (1..3).map do |i| + [ + { + text: t(".ga_cookies.row_#{i}.name"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".ga_cookies.row_#{i}.purpose"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".ga_cookies.row_#{i}.expires"), + classes: 'govuk-!-padding-right-2' + } + ] + end + ) %>

    @@ -75,24 +86,35 @@ <%= t('.glassbox_sets_following_cookies') %>

    - - - - - - - - - - <% (1..2).each do |i| %> - - - - - - <% end %> - -
    <%= t('home.cookies.name') %><%= t('home.cookies.purpose') %><%= t('home.cookies.expires') %>
    <%= t(".glassbox_cookies.row_#{i}.name") %><%= t(".glassbox_cookies.row_#{i}.purpose") %><%= t(".glassbox_cookies.row_#{i}.expires") %>
    + <%= govuk_table( + [ + { + text: t('home.cookies.name') + }, + { + text: t('home.cookies.purpose') + }, + { + text: t('home.cookies.expires') + } + ], + (1..2).map do |i| + [ + { + text: t(".glassbox_cookies.row_#{i}.name"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".glassbox_cookies.row_#{i}.purpose"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".glassbox_cookies.row_#{i}.expires"), + classes: 'govuk-!-padding-right-2' + } + ] + end + ) %>
    @@ -113,27 +135,55 @@ <%= t('.you_may_see_a_banner') %>

    - - - - - - - - - - - - - - - - - - - - -
    <%= t('home.cookies.name') %><%= t('home.cookies.purpose') %><%= t('home.cookies.expires') %>
    <%= Marketplace.cookie_settings_name %><%= t(".cookie_banner_cookies.row_1.purpose") %><%= t(".cookie_banner_cookies.row_1.expires") %>
    <%= t(".cookie_banner_cookies.row_2.name") %><%= t(".cookie_banner_cookies.row_2.purpose") %><%= t(".cookie_banner_cookies.row_2.expires") %>
    + <%= govuk_table( + [ + { + text: t('home.cookies.name') + }, + { + text: t('home.cookies.purpose') + }, + { + text: t('home.cookies.expires') + } + ], + [ + [ + { + text: Marketplace.cookie_settings_name, + classes: 'govuk-!-padding-right-2', + attributes: { + style: 'word-break: break-all;' + } + }, + { + text: t(".cookie_banner_cookies.row_1.purpose"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".cookie_banner_cookies.row_1.expires"), + classes: 'govuk-!-padding-right-2' + } + ], + [ + { + text: t(".cookie_banner_cookies.row_2.name"), + classes: 'govuk-!-padding-right-2', + attributes: { + style: 'word-break: break-all;' + } + }, + { + text: t(".cookie_banner_cookies.row_2.purpose"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".cookie_banner_cookies.row_2.expires"), + classes: 'govuk-!-padding-right-2' + } + ] + ] + ) %>

    <%= t('.reg_and_sign_in') %> @@ -143,24 +193,38 @@ <%= t('.reg_and_sign_in_cookies') %>

    - - - - - - - - - - <% (1..4).each do |i| %> - - - - - - <% end %> - -
    <%= t('home.cookies.name') %><%= t('home.cookies.purpose') %><%= t('home.cookies.expires') %>
    <%= t(".reg_and_sign_in_cookie.row_#{i}.name") %><%= t(".reg_and_sign_in_cookie.row_#{i}.purpose") %><%= t(".reg_and_sign_in_cookie.row_#{i}.expires") %>
    + <%= govuk_table( + [ + { + text: t('home.cookies.name') + }, + { + text: t('home.cookies.purpose') + }, + { + text: t('home.cookies.expires') + } + ], + (1..4).map do |i| + [ + { + text: t(".reg_and_sign_in_cookie.row_#{i}.name"), + classes: 'govuk-!-padding-right-2', + attributes: { + style: 'word-break: break-all;' + } + }, + { + text: t(".reg_and_sign_in_cookie.row_#{i}.purpose"), + classes: 'govuk-!-padding-right-2' + }, + { + text: t(".reg_and_sign_in_cookie.row_#{i}.expires"), + classes: 'govuk-!-padding-right-2' + } + ] + end + ) %>

    diff --git a/app/views/home/cookie_settings.html.erb b/app/views/home/cookie_settings.html.erb index 53b5cd13ea..08ca7e6c8b 100644 --- a/app/views/home/cookie_settings.html.erb +++ b/app/views/home/cookie_settings.html.erb @@ -55,49 +55,65 @@ <%= t('home.cookies.measure_website_use.title') %> -
    - -

    - <%= t('home.cookies.measure_website_use.ga') %> -

    -
    - - <%= render partial: 'home/ga_cookies_info' %> - -
    -
    - <%= radio_button_tag :ga_cookie_usage, true, cookie_preferences_settings['usage'], class: 'govuk-radios__input' %> - <%= label_tag :ga_cookie_usage, t('.use_cookies.ga'), for: :ga_cookie_usage_true, class: 'govuk-label govuk-radios__label' %> -
    -
    - <%= radio_button_tag :ga_cookie_usage, false, !cookie_preferences_settings['usage'], class: 'govuk-radios__input' %> - <%= label_tag :ga_cookie_usage, t('.dont_use_cookies.ga'), for: :ga_cookie_usage_false, class: 'govuk-label govuk-radios__label' %> -
    -
    -
    + <%= govuk_radios( + :ga_cookie_usage, + [ + { + value: true, + checked: cookie_preferences_settings['usage'], + label: { + text: t('.use_cookies.ga') + } + }, + { + value: false, + checked: !cookie_preferences_settings['usage'], + label: { + text: t('.dont_use_cookies.ga') + } + } + ], + fieldset: { + legend: { + text: t('home.cookies.measure_website_use.ga'), + classes: 'govuk-heading-m', + } + }, + hint: { + text: render(partial: 'home/ga_cookies_info') + } + ) %>
    -
    - -

    - <%= t('home.cookies.measure_website_use.glassbox') %> -

    -
    - - <%= render partial: 'home/glassbox_cookies_info' %> - -
    -
    - <%= radio_button_tag :glassbox_cookie_usage, true, cookie_preferences_settings['glassbox'], class: 'govuk-radios__input' %> - <%= label_tag :glassbox_cookie_usage, t('.use_cookies.glassbox'), for: :glassbox_cookie_usage_true, class: 'govuk-label govuk-radios__label' %> -
    -
    - <%= radio_button_tag :glassbox_cookie_usage, false, !cookie_preferences_settings['glassbox'], class: 'govuk-radios__input' %> - <%= label_tag :glassbox_cookie_usage, t('.dont_use_cookies.glassbox'), for: :glassbox_cookie_usage_false, class: 'govuk-label govuk-radios__label' %> -
    -
    -
    + <%= govuk_radios( + :glassbox_cookie_usage, + [ + { + value: true, + checked: cookie_preferences_settings['glassbox'], + label: { + text: t('.use_cookies.glassbox') + } + }, + { + value: false, + checked: !cookie_preferences_settings['glassbox'], + label: { + text: t('.dont_use_cookies.glassbox') + } + } + ], + fieldset: { + legend: { + text: t('home.cookies.measure_website_use.glassbox'), + classes: 'govuk-heading-m', + } + }, + hint: { + text: render(partial: 'home/glassbox_cookies_info') + } + ) %>
    @@ -122,7 +138,7 @@
    - <%= button_tag t('.save_changes'), class: 'govuk-button', id: 'save-cookie-settings-button' %> + <%= govuk_button(t('.save_changes'), attributes: { id: 'save-cookie-settings-button' }) %>
    <% end %> \ No newline at end of file diff --git a/app/views/layouts/_button.html.erb b/app/views/layouts/_button.html.erb deleted file mode 100644 index ae982c8a19..0000000000 --- a/app/views/layouts/_button.html.erb +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/app/views/layouts/_password-strength.html.erb b/app/views/layouts/_password-strength.html.erb index 93e57822ad..7068bf8db7 100644 --- a/app/views/layouts/_password-strength.html.erb +++ b/app/views/layouts/_password-strength.html.erb @@ -1,4 +1,4 @@ -
      +
      •  <%= t('common.passeight') %>
      • diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 628ff57eb3..eca4ca0258 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,7 +12,7 @@ "> <% end %> - + "> <%= csrf_meta_tags %> <%= csp_meta_tag %> diff --git a/app/views/layouts/error.html.erb b/app/views/layouts/error.html.erb index a4c56b8cd4..dea690d6c9 100644 --- a/app/views/layouts/error.html.erb +++ b/app/views/layouts/error.html.erb @@ -12,7 +12,7 @@ "> <% end %> - + "> <%= csrf_meta_tags %> <%= csp_meta_tag %> diff --git a/app/views/shared/admin/frameworks/_edit.html.erb b/app/views/shared/admin/frameworks/_edit.html.erb index fd4ed79029..7d2b95763b 100644 --- a/app/views/shared/admin/frameworks/_edit.html.erb +++ b/app/views/shared/admin/frameworks/_edit.html.erb @@ -10,28 +10,38 @@
        - <%= govuk_form_group_with_optional_error(@framework, :live_at) do %> - <%= f.label :live_at, t('.live_at_date', framework: @framework.framework), class: "govuk-label"%> -
        - <%= t('.live_at_hint', current_date: Time.now.in_time_zone('London').strftime('%e/%-m/%Y'))%> -
        - <%= display_error(f.object, :live_at)%> - <%= f.gov_uk_date_field :live_at, legend_options: { page_heading: false, visually_hidden: true }, aria: { describedby: 'ive-at-hint' } %> - <% end %> + <%= govuk_date_input( + :live_at, + form: f, + fieldset: { + legend: { + text: t('.live_at_date', framework: @framework.framework) + } + }, + hint: { + text: t('.live_at_hint', current_date: Time.now.in_time_zone('London').strftime('%e/%-m/%Y')) + }, + date_items: govuk_date_items + ) %>
        - <%= govuk_form_group_with_optional_error(@framework, :expires_at) do %> - <%= f.label :expires_at, t('.expires_at_date', framework: @framework.framework), class: "govuk-label"%> -
        - <%= t('.expires_at_hint', current_date: Time.now.in_time_zone('London').strftime('%e/%-m/%Y'))%> -
        - <%= display_error(f.object, :expires_at)%> - <%= f.gov_uk_date_field :expires_at, legend_options: { page_heading: false, visually_hidden: true }, aria: { describedby: 'expires-at-hint' } %> - <% end %> + <%= govuk_date_input( + :expires_at, + form: f, + fieldset: { + legend: { + text: t('.expires_at_date', framework: @framework.framework) + } + }, + hint: { + text: t('.expires_at_hint', current_date: Time.now.in_time_zone('London').strftime('%e/%-m/%Y')) + }, + date_items: govuk_date_items + ) %>
        - <%= f.submit t('.save_and_return'), class: 'govuk-button', aria: { label: t('.save_and_return')} %> + <%= govuk_button(t('.save_and_return'), form: f, attributes: { aria: { label: t('.save_and_return') } }) %>

        <%= link_to t('.return_to_frameworks', service_name: service_name), local_index_path, class: 'govuk-link--no-visited-state' %>

        diff --git a/app/views/shared/admin/frameworks/_index.html.erb b/app/views/shared/admin/frameworks/_index.html.erb index 1f3185aea3..bb8267c83a 100644 --- a/app/views/shared/admin/frameworks/_index.html.erb +++ b/app/views/shared/admin/frameworks/_index.html.erb @@ -15,36 +15,51 @@ <%= t('.the_admin_section') %>

        - - - - - - - - - - - - <% @frameworks.each do |framework| %> - - - - - - - <% end %> - -
        <%= t('.framework') %><%= t('.live_at') %><%= t('.expires_at') %><%= t('.status') %>
        <%= framework.framework %><%= format_date(framework.live_at) %><%= format_date(framework.expires_at) %> - <% case framework.status %> - <% when :live %> - <%= govuk_tag(t('.live')) %> - <% when :coming %> - <%= govuk_tag(t('.coming'), :grey) %> - <% else %> - <%= govuk_tag(t('.expired'), :red) %> - <% end %> - <%= link_to t('.change'), "/#{service_param}/admin/frameworks/#{framework.id}/edit" %> -
        + <%= govuk_table( + [ + { + text: t('.framework') + }, + { + text: t('.live_at') + }, + { + text: t('.expires_at') + }, + { + text: t('.status') + }, + { + text: t('.change') + } + ], + @frameworks.map do |framework| + [ + { + text: framework.framework + }, + { + text: format_date(framework.live_at) + }, + { + text: format_date(framework.expires_at) + }, + { + text: case framework.status + when :live + govuk_tag(t('.live')) + when :coming + govuk_tag(t('.coming'), :grey) + else + govuk_tag(t('.expired'), :red) + end + }, + { + text: link_to(t('.change'), "/#{service_param}/admin/frameworks/#{framework.id}/edit", class: 'govuk-link govuk-link--no-visited-state') + } + ] + end, + first_cell_is_header: true + ) %>
    diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index bbad68731a..479a6387e7 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,14 +5,12 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules folder to the asset load path. -Rails.application.config.assets.paths += [ - Rails.root.join('node_modules'), - Rails.root.join('node_modules', 'govuk-frontend', 'assets', 'images') -] +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. Rails.application.config.assets.precompile += %w[ - govuk-frontend/assets/images/* + govuk-frontend/govuk/assets/fonts/* + govuk-frontend/govuk/assets/images/* ] diff --git a/config/locales/en.yml b/config/locales/en.yml index 389cc15ad3..5841bc507b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,6 +27,10 @@ en: invalid: Invalid verification code provided, please try again invalid_format: Confirmation code must contain numeric characters only invalid_length: Confirmation code must be 6 characters + cognito/forgot_password: + attributes: + email: + invalid: Enter your email address in the correct format, like name@example.com cognito/respond_to_challenge: attributes: access_code: @@ -46,6 +50,7 @@ en: attributes: base: cookies_disabled: Your browser must have cookies enabled + sign_in_error: You must provide a correct username or password email: blank: You must provide your email address in the correct format, like name@example.com invalid: You must provide your email address in the correct format, like name@example.com @@ -82,17 +87,17 @@ en: passwords: edit: confirm_new_password: Confirm new password + email_has_been_sent: A reset email has been sent. heading: Reset your password - heading1: A reset email has been sent. - lead: Reset password for - lead1: If the email address you’ve entered belongs to a Crown Commercial Service account, we’ll send instructions to reset the password. + if_the_email_address_entered: If the email address you’ve entered belongs to a Crown Commercial Service account, we’ll send instructions to reset the password. new_password: New password - password: Your password must have + password: 'Your password must have:' + reset_password_for_html: Reset password for %{email_link} text_html: If you don’t receive this, email support@crowncommercial.gov.uk verify_code: Verification code new: email: Email address - email_hint_html: This is the email address you used to set up your account. + email_hint: This is the email address you used to set up your account. heading: Reset password lead: Enter your email address and we’ll send you a verification code so you can reset your password. Password reset verification codes are only valid for 24 hours. password_reset_success: @@ -100,6 +105,7 @@ en: lead: You can now sign in to your Crown Commercial Service account registrations: domain_not_on_safelist: + back_to_create: Back to create a CCS account heading: You must use a public sector email address lead_html: You must be employed by, or represent, a public sector organisation to create a CCS account. line_01: The email you used doesn’t belong to a recognised public sector domain. @@ -112,16 +118,15 @@ en: email: Email address email_hint: We will send a confirmation code to this address. heading: Create a CCS account + heading_html: Create a CCS account lead: You must be employed by, or represent, a public sector organisation. + your_password_must_have: 'Your password must have:' sessions: new: - create_ccs_account_html: Create a CCS account + create_ccs_account: Create a CCS account email_address: Email address - email_hint: - register: Enter the email address you used to register - set_up: Enter the email address you used to set up your account. - enter_your_password: Enter your password - forgotten_password_html: I’ve forgotten my password + email_hint: Enter the email address you used to set up your account. + forgotten_password: I’ve forgotten my password heading: admin: RM3830: Sign in to the RM3830 administration dashboard @@ -129,7 +134,6 @@ en: crown_marketplace: Sign in to manage Crown Marketplace sign_in: Sign in to your account password: Password - please_enter_a_valid_email_address: You must provide your email address in the correct format, like name@example.com problems_signing_in: Problems signing in session_expired: Sorry, your session has timed out due to 30 minutes of inactivity. To continue using this service, you need to sign in again. users: @@ -137,8 +141,8 @@ en: confirmation_code: Confirmation code email: Email address heading: Activate your account - lead_end: containing your confirmation code. - lead_start: An email has been sent to + lead_html: An email has been sent to %{email_link} containing your confirmation code. + lead_no_email: An email has been sent to the email you provided containing your confirmation code. resend_the_confirmation_email: Resend the email new_password_required: change_password_and_sign_in: Change password and sign in @@ -152,21 +156,17 @@ en: heading: Enter your access code lead: 'We just sent a 6 digit access code by text to:' resend_the_confirmation_code_html: To receive a new access code, sign in again. - cognito/cog_forgot_password_request: - attributes: - please_enter_a_valid_email_address: Enter your email address in the correct format, like name@example.com common: continue: Continue create_account: Create account csv_html: CSV doc_html: DOC - error_summary_title: There is a problem feedback: feedback odt_html: ODT passcap: at least one capital letter passeight: at least 8 characters passnum: at least one number - passsymbol_html: at least one symbol (eg ?, !, £, %) + passsymbol_html: at least one symbol (eg ?, !, £, %) pdf_html: PDF radio_driver: or reset_password: Reset password @@ -183,6 +183,10 @@ en: unit: one: company other: companies + date: + day: Day + month: Month + year: Year errors: contact_ccs: contact_ccs_html: "%{link} if you believe you are seeing this message in error." @@ -333,7 +337,7 @@ en: expires: 20 minutes name: crown_marketplace_confirmation_email purpose: This cookie holds the email of the user when activating their account - reg_and_sign_in_cookies: These cookies are sometimes required to complete the regestration and sign in process. + reg_and_sign_in_cookies: These cookies are sometimes required to complete the registration and sign in process. what_are_cookies: Crown Marketplace puts small files (known as ‘cookies’) onto your computer to collect information about how you browse the site. Find out more about the cookies we use, what they’re for and when they expire. you_may_see_a_banner: You may see a banner when you visit Crown Marketplace inviting you to accept cookies or review your settings. We’ll set cookies so that your computer knows you’ve seen it and not to show it again, and also to store your settings. cookie_settings: diff --git a/config/locales/views/crown_marketplace.en.yml b/config/locales/views/crown_marketplace.en.yml index 614bbed581..322cab8ffc 100644 --- a/config/locales/views/crown_marketplace.en.yml +++ b/config/locales/views/crown_marketplace.en.yml @@ -49,7 +49,7 @@ en: index: add_new_email_domain: Add a new email domain added: Email domain added - enter_an_email_domain: Enter an email domain and click 'Search' to see if it is in the Allow list. + enter_an_email_domain: Enter an email domain and click 'Search for email domain' to see if it is in the Allow list. facilities_management: Facilities Management find_an_email_domain: Find an email domain heading_title: Allow list @@ -57,7 +57,7 @@ en: legal_services: Legal Services management_consultancy: Management Consultancy removed: Email domain removed - search: Search + search: Search for email domain the_four_Services_are: 'The three Crown Marketplace services are:' was_added: "'%{email_domain}' was added to the allow list" was_removed: "'%{email_domain}' was removed from the allow list" @@ -146,10 +146,10 @@ en: label: Mobile telephone number section: mobile telephone number index: - enter_an_email: Enter the email of the user and click 'Search' to see if that user has an account in Crown Marketplace. + enter_an_email: Enter the email of the user and click 'Search for the user' to see if that user has an account in Crown Marketplace. find_a_user: Find a user heading: Manage users - search: Search + search: Search for the user new: heading: Add a user submit: Create user account diff --git a/config/locales/views/facilities_management.en.yml b/config/locales/views/facilities_management.en.yml index e67bcdce0d..9d02c33044 100644 --- a/config/locales/views/facilities_management.en.yml +++ b/config/locales/views/facilities_management.en.yml @@ -175,6 +175,7 @@ en: supplier_status: Supplier status supplier_address: building_and_street: Building and street + building_and_street_line_2: Building and street line 2 county: County (optional) postcode: Postcode town_or_city: Town or city @@ -233,6 +234,7 @@ en: add_address: Add address back: Return to manage your details building_and_street: Building and street + building_and_street_line_2: Building and street line 2 county: County (optional) manage_details: Manage your details postcode: Postcode @@ -277,5 +279,3 @@ en: region_desc: Please confirm the region your building is located in. This will help us shortlist the suppliers who can deliver your services. region_plural: regions found region_singular: region found - users: - sign_in_error: You must provide a correct username or password diff --git a/config/locales/views/facilities_management.rm3830.en.yml b/config/locales/views/facilities_management.rm3830.en.yml index fd19af12d4..d9427e54f7 100644 --- a/config/locales/views/facilities_management.rm3830.en.yml +++ b/config/locales/views/facilities_management.rm3830.en.yml @@ -476,7 +476,6 @@ en: manage_supplier_framework_data: "'Manage supplier framework data'" manage_supplier_framework_data_html: You can navigate to %{link}, to bulk upload the supplier framework data. regions: Regions - return_link: Return to admin dashboard service_prices: Services, prices and variances services: Services sub_lot: @@ -548,6 +547,7 @@ en: status: Status supplier_framework_data: Supplier framework data table_caption: Previous uploads + upload_name: 'Upload session #%{number}' new: caption: Facilities Management download_templates: Download file templates @@ -574,8 +574,6 @@ en: return: Return to 'Manage supplier framework data' status: 'Status:' supplier_framework_data: Supplier framework data - upload: - upload_name: 'Upload session #%{number}' you_cannot_update: details: The RM3830 has expired, you cannot update the supplier's details. rates: The RM3830 has expired, you cannot update these rates. diff --git a/config/locales/views/facilities_management.rm6232.en.yml b/config/locales/views/facilities_management.rm6232.en.yml index 7337c7b04c..8faa9afeee 100644 --- a/config/locales/views/facilities_management.rm6232.en.yml +++ b/config/locales/views/facilities_management.rm6232.en.yml @@ -384,6 +384,7 @@ en: no_uploads: There are currently no uploads for this framework. Click on ‘Create a new data upload’ and follow the instructions to upload supplier data for facilities management. status: Status table_caption: Previous uploads + upload_name: 'Upload session #%{number}' new: caption: Facilities Management (RM6232) download_templates: Download file templates @@ -413,8 +414,6 @@ en: return: Return to 'Manage supplier data' status: 'Status:' uploaded_by: 'Uploaded by:' - upload: - upload_name: 'Upload session #%{number}' you_cannot_update: details: The RM6232 has expired, you cannot update the supplier's details. buyer_account: @@ -458,6 +457,7 @@ en: return_text: Return to your account subtitle: Enter your estimated annual cost of the call off contract (including any potential billable works that you may put through the contract). choose_locations: + checkbox_legend: "%{section} items" heading: Regions more_information: link_text: Office for National Statistics @@ -470,6 +470,7 @@ en: the_regions: The regions below align to the ‘Nomenclature of Territorial Units for Statistics (NUTS)’ hierarchical system used to divide up territories in UK and Europe. choose_services: caption: Choose all facilities management services required within your estate, even if you want services in just one building. + checkbox_legend: "%{section} items" heading: Services learn_more: Further details (opens in a new tab) question: Select the facilities management services that you need diff --git a/features/accessibility/crown_marketplace/super_admin/edit_user_accessibility.feature b/features/accessibility/crown_marketplace/super_admin/edit_user_accessibility.feature index 05060acc42..2d448f7b48 100644 --- a/features/accessibility/crown_marketplace/super_admin/edit_user_accessibility.feature +++ b/features/accessibility/crown_marketplace/super_admin/edit_user_accessibility.feature @@ -26,7 +26,7 @@ Feature: Manage users - Super admin - Edit user - Accessibility | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: Email status - Accessibility And I change the 'Email status' for the user diff --git a/features/accessibility/crown_marketplace/super_admin/view_user_accessibility.feature b/features/accessibility/crown_marketplace/super_admin/view_user_accessibility.feature index 6686a9afbc..43ca04bfb3 100644 --- a/features/accessibility/crown_marketplace/super_admin/view_user_accessibility.feature +++ b/features/accessibility/crown_marketplace/super_admin/view_user_accessibility.feature @@ -28,7 +28,7 @@ Feature: Manage users - Super admin - View user - accessibility | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | And the page should be axe clean Scenario: View Service admin - Accessibility diff --git a/features/crown_marketplace/manage_users/super_admin/edit_user.feature b/features/crown_marketplace/manage_users/super_admin/edit_user.feature index 8fb2c6982a..f2023b4d12 100644 --- a/features/crown_marketplace/manage_users/super_admin/edit_user.feature +++ b/features/crown_marketplace/manage_users/super_admin/edit_user.feature @@ -26,7 +26,7 @@ Feature: Manage users - Super admin - Edit user | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: Edit user - Email Status And I change the 'Email status' for the user @@ -117,7 +117,7 @@ Feature: Manage users - Super admin - Edit user And I click on 'Save and return' Then I am on the 'View user' page And the user has the following details: - | Service access | Facilities Management Supply Teachers | + | Service access | Facilities Management, Supply Teachers | Scenario: Edit user - No Service access required And I change the 'Roles' for the user diff --git a/features/crown_marketplace/manage_users/super_admin/view_user/assorted_details.feature b/features/crown_marketplace/manage_users/super_admin/view_user/assorted_details.feature index b084936d5b..f49c03e294 100644 --- a/features/crown_marketplace/manage_users/super_admin/view_user/assorted_details.feature +++ b/features/crown_marketplace/manage_users/super_admin/view_user/assorted_details.feature @@ -28,7 +28,7 @@ Feature: Manage users - Super admin - View user - Assorted Details | Confirmation status | | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Examples: | confirmation_status | @@ -81,11 +81,11 @@ Feature: Manage users - Super admin - View user - Assorted Details And I cannot manage the user and there is the following warning: | You cannot make changes to this user. 'Super admins' can only be updated in the AWS Cognito console. | And the user has the following details: - | Email address | super_admin@test.com | - | Email status | Verified | - | Account status | Enabled | - | Confirmation status | confirmed | - | Mobile telephone number | 07123456789 | - | MFA status | Enabled | - | Roles | Buyer Service admin User support User admin Super admin | - | Service access | Facilities Management Management Consultancy Legal Services Supply Teachers | + | Email address | super_admin@test.com | + | Email status | Verified | + | Account status | Enabled | + | Confirmation status | confirmed | + | Mobile telephone number | 07123456789 | + | MFA status | Enabled | + | Roles | Buyer, Service admin, User support, User admin, Super admin | + | Service access | Facilities Management, Management Consultancy, Legal Services, Supply Teachers | diff --git a/features/crown_marketplace/manage_users/super_admin/view_user/full_details.feature b/features/crown_marketplace/manage_users/super_admin/view_user/full_details.feature index 029609d090..4204439905 100644 --- a/features/crown_marketplace/manage_users/super_admin/view_user/full_details.feature +++ b/features/crown_marketplace/manage_users/super_admin/view_user/full_details.feature @@ -28,7 +28,7 @@ Feature: Manage users - Super admin - View user - Full Details | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: View Service admin - Full details And I search for 'service_admin@test.com' and there is a user with the following details: diff --git a/features/crown_marketplace/manage_users/super_admin/view_user/mixed_roles.feature b/features/crown_marketplace/manage_users/super_admin/view_user/mixed_roles.feature index abf4788990..10390151fb 100644 --- a/features/crown_marketplace/manage_users/super_admin/view_user/mixed_roles.feature +++ b/features/crown_marketplace/manage_users/super_admin/view_user/mixed_roles.feature @@ -22,9 +22,9 @@ Feature: Manage users - Super admin - View user - Mixed Roles Then I am on the 'View user' page And I can manage the user And the user has the following details: - | Email address | buyer@test.com | - | Email status | Verified | - | Roles | Buyer Service admin | + | Email address | buyer@test.com | + | Email status | Verified | + | Roles | Buyer, Service admin | Scenario: View Service admin and User support And I search for 'service_admin@test.com' and there is a user with the following details: @@ -43,7 +43,7 @@ Feature: Manage users - Super admin - View user - Mixed Roles And the user has the following details: | Email address | service_admin@test.com | | Email status | Verified | - | Roles | Service admin User support | + | Roles | Service admin, User support | Scenario: View User support and User admin And I search for 'user_support@test.com' and there is a user with the following details: @@ -59,9 +59,9 @@ Feature: Manage users - Super admin - View user - Mixed Roles Then I am on the 'View user' page And I can manage the user And the user has the following details: - | Email address | user_support@test.com | - | Email status | Verified | - | Roles | User support User admin | + | Email address | user_support@test.com | + | Email status | Verified | + | Roles | User support, User admin | Scenario: View User admin and Super admin And I search for 'user_admin@test.com' and there is a user with the following details: @@ -80,4 +80,4 @@ Feature: Manage users - Super admin - View user - Mixed Roles And the user has the following details: | Email address | user_admin@test.com | | Email status | Verified | - | Roles | User admin Super admin | + | Roles | User admin, Super admin | diff --git a/features/crown_marketplace/manage_users/user_admin/edit_user.feature b/features/crown_marketplace/manage_users/user_admin/edit_user.feature index ab528e89da..502b7e035a 100644 --- a/features/crown_marketplace/manage_users/user_admin/edit_user.feature +++ b/features/crown_marketplace/manage_users/user_admin/edit_user.feature @@ -26,7 +26,7 @@ Feature: Manage users - User admin - Edit user | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: Edit user - Email Status And I change the 'Email status' for the user @@ -116,7 +116,7 @@ Feature: Manage users - User admin - Edit user And I click on 'Save and return' Then I am on the 'View user' page And the user has the following details: - | Service access | Facilities Management Supply Teachers | + | Service access | Facilities Management, Supply Teachers | Scenario: Edit user - Service error And I cannot edit the user account because of an error diff --git a/features/crown_marketplace/manage_users/user_admin/view_user/assorted_details.feature b/features/crown_marketplace/manage_users/user_admin/view_user/assorted_details.feature index 8f6b06e2dd..34d4aba505 100644 --- a/features/crown_marketplace/manage_users/user_admin/view_user/assorted_details.feature +++ b/features/crown_marketplace/manage_users/user_admin/view_user/assorted_details.feature @@ -28,7 +28,7 @@ Feature: Manage users - User admin - View user - Assorted Details | Confirmation status | | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Examples: | confirmation_status | @@ -81,11 +81,11 @@ Feature: Manage users - User admin - View user - Assorted Details And I cannot manage the user and there is the following warning: | You cannot make changes to this user. 'Super admins' can only be updated in the AWS Cognito console. | And the user has the following details: - | Email address | super_admin@test.com | - | Email status | Verified | - | Account status | Enabled | - | Confirmation status | confirmed | - | Mobile telephone number | 07123456789 | - | MFA status | Enabled | - | Roles | Buyer Service admin User support User admin Super admin | - | Service access | Facilities Management Management Consultancy Legal Services Supply Teachers | + | Email address | super_admin@test.com | + | Email status | Verified | + | Account status | Enabled | + | Confirmation status | confirmed | + | Mobile telephone number | 07123456789 | + | MFA status | Enabled | + | Roles | Buyer, Service admin, User support, User admin, Super admin | + | Service access | Facilities Management, Management Consultancy, Legal Services, Supply Teachers | diff --git a/features/crown_marketplace/manage_users/user_admin/view_user/full_details.feature b/features/crown_marketplace/manage_users/user_admin/view_user/full_details.feature index 048614b9e2..e173e3e5e8 100644 --- a/features/crown_marketplace/manage_users/user_admin/view_user/full_details.feature +++ b/features/crown_marketplace/manage_users/user_admin/view_user/full_details.feature @@ -28,7 +28,7 @@ Feature: Manage users - User admin - View user - Full Details | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: View Service admin - Full details And I search for 'service_admin@test.com' and there is a user with the following details: diff --git a/features/crown_marketplace/manage_users/user_admin/view_user/mixed_roles.feature b/features/crown_marketplace/manage_users/user_admin/view_user/mixed_roles.feature index 54eeb306e1..b9d4e8b7f9 100644 --- a/features/crown_marketplace/manage_users/user_admin/view_user/mixed_roles.feature +++ b/features/crown_marketplace/manage_users/user_admin/view_user/mixed_roles.feature @@ -22,9 +22,9 @@ Feature: Manage users - User admin - View user - Mixed Roles Then I am on the 'View user' page And I can manage the user And the user has the following details: - | Email address | buyer@test.com | - | Email status | Verified | - | Roles | Buyer Service admin | + | Email address | buyer@test.com | + | Email status | Verified | + | Roles | Buyer, Service admin | Scenario: View Service admin and User support And I search for 'service_admin@test.com' and there is a user with the following details: @@ -43,7 +43,7 @@ Feature: Manage users - User admin - View user - Mixed Roles And the user has the following details: | Email address | service_admin@test.com | | Email status | Verified | - | Roles | Service admin User support | + | Roles | Service admin, User support | Scenario: View User support and User admin And I search for 'user_support@test.com' and there is a user with the following details: @@ -60,9 +60,9 @@ Feature: Manage users - User admin - View user - Mixed Roles And I cannot manage the user and there is the following warning: | You do not have the required permissions to make changes to this user. You must have the 'Super admin' role to make changes. | And the user has the following details: - | Email address | user_support@test.com | - | Email status | Verified | - | Roles | User support User admin | + | Email address | user_support@test.com | + | Email status | Verified | + | Roles | User support, User admin | Scenario: View User admin and Super admin And I search for 'user_admin@test.com' and there is a user with the following details: @@ -81,4 +81,4 @@ Feature: Manage users - User admin - View user - Mixed Roles And the user has the following details: | Email address | user_admin@test.com | | Email status | Verified | - | Roles | User admin Super admin | + | Roles | User admin, Super admin | diff --git a/features/crown_marketplace/manage_users/user_support/edit_user.feature b/features/crown_marketplace/manage_users/user_support/edit_user.feature index d06240090d..6c28a4afb3 100644 --- a/features/crown_marketplace/manage_users/user_support/edit_user.feature +++ b/features/crown_marketplace/manage_users/user_support/edit_user.feature @@ -29,7 +29,7 @@ Feature: Manage users - User support - Edit user | Mobile telephone number | 07987654321 | | Mobile telephone number | 07987654321 | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: Edit user - Email Status And I change the 'Email status' for the user @@ -67,7 +67,7 @@ Feature: Manage users - User support - Edit user And I click on 'Save and return' Then I am on the 'View user' page And the user has the following details: - | Service access | Facilities Management Supply Teachers | + | Service access | Facilities Management, Supply Teachers | Scenario: Edit user - Service error And I cannot edit the user account because of an error diff --git a/features/crown_marketplace/manage_users/user_support/validations/edit_user_validation.feature b/features/crown_marketplace/manage_users/user_support/validations/edit_user_validation.feature index cbc48e8dba..6ff5ada207 100644 --- a/features/crown_marketplace/manage_users/user_support/validations/edit_user_validation.feature +++ b/features/crown_marketplace/manage_users/user_support/validations/edit_user_validation.feature @@ -26,7 +26,7 @@ Feature: Manage users - User support - Edit user - Validations | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: Service access - Validations And I change the 'Service access' for the user diff --git a/features/crown_marketplace/manage_users/user_support/view_user/assorted_details.feature b/features/crown_marketplace/manage_users/user_support/view_user/assorted_details.feature index 3ef20775f5..e09430ebbd 100644 --- a/features/crown_marketplace/manage_users/user_support/view_user/assorted_details.feature +++ b/features/crown_marketplace/manage_users/user_support/view_user/assorted_details.feature @@ -28,7 +28,7 @@ Feature: Manage users - User support - View user - Assorted Details | Confirmation status | | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Examples: | confirmation_status | @@ -81,11 +81,11 @@ Feature: Manage users - User support - View user - Assorted Details And I cannot manage the user and there is the following warning: | You cannot make changes to this user. 'Super admins' can only be updated in the AWS Cognito console. | And the user has the following details: - | Email address | super_admin@test.com | - | Email status | Verified | - | Account status | Enabled | - | Confirmation status | confirmed | - | Mobile telephone number | 07123456789 | - | MFA status | Enabled | - | Roles | Buyer Service admin User support User admin Super admin | - | Service access | Facilities Management Management Consultancy Legal Services Supply Teachers | + | Email address | super_admin@test.com | + | Email status | Verified | + | Account status | Enabled | + | Confirmation status | confirmed | + | Mobile telephone number | 07123456789 | + | MFA status | Enabled | + | Roles | Buyer, Service admin, User support, User admin, Super admin | + | Service access | Facilities Management, Management Consultancy, Legal Services, Supply Teachers | diff --git a/features/crown_marketplace/manage_users/user_support/view_user/full_details.feature b/features/crown_marketplace/manage_users/user_support/view_user/full_details.feature index 4cf9296d4d..b087c4e5e8 100644 --- a/features/crown_marketplace/manage_users/user_support/view_user/full_details.feature +++ b/features/crown_marketplace/manage_users/user_support/view_user/full_details.feature @@ -28,7 +28,7 @@ Feature: Manage users - User support - View user - Full Details | Confirmation status | confirmed | | Mobile telephone number | None | | Roles | Buyer | - | Service access | Facilities Management Legal Services | + | Service access | Facilities Management, Legal Services | Scenario: View Service admin - Full details And I search for 'service_admin@test.com' and there is a user with the following details: diff --git a/features/crown_marketplace/manage_users/user_support/view_user/mixed_roles.feature b/features/crown_marketplace/manage_users/user_support/view_user/mixed_roles.feature index f470264f0c..202ec46167 100644 --- a/features/crown_marketplace/manage_users/user_support/view_user/mixed_roles.feature +++ b/features/crown_marketplace/manage_users/user_support/view_user/mixed_roles.feature @@ -25,7 +25,7 @@ Feature: Manage users - User support - View user - Mixed Roles And the user has the following details: | Email address | buyer@test.com | | Email status | Verified | - | Roles | Buyer Service admin | + | Roles | Buyer, Service admin | Scenario: View Service admin and User support And I search for 'service_admin@test.com' and there is a user with the following details: @@ -45,7 +45,7 @@ Feature: Manage users - User support - View user - Mixed Roles And the user has the following details: | Email address | service_admin@test.com | | Email status | Verified | - | Roles | Service admin User support | + | Roles | Service admin, User support | Scenario: View User support and User admin And I search for 'user_support@test.com' and there is a user with the following details: @@ -62,9 +62,9 @@ Feature: Manage users - User support - View user - Mixed Roles And I cannot manage the user and there is the following warning: | You do not have the required permissions to make changes to this user. You must have the 'Super admin' role to make changes. | And the user has the following details: - | Email address | user_support@test.com | - | Email status | Verified | - | Roles | User support User admin | + | Email address | user_support@test.com | + | Email status | Verified | + | Roles | User support, User admin | Scenario: View User admin and Super admin And I search for 'user_admin@test.com' and there is a user with the following details: @@ -83,4 +83,4 @@ Feature: Manage users - User support - View user - Mixed Roles And the user has the following details: | Email address | user_admin@test.com | | Email status | Verified | - | Roles | User admin Super admin | + | Roles | User admin, Super admin | diff --git a/features/facilities_management/rm3830/admin/cognito/validations/forgot_password_validations.feature b/features/facilities_management/rm3830/admin/cognito/validations/forgot_password_validations.feature index a007388302..77470f31b0 100644 --- a/features/facilities_management/rm3830/admin/cognito/validations/forgot_password_validations.feature +++ b/features/facilities_management/rm3830/admin/cognito/validations/forgot_password_validations.feature @@ -8,7 +8,7 @@ Feature: Forgot my password - RM3830 - Admin - Validations Scenario Outline: I forgot my password - email invalid And I enter the following details into the form: - | email | | + | Email address | | And I click on 'Send reset email' Then I should see the following error messages: | Enter your email address in the correct format, like name@example.com | diff --git a/features/facilities_management/rm3830/admin/supplier_data/supplier_framework_data/supplier_framework_data.feature b/features/facilities_management/rm3830/admin/supplier_data/supplier_framework_data/supplier_framework_data.feature index 9e581ce0ae..8be01439c8 100644 --- a/features/facilities_management/rm3830/admin/supplier_data/supplier_framework_data/supplier_framework_data.feature +++ b/features/facilities_management/rm3830/admin/supplier_data/supplier_framework_data/supplier_framework_data.feature @@ -7,7 +7,7 @@ Feature: Supplier framework data Given I show all sections Scenario: Return to admin dashboard - Given I click on 'Return to admin dashboard' + Given I click on 'Home' Then I am on the 'RM3830 administration dashboard' page Scenario Outline: Return links for the service pages diff --git a/features/facilities_management/rm6232/admin/cognito/validations/forgot_password_validations.feature b/features/facilities_management/rm6232/admin/cognito/validations/forgot_password_validations.feature index b9e92e11e4..61532a3d9b 100644 --- a/features/facilities_management/rm6232/admin/cognito/validations/forgot_password_validations.feature +++ b/features/facilities_management/rm6232/admin/cognito/validations/forgot_password_validations.feature @@ -8,7 +8,7 @@ Feature: Forgot my password - RM6232 - Admin - Validations Scenario Outline: I forgot my password - email invalid And I enter the following details into the form: - | email | | + | Email address | | And I click on 'Send reset email' Then I should see the following error messages: | Enter your email address in the correct format, like name@example.com | diff --git a/features/facilities_management/rm6232/cognito/validations/forgot_password_validations.feature b/features/facilities_management/rm6232/cognito/validations/forgot_password_validations.feature index 1559257188..1ea3b7905a 100644 --- a/features/facilities_management/rm6232/cognito/validations/forgot_password_validations.feature +++ b/features/facilities_management/rm6232/cognito/validations/forgot_password_validations.feature @@ -10,7 +10,7 @@ Feature: Forgot my password - RM6232 - Validations Scenario Outline: I forgot my password - email invalid And I enter the following details into the form: - | email | | + | Email address | | And I click on 'Send reset email' Then I should see the following error messages: | Enter your email address in the correct format, like name@example.com | diff --git a/features/facilities_management/rm6232/quick_view/select_regions.feature b/features/facilities_management/rm6232/quick_view/select_regions.feature index 048bf2cb58..c0a3b00a90 100644 --- a/features/facilities_management/rm6232/quick_view/select_regions.feature +++ b/features/facilities_management/rm6232/quick_view/select_regions.feature @@ -11,12 +11,12 @@ Feature: Select regions Then I am on the 'Regions' page And I show all sections - Scenario: Region selection appears in basked + Scenario: Region selection appears in basket Then the basket should say 'No regions selected' And the remove all link should not be visible When I select 'Tees Valley and Durham' Then the basket should say '1 region selected' - And the remove all link should not be visible + And the remove all link should be visible And the following items should appear in the basket: | Tees Valley and Durham (UKC1) | When I select the following items: diff --git a/features/facilities_management/rm6232/quick_view/select_services.feature b/features/facilities_management/rm6232/quick_view/select_services.feature index 207b1087c1..bfd88bca71 100644 --- a/features/facilities_management/rm6232/quick_view/select_services.feature +++ b/features/facilities_management/rm6232/quick_view/select_services.feature @@ -12,7 +12,7 @@ Feature: Select services And the remove all link should not be visible When I select 'Building Management System (BMS) maintenance' Then the basket should say '1 service selected' - And the remove all link should not be visible + And the remove all link should be visible And the following items should appear in the basket: | Building Management System (BMS) maintenance | When I select the following items: diff --git a/features/step_definitions/crown_marketplace/home_steps.rb b/features/step_definitions/crown_marketplace/home_steps.rb index a64e602b53..867dd9360e 100644 --- a/features/step_definitions/crown_marketplace/home_steps.rb +++ b/features/step_definitions/crown_marketplace/home_steps.rb @@ -2,9 +2,7 @@ visit '/crown-marketplace/sign-in' update_banner_cookie(true) if @javascript create_admin_user(user) - fill_in 'email', with: @user.email - fill_in 'password', with: 'ValidPassword' - click_button 'Sign in' + step 'I sign in' expect(page.find('h1')).to have_content('Crown Marketplace dashboard') end diff --git a/features/step_definitions/crown_marketplace/manage_users_steps.rb b/features/step_definitions/crown_marketplace/manage_users_steps.rb index 031dcf71a3..7faa9c346f 100644 --- a/features/step_definitions/crown_marketplace/manage_users_steps.rb +++ b/features/step_definitions/crown_marketplace/manage_users_steps.rb @@ -63,13 +63,13 @@ end Then('the user has the following details:') do |user_details_table| - user_details = user_details_table.raw.to_h.symbolize_keys + user_details = user_details_table.raw user_details.each do |key, value| user_details_row = manage_users_page.view_user_summary.send(key) - expect(user_details_row.key).to have_content(key.to_s) - expect(user_details_row.value).to have_content(value) + expect(user_details_row.key).to have_content(key) + expect(user_details_row.value).to have_content(['Roles', 'Service access'].include?(key) ? value.split(', ').join : value) end end diff --git a/features/step_definitions/facilities_management/admin_steps.rb b/features/step_definitions/facilities_management/admin_steps.rb index 8a5558da2b..a19a8deac2 100644 --- a/features/step_definitions/facilities_management/admin_steps.rb +++ b/features/step_definitions/facilities_management/admin_steps.rb @@ -9,9 +9,7 @@ visit "/facilities-management/#{framework}/admin/sign-in" update_banner_cookie(true) if @javascript create_admin_user_with_details - fill_in 'email', with: @user.email - fill_in 'password', with: 'ValidPassword' - click_button 'Sign in' + step 'I sign in' expect(page.find('h1')).to have_content("#{framework} administration dashboard") end diff --git a/features/step_definitions/facilities_management/cognito_steps.rb b/features/step_definitions/facilities_management/cognito_steps.rb index 9424d0954c..38a284567e 100644 --- a/features/step_definitions/facilities_management/cognito_steps.rb +++ b/features/step_definitions/facilities_management/cognito_steps.rb @@ -1,6 +1,6 @@ Then 'I sign in with cognito' do - fill_in 'email', with: @user_email - fill_in 'password', with: 'ValidPassword' + fill_in 'Email address', with: @user_email + fill_in 'Password', with: 'ValidPassword' click_button 'Sign in' end diff --git a/features/step_definitions/facilities_management/common_steps.rb b/features/step_definitions/facilities_management/common_steps.rb index 54a1208e21..bf16091d11 100644 --- a/features/step_definitions/facilities_management/common_steps.rb +++ b/features/step_definitions/facilities_management/common_steps.rb @@ -2,9 +2,7 @@ visit "/facilities-management/#{framework}/sign-in" update_banner_cookie(true) if @javascript create_user_with_details - fill_in 'email', with: @user.email - fill_in 'password', with: 'ValidPassword' - click_button 'Sign in' + step 'I sign in' expect(page.find('h1')).to have_content(@user.email) end diff --git a/features/step_definitions/facilities_management/home_steps.rb b/features/step_definitions/facilities_management/home_steps.rb index ac4d1e71d8..8138334186 100644 --- a/features/step_definitions/facilities_management/home_steps.rb +++ b/features/step_definitions/facilities_management/home_steps.rb @@ -2,9 +2,7 @@ visit "/facilities-management/#{framework}/sign-in" update_banner_cookie(true) if @javascript create_user_without_details - fill_in 'email', with: @user.email - fill_in 'password', with: 'ValidPassword' - click_button 'Sign in' + step 'I sign in' expect(page.find('h1')).to have_content('Manage your details') end @@ -26,8 +24,8 @@ end Then('I sign in') do - fill_in 'email', with: @user.email - fill_in 'password', with: 'ValidPassword' + fill_in 'Email address', with: @user.email + fill_in 'Password', with: 'ValidPassword' click_button 'Sign in' end @@ -74,7 +72,7 @@ end Given('I enter {string} for my email') do |email| - fill_in 'email', with: email + fill_in 'Email address', with: email end Given('I enter {string} for the password') do |password| diff --git a/features/step_definitions/facilities_management/rm6232/quick_view_steps.rb b/features/step_definitions/facilities_management/rm6232/quick_view_steps.rb index 3a1e424b31..6434903de6 100644 --- a/features/step_definitions/facilities_management/rm6232/quick_view_steps.rb +++ b/features/step_definitions/facilities_management/rm6232/quick_view_steps.rb @@ -22,7 +22,7 @@ end Given('I click on the service specification for {string}') do |service_name| - quick_view_page.find('label', text: service_name).find('a').click + quick_view_page.find('label', text: service_name).find(:xpath, '../div/a').click end Then('the page sub title is {string}') do |sub_title| diff --git a/features/support/pages/admin.rb b/features/support/pages/admin.rb index e10936c1ab..750b567c18 100644 --- a/features/support/pages/admin.rb +++ b/features/support/pages/admin.rb @@ -8,15 +8,15 @@ class Admin < SitePrism::Page section :supplier_details, '#main-content' do element :supplier_name_title, 'h1 > span' - section :'Current user', SupplierDetailsSection, '#supplier-details--supplier_user' - section :'Supplier status', SupplierDetailsSection, '#supplier-details--supplier_status' - section :'Supplier name', SupplierDetailsSection, '#supplier-details--supplier_name' - section :'Contact name', SupplierDetailsSection, '#supplier-details--contact_name' - section :'Contact email', SupplierDetailsSection, '#supplier-details--contact_email' - section :'Contact telephone number', SupplierDetailsSection, '#supplier-details--contact_phone' - section :'DUNS number', SupplierDetailsSection, '#supplier-details--duns' - section :'Company registration number', SupplierDetailsSection, '#supplier-details--registration_number' - section :'Full address', SupplierDetailsSection, '#supplier-details--full_address' + section :'Current user', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Current user"]/..' + section :'Supplier status', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Current status"]/..' + section :'Supplier name', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Supplier name"]/..' + section :'Contact name', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Contact name"]/..' + section :'Contact email', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Contact email"]/..' + section :'Contact telephone number', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Contact telephone number"]/..' + section :'DUNS number', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="DUNS number"]/..' + section :'Company registration number', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Company registration number"]/..' + section :'Full address', SupplierDetailsSection, :xpath, '//dl/div/dt[@class="govuk-summary-list__key"][text()="Full address"]/..' end element :management_report_date, '#main-content > div:nth-child(4) > div > p:nth-child(2)' diff --git a/features/support/pages/allow_list.rb b/features/support/pages/allow_list.rb index cfa2053ab3..f1f024175b 100644 --- a/features/support/pages/allow_list.rb +++ b/features/support/pages/allow_list.rb @@ -9,7 +9,7 @@ class AllowList < SitePrism::Page sections :rows, EmailDomainRowSection, 'tbody > tr' end - section :email_domain_search, '#allow-list-search-container > div > form' do + section :email_domain_search, 'form' do element :input, '#allowed_email_domain_email_domain' element :button, 'input.govuk-button.govuk-button--secondary' end diff --git a/features/support/pages/manage_users.rb b/features/support/pages/manage_users.rb index 5d6763d6e7..ce4f0bc142 100644 --- a/features/support/pages/manage_users.rb +++ b/features/support/pages/manage_users.rb @@ -19,10 +19,10 @@ class ViewUserRow < SitePrism::Section class ManageUsers < SitePrism::Page section :user_details_summary, '#add-user-details-summary' do - section :role, UserDetailRow, '#add-user-details-summary--roles' - section :'service access', UserDetailRow, '#add-user-details-summary--service-access' - section :email, UserDetailRow, '#add-user-details-summary--email' - section :'telephone number', UserDetailRow, '#add-user-details-summary--telephone-number' + section :role, UserDetailRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Role"]/..' + section :'service access', UserDetailRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Service access"]/..' + section :email, UserDetailRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Email address"]/..' + section :'telephone number', UserDetailRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Mobile telephone number"]/..' end section :notification_banner, 'div.govuk-notification-banner' do @@ -44,14 +44,14 @@ class ManageUsers < SitePrism::Page element :resend_temporary_password_button, '#resend-temporary-password-button' section :view_user_summary, 'dl.govuk-summary-list' do - section :'Email address', ViewUserRow, '#view-user__email' - section :'Email status', ViewUserRow, '#view-user__email-status' - section :'Account status', ViewUserRow, '#view-user__account-status' - section :'Confirmation status', ViewUserRow, '#view-user__confirmation-status' - section :'Mobile telephone number', ViewUserRow, '#view-user__telephone-number' - section :'MFA status', ViewUserRow, '#view-user__mfa-status' - section :Roles, ViewUserRow, '#view-user__roles' - section :'Service access', ViewUserRow, '#view-user__service-access' + section :'Email address', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Email address"]/..' + section :'Email status', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Email status"]/..' + section :'Account status', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Account status"]/..' + section :'Confirmation status', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Confirmation status"]/..' + section :'Mobile telephone number', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Mobile telephone number"]/..' + section :'MFA status', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="MFA status"]/..' + section :Roles, ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Roles"]/..' + section :'Service access', ViewUserRow, :xpath, '//dt[@class="govuk-summary-list__key"][text()="Service access"]/..' end element :email_status_verified, '#cognito_admin_user_email_verified_true' diff --git a/features/support/pages/quick_view.rb b/features/support/pages/quick_view.rb index 13f5e0ab45..fe089723ff 100644 --- a/features/support/pages/quick_view.rb +++ b/features/support/pages/quick_view.rb @@ -1,9 +1,9 @@ module Pages class QuickView < SitePrism::Page - section :basket, '.basket' do + section :basket, '#css-list-basket' do elements :selection, 'ul > li > div:nth-of-type(2)' element :selection_count, 'h3' - element :remove_all, 'a[aria-label="Remove all"]' + element :remove_all, '#removeAll' end end end diff --git a/features/support/pages/rm6232/admin.rb b/features/support/pages/rm6232/admin.rb index 0d3a34b44e..f2af40bfad 100644 --- a/features/support/pages/rm6232/admin.rb +++ b/features/support/pages/rm6232/admin.rb @@ -67,7 +67,7 @@ class Admin < Pages::Admin element :updated_supplier, '#updated-supplier' element :updated_by_email, '#updated-by-email' - element :uploaded_by_email, '#uploaded-by-email' + element :uploaded_by_email, '#main-content > div:nth-child(3) > div > dl > div:nth-child(3) > dd' element :updated_lot, '#updated-lot' section :changes_table, '#main-content > div:nth-child(6) > div > table' do diff --git a/features/support/pages/rm6232/procurement.rb b/features/support/pages/rm6232/procurement.rb index f387fd70cd..415bfec47d 100644 --- a/features/support/pages/rm6232/procurement.rb +++ b/features/support/pages/rm6232/procurement.rb @@ -5,7 +5,7 @@ class ProcurementSummarySection < SitePrism::Section end class Procurement < SitePrism::Page - element :view_procurements, '#main-content > div.govuk-width-container > div.govuk-grid-row.govuk-\!-margin-bottom-6.fm-buyer-account-panel__container > div:nth-child(2) > p:nth-child(1) > a' + element :view_procurements, '#main-content > div.ccs-dashboard-section > div > div > div > div:nth-child(2) > a' element :contract_name_field, '#facilities_management_rm6232_procurement_contract_name' element :contract_name, '#main-content > div.govuk-body > div > span' diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spec/controllers/crown_marketplace/passwords_controller_spec.rb b/spec/controllers/crown_marketplace/passwords_controller_spec.rb index 5d5e91a2c5..c4cfbf2d1c 100644 --- a/spec/controllers/crown_marketplace/passwords_controller_spec.rb +++ b/spec/controllers/crown_marketplace/passwords_controller_spec.rb @@ -17,15 +17,15 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ForgotPassword).to receive(:forgot_password).and_return(true) # rubocop:enable RSpec/AnyInstance - post :create, params: { email: } + post :create, params: { cognito_forgot_password: { email: } } cookies.update(response.cookies) end context 'when the email is invalid' do let(:email) { 'testtest.com' } - it 'redirects to the crown_marketplace_new_user_password_path' do - expect(response).to redirect_to crown_marketplace_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end it 'does not set the crown_marketplace_reset_email cookie' do @@ -51,7 +51,7 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ForgotPassword).to receive(:forgot_password).and_raise(error.new('Some context', 'Some message')) # rubocop:enable RSpec/AnyInstance - post :create, params: { email: 'test@test.com' } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } end context 'and the error is UserNotFoundException' do @@ -65,16 +65,16 @@ context 'and the error is InvalidParameterException' do let(:error) { Aws::CognitoIdentityProvider::Errors::InvalidParameterException } - it 'redirects to the new password page' do - expect(response).to redirect_to crown_marketplace_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end context 'and the error is ServiceError' do let(:error) { Aws::CognitoIdentityProvider::Errors::ServiceError } - it 'redirects to the new password page' do - expect(response).to redirect_to crown_marketplace_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end end @@ -102,7 +102,7 @@ allow_any_instance_of(Cognito::ConfirmPasswordReset).to receive(:create_user_if_needed).and_return(true) allow_any_instance_of(Cognito::ConfirmPasswordReset).to receive(:confirm_forgot_password).and_return(true) # rubocop:enable RSpec/AnyInstance - put :update, params: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } } cookies.update(response.cookies) end diff --git a/spec/controllers/crown_marketplace/users_controller_spec.rb b/spec/controllers/crown_marketplace/users_controller_spec.rb index 0ab0a04688..e0c760c4b3 100644 --- a/spec/controllers/crown_marketplace/users_controller_spec.rb +++ b/spec/controllers/crown_marketplace/users_controller_spec.rb @@ -55,7 +55,7 @@ allow(aws_client).to receive(:respond_to_auth_challenge).and_return(respond_to_auth_challenge_resp_struct.new(challenge_name: new_challenge_name, session: new_session)) allow(Cognito::CreateUserFromCognito).to receive(:call).and_return(admin_create_user_resp_struct.new(user:)) - post :challenge, params: { challenge_name: challenge_name, username: username, session: session, new_password: password, new_password_confirmation: password } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username: username, session: session, new_password: password, new_password_confirmation: password } } cookies.update(response.cookies) end @@ -109,7 +109,7 @@ allow(aws_client).to receive(:respond_to_auth_challenge).and_return(respond_to_auth_challenge_resp_struct.new) allow(Cognito::CreateUserFromCognito).to receive(:call).and_return(admin_create_user_resp_struct.new(user:)) - post :challenge, params: { challenge_name:, username:, session:, access_code: } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username:, session:, access_code: } } cookies.update(response.cookies) end diff --git a/spec/controllers/facilities_management/rm3830/admin/passwords_controller_spec.rb b/spec/controllers/facilities_management/rm3830/admin/passwords_controller_spec.rb index 8166f25558..27a506350d 100644 --- a/spec/controllers/facilities_management/rm3830/admin/passwords_controller_spec.rb +++ b/spec/controllers/facilities_management/rm3830/admin/passwords_controller_spec.rb @@ -36,15 +36,15 @@ context 'when no exception is raised' do before do - post :create, params: { email: } + post :create, params: { cognito_forgot_password: { email: } } cookies.update(response.cookies) end context 'when the email is invalid' do let(:email) { 'testtest.com' } - it 'redirects to the facilities_management_rm3830_admin_new_user_password_path' do - expect(response).to redirect_to facilities_management_rm3830_admin_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end it 'does not set the crown_marketplace_reset_email cookie' do @@ -70,7 +70,7 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ForgotPassword).to receive(:forgot_password).and_raise(error.new('Some context', 'Some message')) # rubocop:enable RSpec/AnyInstance - post :create, params: { email: 'test@test.com' } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } end context 'and the error is UserNotFoundException' do @@ -84,16 +84,16 @@ context 'and the error is InvalidParameterException' do let(:error) { Aws::CognitoIdentityProvider::Errors::InvalidParameterException } - it 'redirects to the new password page' do - expect(response).to redirect_to facilities_management_rm3830_admin_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end context 'and the error is ServiceError' do let(:error) { Aws::CognitoIdentityProvider::Errors::ServiceError } - it 'redirects to the new password page' do - expect(response).to redirect_to facilities_management_rm3830_admin_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end end @@ -103,7 +103,7 @@ let(:email) { 'test@test.com' } before do - post :create, params: { email: } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } cookies.update(response.cookies) end @@ -165,7 +165,7 @@ include_context 'and RM3830 is live' before do - put :update, params: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } } cookies.update(response.cookies) end @@ -198,7 +198,7 @@ let(:password) { 'Password12345!' } before do - put :update, params: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } } cookies.update(response.cookies) end diff --git a/spec/controllers/facilities_management/rm3830/admin/users_controller_spec.rb b/spec/controllers/facilities_management/rm3830/admin/users_controller_spec.rb index cb0f8dfb15..04988ab7ed 100644 --- a/spec/controllers/facilities_management/rm3830/admin/users_controller_spec.rb +++ b/spec/controllers/facilities_management/rm3830/admin/users_controller_spec.rb @@ -85,7 +85,7 @@ include_context 'and RM3830 is live' before do - post :challenge, params: { challenge_name: challenge_name, username: username, session: session, new_password: password, new_password_confirmation: password } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username: username, session: session, new_password: password, new_password_confirmation: password } } cookies.update(response.cookies) end @@ -131,7 +131,7 @@ context 'when the framework is not live' do before do - post :challenge, params: { challenge_name: challenge_name, username: username, session: session, new_password: password, new_password_confirmation: password } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username: username, session: session, new_password: password, new_password_confirmation: password } } cookies.update(response.cookies) end @@ -161,7 +161,7 @@ include_context 'and RM3830 is live' before do - post :challenge, params: { challenge_name:, username:, session:, access_code: } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username:, session:, access_code: } } cookies.update(response.cookies) end @@ -192,7 +192,7 @@ context 'when the framework is not live' do before do - post :challenge, params: { challenge_name:, username:, session:, access_code: } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username:, session:, access_code: } } cookies.update(response.cookies) end diff --git a/spec/controllers/facilities_management/rm6232/admin/passwords_controller_spec.rb b/spec/controllers/facilities_management/rm6232/admin/passwords_controller_spec.rb index 51bd0b3496..5148d73f7e 100644 --- a/spec/controllers/facilities_management/rm6232/admin/passwords_controller_spec.rb +++ b/spec/controllers/facilities_management/rm6232/admin/passwords_controller_spec.rb @@ -34,15 +34,15 @@ context 'when the framework is live' do context 'when no exception is raised' do before do - post :create, params: { email: } + post :create, params: { cognito_forgot_password: { email: } } cookies.update(response.cookies) end context 'when the email is invalid' do let(:email) { 'testtest.com' } - it 'redirects to the facilities_management_rm6232_admin_new_user_password_path' do - expect(response).to redirect_to facilities_management_rm6232_admin_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end it 'does not set the crown_marketplace_reset_email cookie' do @@ -68,7 +68,7 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ForgotPassword).to receive(:forgot_password).and_raise(error.new('Some context', 'Some message')) # rubocop:enable RSpec/AnyInstance - post :create, params: { email: 'test@test.com' } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } end context 'and the error is UserNotFoundException' do @@ -82,16 +82,16 @@ context 'and the error is InvalidParameterException' do let(:error) { Aws::CognitoIdentityProvider::Errors::InvalidParameterException } - it 'redirects to the new password page' do - expect(response).to redirect_to facilities_management_rm6232_admin_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end context 'and the error is ServiceError' do let(:error) { Aws::CognitoIdentityProvider::Errors::ServiceError } - it 'redirects to the new password page' do - expect(response).to redirect_to facilities_management_rm6232_admin_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end end @@ -103,7 +103,7 @@ include_context 'and RM6232 has expired' before do - post :create, params: { email: } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } cookies.update(response.cookies) end @@ -163,7 +163,7 @@ context 'when the framework is live' do before do - put :update, params: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } } cookies.update(response.cookies) end @@ -198,7 +198,7 @@ include_context 'and RM6232 has expired' before do - put :update, params: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } } cookies.update(response.cookies) end diff --git a/spec/controllers/facilities_management/rm6232/admin/users_controller_spec.rb b/spec/controllers/facilities_management/rm6232/admin/users_controller_spec.rb index f59f9ac1d3..dec67773ab 100644 --- a/spec/controllers/facilities_management/rm6232/admin/users_controller_spec.rb +++ b/spec/controllers/facilities_management/rm6232/admin/users_controller_spec.rb @@ -83,7 +83,7 @@ context 'when the framework is live' do before do - post :challenge, params: { challenge_name: challenge_name, username: username, session: session, new_password: password, new_password_confirmation: password } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username: username, session: session, new_password: password, new_password_confirmation: password } } cookies.update(response.cookies) end @@ -131,7 +131,7 @@ include_context 'and RM6232 has expired' before do - post :challenge, params: { challenge_name: challenge_name, username: username, session: session, new_password: password, new_password_confirmation: password } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username: username, session: session, new_password: password, new_password_confirmation: password } } cookies.update(response.cookies) end @@ -159,7 +159,7 @@ context 'when the framework is live' do before do - post :challenge, params: { challenge_name:, username:, session:, access_code: } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username:, session:, access_code: } } cookies.update(response.cookies) end @@ -192,7 +192,7 @@ include_context 'and RM6232 has expired' before do - post :challenge, params: { challenge_name:, username:, session:, access_code: } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username:, session:, access_code: } } cookies.update(response.cookies) end diff --git a/spec/controllers/facilities_management/rm6232/passwords_controller_spec.rb b/spec/controllers/facilities_management/rm6232/passwords_controller_spec.rb index e93965cb27..13a4c5cfc9 100644 --- a/spec/controllers/facilities_management/rm6232/passwords_controller_spec.rb +++ b/spec/controllers/facilities_management/rm6232/passwords_controller_spec.rb @@ -32,15 +32,15 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ForgotPassword).to receive(:forgot_password).and_return(true) # rubocop:enable RSpec/AnyInstance - post :create, params: { email: } + post :create, params: { cognito_forgot_password: { email: } } cookies.update(response.cookies) end context 'when the email is invalid' do let(:email) { 'testtest.com' } - it 'redirects to the facilities_management_rm6232_new_user_password_path' do - expect(response).to redirect_to facilities_management_rm6232_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end it 'does not set the crown_marketplace_reset_email cookie' do @@ -66,7 +66,7 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ForgotPassword).to receive(:forgot_password).and_raise(error.new('Some context', 'Some message')) # rubocop:enable RSpec/AnyInstance - post :create, params: { email: 'test@test.com' } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } end context 'and the error is UserNotFoundException' do @@ -80,16 +80,16 @@ context 'and the error is InvalidParameterException' do let(:error) { Aws::CognitoIdentityProvider::Errors::InvalidParameterException } - it 'redirects to the new password page' do - expect(response).to redirect_to facilities_management_rm6232_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end context 'and the error is ServiceError' do let(:error) { Aws::CognitoIdentityProvider::Errors::ServiceError } - it 'redirects to the new password page' do - expect(response).to redirect_to facilities_management_rm6232_new_user_password_path + it 'renders the new page' do + expect(response).to render_template(:new) end end end @@ -99,7 +99,7 @@ include_context 'and RM6232 has expired' it 'renders the unrecognised framework page with the right http status' do - post :create, params: { email: 'test@test.com' } + post :create, params: { cognito_forgot_password: { email: 'test@test.com' } } expect(response).to render_template('home/unrecognised_framework') expect(response).to have_http_status(:bad_request) @@ -144,7 +144,7 @@ allow_any_instance_of(Cognito::ConfirmPasswordReset).to receive(:create_user_if_needed).and_return(true) allow_any_instance_of(Cognito::ConfirmPasswordReset).to receive(:confirm_forgot_password).and_return(true) # rubocop:enable RSpec/AnyInstance - put :update, params: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: password, password_confirmation: password, confirmation_code: '123456' } } cookies.update(response.cookies) end @@ -177,7 +177,7 @@ include_context 'and RM6232 has expired' it 'renders the unrecognised framework page with the right http status' do - put :update, params: { email: 'test@test.com', password: 'Password12345!', password_confirmation: 'Password12345', confirmation_code: '123456' } + put :update, params: { cognito_confirm_password_reset: { email: 'test@test.com', password: 'Password12345!', password_confirmation: 'Password12345', confirmation_code: '123456' } } expect(response).to render_template('home/unrecognised_framework') expect(response).to have_http_status(:bad_request) diff --git a/spec/controllers/facilities_management/rm6232/users_controller_spec.rb b/spec/controllers/facilities_management/rm6232/users_controller_spec.rb index fe0438d56a..d9d6176084 100644 --- a/spec/controllers/facilities_management/rm6232/users_controller_spec.rb +++ b/spec/controllers/facilities_management/rm6232/users_controller_spec.rb @@ -37,7 +37,7 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ConfirmSignUp).to receive(:confirm_sign_up).and_return(true) # rubocop:enable RSpec/AnyInstance - post :confirm, params: { email: user_email, confirmation_code: confirmation_code } + post :confirm, params: { cognito_confirm_sign_up: { email: user_email, confirmation_code: confirmation_code } } cookies.update(response.cookies) end @@ -70,7 +70,7 @@ # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cognito::ConfirmSignUp).to receive(:confirm_sign_up).and_raise(error.new('Some context', 'Some message')) # rubocop:enable RSpec/AnyInstance - post :confirm, params: { email: user_email, confirmation_code: confirmation_code } + post :confirm, params: { cognito_confirm_sign_up: { email: user_email, confirmation_code: confirmation_code } } cookies.update(response.cookies) end @@ -105,7 +105,7 @@ include_context 'and RM6232 has expired' it 'renders the unrecognised framework page with the right http status' do - post :confirm, params: { email: user_email, confirmation_code: '123456' } + post :confirm, params: { cognito_confirm_sign_up: { email: user_email, confirmation_code: '123456' } } expect(response).to render_template('home/unrecognised_framework') expect(response).to have_http_status(:bad_request) @@ -119,7 +119,7 @@ context 'when the framework is live' do before do allow(Cognito::ResendConfirmationCode).to receive(:call).with(email).and_return(Cognito::ResendConfirmationCode.new(email)) - post :resend_confirmation_email, params: { email: } + post :resend_confirmation_email, params: { cognito_confirm_sign_up: { email: } } end it 'redirects to facilities_management_rm6232_users_confirm_path' do @@ -131,7 +131,7 @@ include_context 'and RM6232 has expired' it 'renders the unrecognised framework page with the right http status' do - post :resend_confirmation_email, params: { email: } + post :resend_confirmation_email, params: { cognito_confirm_sign_up: { email: } } expect(response).to render_template('home/unrecognised_framework') expect(response).to have_http_status(:bad_request) @@ -204,7 +204,7 @@ allow(aws_client).to receive(:respond_to_auth_challenge).and_return(respond_to_auth_challenge_resp_struct.new(challenge_name: new_challenge_name, session: new_session)) allow(Cognito::CreateUserFromCognito).to receive(:call).and_return(admin_create_user_resp_struct.new(user:)) - post :challenge, params: { challenge_name: challenge_name, username: username, session: session, new_password: password, new_password_confirmation: password } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username: username, session: session, new_password: password, new_password_confirmation: password } } cookies.update(response.cookies) end @@ -258,7 +258,7 @@ allow(aws_client).to receive(:respond_to_auth_challenge).and_return(respond_to_auth_challenge_resp_struct.new) allow(Cognito::CreateUserFromCognito).to receive(:call).and_return(admin_create_user_resp_struct.new(user:)) - post :challenge, params: { challenge_name:, username:, session:, access_code: } + post :challenge, params: { challenge_name: challenge_name, cognito_respond_to_challenge: { username:, session:, access_code: } } cookies.update(response.cookies) end @@ -292,7 +292,7 @@ include_context 'and RM6232 has expired' it 'renders the unrecognised framework page with the right http status' do - post :challenge, params: { challenge_name: 'SMS_MFA', username: username, session: session } + post :challenge, params: { challenge_name: 'SMS_MFA', cognito_respond_to_challenge: { username:, session: } } expect(response).to render_template('home/unrecognised_framework') expect(response).to have_http_status(:bad_request) diff --git a/spec/services/cognito/forgot_password_spec.rb b/spec/services/cognito/forgot_password_spec.rb index fe495b135f..a620b2fb83 100644 --- a/spec/services/cognito/forgot_password_spec.rb +++ b/spec/services/cognito/forgot_password_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Cognito::ForgotPassword do let(:email) { 'test@email.com' } - let(:email_upercase) { 'Test@Email.com' } + let(:email_uppercase) { 'Test@Email.com' } let(:invalid_email_char) { '@!"£$£"' } let(:invalid_email) { 'someRandomString' } let(:aws_client) { instance_double(Aws::CognitoIdentityProvider::Client) } @@ -64,8 +64,8 @@ end end - context 'when success with an upercase email' do - let(:email) { email_upercase } + context 'when success with an uppercase email' do + let(:email) { email_uppercase } include_context 'with cognito structs' @@ -80,7 +80,7 @@ end it 'returns no error' do - expect(response.error).to be_nil + expect(response.errors).to be_empty end end @@ -92,7 +92,7 @@ end it 'does returns cognito error' do - expect(response.error).to eq 'Oops' + expect(response.errors[:base].first).to eq 'Oops' end end @@ -104,31 +104,31 @@ end it 'does returns cognito error' do - expect(response.error).to be_nil + expect(response.errors).to be_empty end end context 'when user enter invalid_email_char' do - let(:email) { invalid_email_char } + let(:email) { '@!"£$£"' } it 'does not return success' do expect(response.success?).to be false end it 'does returns cognito error' do - expect(response.error).to eq 'Enter your email address in the correct format, like name@example.com' + expect(response.errors[:email].first).to eq 'Enter your email address in the correct format, like name@example.com' end end context 'when user enter invalid_email' do - let(:email) { invalid_email } + let(:email) { 'someRandomString' } it 'does not return success' do expect(response.success?).to be false end it 'does returns cognito error' do - expect(response.error).to eq 'Enter your email address in the correct format, like name@example.com' + expect(response.errors[:email].first).to eq 'Enter your email address in the correct format, like name@example.com' end end end diff --git a/spec/services/cognito/sign_in_user_spec.rb b/spec/services/cognito/sign_in_user_spec.rb index 667a77aa44..d039ca387d 100644 --- a/spec/services/cognito/sign_in_user_spec.rb +++ b/spec/services/cognito/sign_in_user_spec.rb @@ -103,7 +103,7 @@ end it 'does returns cognito error' do - expect(sign_in_user.error).to eq I18n.t('facilities_management.users.sign_in_error') + expect(sign_in_user.errors[:base].first).to eq 'You must provide a correct username or password' end end @@ -118,7 +118,7 @@ end it 'does returns cognito error' do - expect(sign_in_user.error).to eq 'Oops' + expect(sign_in_user.errors[:base].first).to eq 'Oops' end it 'returns needs_confirmation true' do @@ -137,7 +137,7 @@ end it 'does returns cognito error' do - expect(sign_in_user.error).to eq 'Oops' + expect(sign_in_user.errors[:base].first).to eq 'Oops' end it 'returns need_password_reset true' do @@ -156,7 +156,7 @@ end it 'does returns cognito error' do - expect(sign_in_user.error).to eq I18n.t('facilities_management.users.sign_in_error') + expect(sign_in_user.errors[:base].first).to eq 'You must provide a correct username or password' end it 'returns need_password_reset false' do