diff --git a/app/assets/images/envelope-1st-class.png b/app/assets/images/envelope-1st-class.png new file mode 100644 index 000000000..71f09948f Binary files /dev/null and b/app/assets/images/envelope-1st-class.png differ diff --git a/app/assets/images/envelope-1st-class.svg b/app/assets/images/envelope-1st-class.svg new file mode 100644 index 000000000..ce91bb30a --- /dev/null +++ b/app/assets/images/envelope-1st-class.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/envelope-2nd-class.png b/app/assets/images/envelope-2nd-class.png new file mode 100644 index 000000000..adba7ecc9 Binary files /dev/null and b/app/assets/images/envelope-2nd-class.png differ diff --git a/app/assets/images/envelope-2nd-class.svg b/app/assets/images/envelope-2nd-class.svg new file mode 100644 index 000000000..ec54d710b --- /dev/null +++ b/app/assets/images/envelope-2nd-class.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/app/assets/stylesheets/components/letter.scss b/app/assets/stylesheets/components/letter.scss index 61cc2f28b..1e50953d3 100644 --- a/app/assets/stylesheets/components/letter.scss +++ b/app/assets/stylesheets/components/letter.scss @@ -38,6 +38,52 @@ $iso-paper-ratio: 141.42135624%; box-shadow: inset 0 0 0 1px $border-colour; } + &-postage { + + $art-width: 97.83; + $art-height: 82.27; + $fold-height: 124px; + $envelope-colour: #C4B186; + + position: absolute; + top: 0; + right: 0; + z-index: 10; + width: $fold-height * ($art-width / $art-height); + height: $fold-height; + margin: 0; + background-color: mix($envelope-colour, $grey-1); + background-size: auto $fold-height; + background-position: right 0; + background-repeat: no-repeat; + background-origin: border-box; + text-indent: -1000em; + border-bottom: 1px solid $border-colour; + border-left: 1px solid $border-colour; + box-shadow: 0 2px 0 0 rgba($border-colour, 0.2); + + &-first { + + background-image: file-url('envelope-1st-class.svg'); + + @include ie-lte(8) { + background-image: file-url('envelope-1st-class.png'); + } + + } + + &-second { + + background-image: file-url('envelope-2nd-class.svg'); + + @include ie-lte(8) { + background-image: file-url('envelope-2nd-class.png'); + } + + } + + } + img { display: block; width: 100%; diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index a4841d970..3e031c632 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -70,6 +70,9 @@ def view_notification(service_id, notification_id): else: page_count = get_page_count_for_letter(notification['template'], values=personalisation) + if notification.get('postage'): + notification['template']['postage'] = notification['postage'] + template = get_template( notification['template'], current_service, diff --git a/app/utils.py b/app/utils.py index 6a7bb02e8..d2efab1a7 100644 --- a/app/utils.py +++ b/app/utils.py @@ -331,7 +331,8 @@ def get_template( template, image_url=letter_preview_url, page_count=int(page_count), - contact_block=template['reply_to_text'] + contact_block=template['reply_to_text'], + postage=template.get('postage') or service.postage, ) else: return LetterPreviewTemplate( diff --git a/requirements-app.txt b/requirements-app.txt index 80af0678e..9b9dcf302 100644 --- a/requirements-app.txt +++ b/requirements-app.txt @@ -23,4 +23,4 @@ awscli-cwlogs>=1.4,<1.5 # Putting upgrade on hold due to v1.0.0 using sha512 instead of sha1 by default itsdangerous==0.24 # pyup: <1.0.0 -git+https://github.com/alphagov/notifications-utils.git@30.7.5#egg=notifications-utils==30.7.5 +git+https://github.com/alphagov/notifications-utils.git@31.0.0#egg=notifications-utils==31.0.0 diff --git a/requirements.txt b/requirements.txt index 82ed99091..5f997fece 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,13 +25,13 @@ awscli-cwlogs>=1.4,<1.5 # Putting upgrade on hold due to v1.0.0 using sha512 instead of sha1 by default itsdangerous==0.24 # pyup: <1.0.0 -git+https://github.com/alphagov/notifications-utils.git@30.7.5#egg=notifications-utils==30.7.5 +git+https://github.com/alphagov/notifications-utils.git@31.0.0#egg=notifications-utils==31.0.0 ## The following requirements were added by pip freeze: -awscli==1.16.96 +awscli==1.16.97 bleach==3.0.2 boto3==1.6.16 -botocore==1.12.86 +botocore==1.12.87 certifi==2018.11.29 chardet==3.0.4 Click==7.0 @@ -59,7 +59,7 @@ pyasn1==0.4.5 pyexcel-ezodf==0.3.4 PyJWT==1.7.1 PyPDF2==1.26.0 -python-dateutil==2.7.5 +python-dateutil==2.8.0 python-json-logger==0.1.10 PyYAML==3.12 redis==3.1.0