Commit Graph

7645 Commits

Author SHA1 Message Date
karlchillmaid
0794792a6b Update letter price 2021-02-01 08:11:51 +00:00
karlchillmaid
a46fa22bd2 Update letter prices 2021-02-01 08:11:51 +00:00
Chris Hill-Scott
f34cd4a6b5 Merge pull request #3780 from alphagov/show-areas-not-in-library
Display areas that aren’t in the library
2021-01-28 10:21:12 +00:00
Tom Byers
0459cbe24f Merge pull request #3768 from alphagov/add-govuk-radios-6
Add GOVUK radios [part 6]
2021-01-27 14:54:30 +00:00
Chris Hill-Scott
926ada2f21 Check that all areas are in the library
We should assume to start with that areas come either from the library
or from the JSON, and not a combination of the two.
2021-01-27 14:32:35 +00:00
Chris Hill-Scott
5ae53b625b Show broadcasts created by the API
Broadcasts created by the API are different in that:
- they aren’t created by any user, so don’t have a `created_by_id`
- they are created instantly, not in steps, so don’t have an
  `updated_at` time

This commit alters the views to account for when these pieces of
information aren’t present.
2021-01-27 11:34:43 +00:00
Tom Byers
e013fbb9b3 Merge pull request #3770 from alphagov/fix-extend-params-bug
Fix bug with extend_params function
2021-01-27 10:52:51 +00:00
Tom Byers
3e39e6f019 Remove unused radio imports
The following were added without the macro ever
being called:
- app/templates/views/add-service-local.html
  (added in
  e6f49825e5)
- app/templates/views/service-settings/data-retention/edit.html
  (added in
  4b8b571a87)
- app/templates/views/organisations/organisation/settings/edit-domains.html
  (added in
  936883bf7b)

The following were used when they were first added
but not removed when the macro stopped being used:
- app/templates/views/edit-letter-template.html
  (macro removed in
  20ae200de9)
- app/templates/views/organisations/organisation/settings/edit-agreement.html
  (macro removed in
  45526598c6)
2021-01-27 10:52:24 +00:00
Tom Byers
513fbff6e0 Convert radios on set-template-sender page
Includes making the legend the h1 for the page to
follow design system guidance:

https://design-system.service.gov.uk/get-started/labels-legends-headings/
2021-01-27 10:52:24 +00:00
Tom Byers
ece956e324 Convert radios on set-sender page
Includes making the legend the page header to
follow design system guidance:

https://design-system.service.gov.uk/get-started/labels-legends-headings/

I had to add some override styles to allow the
legend to classes as a full-width column, and the
radios to be in one that is three-quarters.
2021-01-27 10:52:24 +00:00
Tom Byers
f6cef24617 Convert create API key radios to GOVUK Frontend 2021-01-27 10:52:24 +00:00
David McDonald
8e3aeea9a0 Merge pull request #3775 from alphagov/set-sender-bug
Fix bug with incorrect redirect to send_one_off
2021-01-26 13:54:18 +00:00
Tom Byers
67392e97ee Fix issue with looping in list merging
The last_dest_idx variable should always have been
tracking the last index in the source list. The
original intention, implemented incorrectly, was
to just append any items which source has no item
at that index.
2021-01-26 12:16:08 +00:00
Tom Byers
73afee8a12 Merge pull request #3771 from alphagov/fix-all-radios-forms-with-duplicate-legends
Fix all radios forms with duplicate legends
2021-01-26 10:57:39 +00:00
Chris Hill-Scott
60aa2d2b42 Display areas that aren’t in the library 2021-01-26 10:49:47 +00:00
Rebecca Law
01a3df6edc Update _delete_template_cache_for_service to delete all template version cache and not just the one ending in "None"
Update all methods that were previous calling @cache.delete('service-{service-id}-template-None') to instead call _delete_template_cache_for_service
Remove call to get service templates, it's not needed since all template version cache is being deleted.
2021-01-25 16:28:20 +00:00
David McDonald
9e477011d3 Fix bug with incorrect redirect to send_one_off
If a user has only send_message permissions, when they click on a
template name they are currently taken to the `send_one_off` page. This
is incorrect as if there is more than one SMS sender or email reply to
address, then they should pick the address they wish to use.

This commit fixes that bug by redirecting them to the `set_sender`
route. Note, if there is only one sender then the `set_sender` will
redirect the user on to the `send_one_off` route.

https://www.pivotaltracker.com/story/show/176541486
2021-01-22 18:34:30 +00:00
Tom Byers
1059cf4d81 Remove extend_params in favour of merge_jsonlike
A comment on the pull request for this branch
pointed out that it's not clear why the 'items'
list is deleted and then reassigned in
extend_params:

https://github.com/alphagov/notifications-admin/pull/3770#pullrequestreview-573067465

The simple reason is that we want to use
merge_jsonlike to merge params and
param_extensions (passed in as extensions) but
merge_jsonlike doesn't merge lists correctly.

I realised that if we just make merge_jsonlike
merge lists correctly, we can use it for
everything extend_params does.

This commit does that, and replaces all calls to
extend_params with merge_jsonlike.

Because extend_params is used across many form
field classes, and so many pages, I took the
following precautions after making those changes:
1. found every use of param_extensions
2. looked at the merges onto params that each would
   cause and deduped them to a final list of 6(!)
3. tested pages containing fields from that list
4. added new testcases to the merge_jsonlike tests
   for any merges that exist in our codebase but
   not in our tests
2021-01-22 15:40:28 +00:00
Tom Byers
23d391e3fc Change how merge_jsonlike treats lists
Current behaviour is to check item-against-item
and merge based on whether items match, irrelevant
of position. This doesn't produce the results we
need for our usecases (merging data to send to
GOVUK Frontend components).

We actually want:
- items to be compared based on their position
- new primitive items at the same position to
  overwrite existing ones
- dicts or lists at the same position to be merged

For example,

Starting with this list:

[{"name": "option-1", "value": "1"}]

Merging in this list:

[{"hint": {"text": "Choose one option"}}]

You currently get this:

[
  {"name": "option-1", "value": "1"},
  {"hint": {"text": "Choose one option"}}
]

We want to get this:

[
  {
    "name": "option-1", "value": "1",
    "hint": {"text": "Choose one option"}
  }
]
2021-01-21 21:15:51 +00:00
Pea Tyczynska
e2ecff050d Merge pull request #3772 from alphagov/add-service-notes
Add service notes
2021-01-20 17:19:22 +00:00
Chris Hill-Scott
87a12b8e3b Merge pull request #3751 from alphagov/new-alert
Let users create an emergency alert without a template
2021-01-20 16:37:00 +00:00
Tom Byers
99146f5298 Extra for set-inbound-number 2021-01-20 16:29:51 +00:00
Tom Byers
8974ffb43d Stop legend duplication on disable-platform-admin 2021-01-20 16:29:51 +00:00
Chris Hill-Scott
506e8cc773 Add extra space between back link and legend
Co-authored-by: Tom Byers <tombaromba@gmail.com>
2021-01-20 16:15:40 +00:00
Tom Byers
863433c127 Stop legend duplication on set-inbound-number 2021-01-20 16:10:37 +00:00
Chris Hill-Scott
066aca4673 Use legend as H1
…seeing as the radios are the only control in the form.

Follows the pattern in
https://github.com/alphagov/notifications-admin/pull/3771/files
2021-01-20 15:43:58 +00:00
Chris Hill-Scott
8e7ff4c71f Merge two consecutive two-thirds columns 2021-01-20 15:32:51 +00:00
Tom Byers
ba6b4682c3 Add comments to JS and improve selector in test
After talking with the reviewer, it was decided
that:
1. the JS could do with some comments to explain
   its structure and what various functions do
   better
2. some CSS selectors in the tests don't need to
   be as complex and simplifying them makes the
   test easier to read
2021-01-20 11:23:01 +00:00
Chris Hill-Scott
db4d9f886c Display broadcasts without a template
At the moment the admin app expects all broadcasts to have a template,
and expects the content of the alert to come from the template.

This commit makes it so those pages can still get a `Template` instance,
but populated with content straight from the `content` field in the
database.
2021-01-20 11:18:13 +00:00
Pea Tyczynska
5eb6ac2311 Add test for textarea
Also remove redundant error handling - if unexpected error happens,
it will be handled at the app level.
2021-01-19 18:25:52 +00:00
Pea Tyczynska
5ec49fc976 Refactor form instantiation
Form can be pre-filled with existing data upon instantiation.
WTForms will know not to do this on POST request.

Co-authored-by: Chris Hill-Scott <me@quis.cc>
2021-01-19 18:24:56 +00:00
Tom Byers
9651da1292 Improve focus control of radioSelect
Makes focus shift to the first time in the range
when you select a day.

Also rewrites the code for controlling focus so it
explains itself better, now it has different
settings.
2021-01-19 14:14:37 +00:00
Tom Byers
e7291ffd51 Add expanded semantics to radioSelect buttons
All buttons that open or close a region of the
component should have aria-expanded attributes to
show:
- they have that control
- the state of the region
2021-01-19 14:14:37 +00:00
Chris Hill-Scott
74243a88fb Remove prompt from dashboard
It’s no longer true to say that you need a template to create an alert.
The grey button should be the primary call to action on this page
instead.
2021-01-18 17:09:01 +00:00
Chris Hill-Scott
8f2dc72881 Add the new alert button to previous alerts page
Feels like it should behave the same way as the current alerts page.
2021-01-18 17:09:01 +00:00
Chris Hill-Scott
99b7d8a66f Add flow for composing an alert without a template
We think that in some cases alerts will be composed in the moment, and
therefore making people first create a template is:
- not a good use of their time
- adding some conceptual complexity which they don’t need

This commit makes it possible to type some words and have them go
straight into the `content` field in the database.

In the future we might want to progressively enhance the radio buttons
so they show on the same page (like we do with the grey buttons on the
templates page).
2021-01-18 17:09:01 +00:00
Pea Tyczynska
341933478b Succesfully update service notes 2021-01-15 15:38:39 +00:00
Pea Tyczynska
6d7b16fd59 View edit service notes page 2021-01-15 13:36:12 +00:00
Tom Byers
e06c1f5daa Fix bug with extend_params function
The OrganisationAgreementSignedForm class has a
bug causing it to render different HTML when the
page loads to when you subsequently refresh it.

This commit proposes a change to the extend_params
function to fix it.

extend_params, is used by the
OrganisationAgreementSignedForm, as well as all
the other WTForms field classes we added to wrap
GOVUK Frontend components. Fixing it should
therefore fix any similar bugs with them.

All of these fields send a dict of configuration
data to the GOVUK Frontend component when they
call it, at render time. This dict is 'JSON-like',
meaning it's values can be all the primitives as
well as lists and dicts. This also means it can go
quite deep.

Extending the default configuration

The classes have a default dict of this data kept
privately in the params variable. They let you
change it by passing in an argument called
param_extensions on instantiation, after that,
through an attribute of the same name and at
render time as the same argument (in templates).

The extend_params function

The param_extensions dict is used as a collection
of changes to make to the default params dict.
The changes are applied by the extend_params
function. Its code deletes part of the
param_extensions, a side effect that didn't seem a
problem because it isn't used after the function
has run.

The bug

The bug was only with the part of the HTML that
got its data from the part of the param_extensions
dict that was deleted by extend_params. The class
with the bug set param_extensions when the field
is instantiated, as part of its parent form
definition.

My guess is that param_extensions was stored in
memory, as part of the form class, and reused
when the page refreshed. At that point,
extend_params had deleted part of its data,
causing the bug.
2021-01-15 09:59:32 +00:00
Pea Tyczynska
5818942908 'Change' link links to edit_service_notes 2021-01-14 18:00:44 +00:00
Tom Byers
a6e4022ce7 Fix typo in status page issue
Co-authored-by: karlchillmaid <karl.chillmaid@digital.cabinet-office.gov.uk>
2021-01-14 14:03:57 +00:00
Tom Byers
900c2b9f8c Bump updated date to be today 2021-01-14 11:55:50 +00:00
Tom Byers
181b45c319 Update issue with moving templates/folders 2021-01-14 10:17:47 +00:00
Pea Tyczynska
89b3f6ace2 Display notes section in Service Settings 2021-01-13 18:48:20 +00:00
Chris Hill-Scott
2bdd86c044 Remove logging of session size
There’s no record of this warning in our logs at the moment.
2021-01-13 13:11:58 +00:00
Rebecca Law
9058edca90 Merge pull request #3767 from alphagov/clear-org-cache
Clear the organisation cache when a service's organisation is changed.
2021-01-13 09:22:23 +00:00
Rebecca Law
c36180741b Clear the organisation cache when a service's organisation is changed.
The /organisations page was showing the wrong live services count after a change is made to the service organisation.
2021-01-12 13:45:28 +00:00
karlchillmaid
0dd107b2b8 Update support page content 2021-01-11 13:05:00 +00:00
Chris Hill-Scott
287689c1b3 Merge pull request #3763 from alphagov/count-chars-sms-broadcast-templates
Add fragment or character counting when editing text message or broadcast templates
2021-01-08 16:38:03 +00:00
Chris Hill-Scott
43e57b7089 Handle textbox without existing aria-described-by
jQuery.attr returns `undefined` if an element does not have an
attribute. We want an empty string, rather than the default of coercing
`undefined` to the string `'undefined'`.
2021-01-08 16:05:55 +00:00