Commit Graph

2259 Commits

Author SHA1 Message Date
Chris Hill-Scott
bc6b9c7af7 Use named arguments for clearer string formatting
Helps when the string is long.

Also helps disambiguate between the CDN domain used for the logos and
those for CSS/JS.
2018-11-29 11:56:01 +00:00
Chris Hill-Scott
fe6610c221 Fix content security policy for the CDN
The CDN URLs aren’t in included in the content security policy. So
browsers will refuse to load them.

This commit:
- adds each of the CDN URLs to the
- only prepend URLs in CSS files with `/static/` if we’re running
  locally (because the CDN URLs are like `static.example.com` not
  `example.com/static`)
2018-11-29 11:29:52 +00:00
Leo Hemsted
d07de58cd9 split out new folder into two separate forms
move_to_new_folder and add_new_folder are now two separate html fields
and form items - so that we can more easily manipulate them on the
front end
2018-11-28 14:14:20 +00:00
Leo Hemsted
6743bd11fa moved existing template folder tests into test_template_folders
also refactored slightly to work with new html, and separate succesful
and bad-permissions test cases
2018-11-28 14:14:20 +00:00
Chris Hill-Scott
0000ca6629 Merge pull request #2535 from alphagov/launch-first-class
Launch first class postage feature
2018-11-26 16:33:21 +00:00
Chris Hill-Scott
84a3c80eb4 Launch first class postage feature
This commit makes it available to everyone. Available just means they
can select 1st class for all their letters, if they want it.
2018-11-26 15:53:14 +00:00
Pea Tyczynska
6d00e1dfcb Test Data available message for jobs with flexible data retention 2018-11-26 15:28:09 +00:00
Pea Tyczynska
9d8e602ac8 time_left considers flexible data retention periods
Also update tests
2018-11-26 15:15:06 +00:00
Chris Hill-Scott
ee991d0142 Allow any sub-items to be moved from a folder
Since you can now see them when searching you should also be able to
select and move them. Which means that they needed to be included in
the `Form`’s list of possible choices of things to move.
2018-11-23 16:29:21 +00:00
Chris Hill-Scott
cdb03d1eeb Only live search on template or folder name
If you have a folder structure like this:

> FA / FB / FC

and you search for ‘FA’, it’s very noisy to see:

> FA / FB
> FA / FB / T1
> FA / FB / T2
> FA / FB / FC
> FA / FB / FC / T3
> …

It’s clearer to just show:

> FA / FB

This also has the benefit of, if you type ‘template’ (for example) you
don’t get every item any more, because it’s only looking at the name of
the thing. It used to look at the entire description, ie:

> A / B / C / Example
> Text message template

Now it only searches on the name:

> A / B / C / *Example*
> Text message template
2018-11-23 14:39:45 +00:00
Chris Hill-Scott
28ef6910a3 Hide templates and folders not at current level
Things in subfolders need to be in the page so we can search for them.
But the default view should be only the things are the current level.
So we can use CSS to hide items that are below the current level.
2018-11-23 14:34:25 +00:00
Chris Hill-Scott
148492a635 Put all nested items on page
So that the live search can filter things, they need to be on the page
when it loads. We want to make search work across folders, so all the
things in subfolders need to be in the page.

They also need the full path appending to them, so that you can tell
which ones are in which folders.

This won’t show items that are in a folder above the one you’re
currently in – my reckon is that when you’re narrowing down by clicking
into a folder that you only want to search for things in that folder.
2018-11-23 14:31:05 +00:00
Chris Hill-Scott
82d8207612 Refactor template list logic into one place
The Jinja template for the ‘choose templates’ page is now pulling in
data from a lot of diparate places in order to work out what to show. As
we add more logic about what to show (in order to make the live search
work) it’s going to get harder to have all this logic in the Jinja
template.

This commit refactors it back into Python where we have more language
features for managing complex logic.

It’s a bit weird to call this file a model, in that it’s dealing with
some presentational logic, rather than just data. Conceptually it’s more
like a view model[1].

1. https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel
2018-11-23 14:00:40 +00:00
Chris Hill-Scott
741a8856fa Remove the word ‘printable’
Don’t think it’s necessary. Makes things consistent with the sent letter
page, which only says ‘Download as a PDF’.

This inconsistency would be more glaring now these pieces of text appear
in the same place, in adjacent steps of a journey.
2018-11-22 12:36:29 +00:00
Chris Hill-Scott
5d13c639b1 Fix logic around showing search box
It was looking at the count of items at the root level (because it was
passing `parent_folder_id=None` as an argument).

This changes it to look at the total count of items for a service (which
was the intended behaviour).
2018-11-20 16:12:50 +00:00
Chris Hill-Scott
8f2547b7a7 Merge pull request #2518 from alphagov/delete-folder-refinements
Make some refinements to the delete folder journey
2018-11-20 14:53:05 +00:00
Chris Hill-Scott
c52dc8e972 Merge pull request #2488 from alphagov/copy-template-name
Put ‘copy’ at end of new template name
2018-11-20 14:14:09 +00:00
Chris Hill-Scott
65389b0bb5 Merge pull request #2513 from alphagov/empty-folder-message
Improve the empty folder state
2018-11-20 13:50:53 +00:00
Chris Hill-Scott
4bb7519d9e Refine empty folder message
If the folder is completely empty, always say ‘This folder is empty’, so
we don’t suggest that you can click around and find other things.

If the current view is filtered, but there are templates available in
other filters, say ‘There are no text message templates in this folder’
to make it clear why you can’t see anything.
2018-11-20 12:29:39 +00:00
Chris Hill-Scott
32c36bf70b Make the empty folder state more useful
Currently if there’s nothing in a folder you just get an empty page.
This looks a bit broken, or like the page hasn’t finished loading.

This commit adds a message to the page to show that it’s intentionally
blank.

The message is contextual based on type of template, because there might
be templates in the current folder, even if you can’t see them at the
moment (because you’re filtering).
2018-11-20 12:29:38 +00:00
Chris Hill-Scott
77529f4191 Redirect to parent after deleting a folder
You lose your place if, after deleting something that’s deeply nested,
you return to the root level.
2018-11-20 11:31:31 +00:00
Chris Hill-Scott
13a962b6bd Don’t hide the rename form on delete
It’s weird that this page changes when you click delete – it looks like
you’re going to a different page.

It should feel like you’re on the same page, just with the confirmation
message.

The problem we had before is that the rename form would `POST` to
`…/delete`, which would then delete the template instead of updating
its name.

We can fix this by explicitly setting the `action` attribute on the
rename form to always post to `…/manage`, even if the user is currently
looking at the `…/delete` page.
2018-11-20 11:27:19 +00:00
Leo Hemsted
fda10c81a7 Merge pull request #2494 from alphagov/bump-reqs
bump reqs
2018-11-20 11:06:08 +00:00
Rebecca Law
ad129e92dd Merge pull request #2507 from alphagov/delete-letter-job-page
Delete letter job page
2018-11-20 09:57:52 +00:00
Rebecca Law
28b9adf4e0 Merge pull request #2510 from alphagov/fix-user-with-no-permissions
Fix the permission check for users without permissions.
2018-11-19 17:06:33 +00:00
Chris Hill-Scott
da80dfb6f3 Fix missing ‘no templates’ message
This got broken because `template_folder_path` is never an empty list
any more (it always contains at least one item, _Templates_, which is
the root).
2018-11-19 15:55:57 +00:00
Rebecca Law
dd22fa06a4 Fix the permission check for users without permissions.
A users without permissions should be redirected to choose-templates page when signing in.
2018-11-19 15:26:43 +00:00
Chris Hill-Scott
738043c5c4 Show path on template and manage folder pages
So the page headings stay consistent as you click around, and make it
easy to get back where you came from.
2018-11-19 11:28:35 +00:00
Chris Hill-Scott
d49622c5dc Style folder hierarchy in headings
This makes the display of folders in the `<h1>` look like the prototype.

It alters the behaviour we’ve initially built here by only ever showing
a maximum of two levels of hierarchy (the current folders and its
parent).
2018-11-19 10:50:03 +00:00
Pea (Malgorzata Tyczynska)
754ae743ca Merge pull request #2506 from alphagov/fix_delete_folder_button_breadcrumb
Fix breadcrumbs on manage_template_folder page
2018-11-19 10:49:28 +00:00
Pea (Malgorzata Tyczynska)
2b040afe00 Merge pull request #2501 from alphagov/update_confirm_delete_messages
Make deletion confirmation banner messages consistent across our app
2018-11-19 10:37:48 +00:00
Pea Tyczynska
87c92e093b Update confirmation messages for delete sms-sender and delete reply-to-email 2018-11-16 17:05:59 +00:00
Pea Tyczynska
9953229c54 Test that delete folder endpoint detects non-empty folders 2018-11-16 15:59:23 +00:00
Pea Tyczynska
69ada9a312 Hide name changing functionality when in folder deletion mode
Also add 'back' link
Also start work on additional tests for folder deletion flow
2018-11-16 15:58:18 +00:00
Rebecca Law
924e3aa6da Merge branch 'master' into delete-letter-job-page 2018-11-16 15:32:51 +00:00
Pea Tyczynska
7f4580cb82 Update content following review 2018-11-16 15:15:40 +00:00
Pea Tyczynska
a43e6a8885 Make deletion confirmation banner messages consistent across our app
Also introduce a way to provide context to a banner / flash message
that will be displayed in plain font style.
2018-11-16 11:05:52 +00:00
Rebecca Law
f788aab998 Remove letter jobs page
When we first built letters you could only send them via a CSV upload, initially we needed a way to send those files to dvla per job.
We since stopped using this page. So let's delete it!
2018-11-15 17:17:45 +00:00
Chris Hill-Scott
f3d1dc4a9c Don’t ask for data retention unless channel is known
If the user is looking at the notifications page for all message types
(which is what we show ‘caseworkers’) then it doesn’t make sense to ask
the API for the data retention period for that message type (because
it will be `None`). Doing so causes the API to return a `404`, which
then causes the admin app to return `404`.

Passing through `None` as the value of limit days will just cause the
API to return everything in the `notifications` table, which is fine
for us.
2018-11-15 17:17:10 +00:00
Chris Hill-Scott
be9fb99247 Redirect signed-in users to their service
Some users are bookmarking the sign in page for quick access to their
Notify service.

If they’re already signed in when they used this bookmark they get
redirected. However the redirect isn’t very smart, because it just takes
them to their list of services. This isn’t great if they only have one
service.

This commit redirects them to the `show_accounts_or_dashboard` endpoint
instead, which does the work to figure out which page is most useful
to show someone when they sign in.

Also changing this for `/register`, although it’s less likely that
someone will have bookmarked this page.
2018-11-15 16:01:59 +00:00
Pea Tyczynska
2a1328a17e Check if folder is empty before calling the api 2018-11-15 10:51:44 +00:00
Pea Tyczynska
d61022e3e6 Add flash messages and error handling to delete folder flow 2018-11-15 10:51:44 +00:00
Pea Tyczynska
91d309816b Build delete folder endpoint that calls template_folders_api_client 2018-11-15 10:51:44 +00:00
Pea Tyczynska
b5c78dc552 Add delete_folder method to template folder api client 2018-11-15 10:51:44 +00:00
Pea Tyczynska
4520065af4 Add a delete folder link to manage folder page and basic delete
endpoint
2018-11-15 10:51:44 +00:00
Leo Hemsted
3551d36f32 bump reqs 2018-11-14 13:35:24 +00:00
Chris Hill-Scott
7f171ba4ea Merge pull request #2462 from alphagov/api-key-sort-order
Sort API keys alphabetically
2018-11-14 10:13:36 +00:00
Chris Hill-Scott
666381e23d Pre-populate rename folder form with current name
Often people will be editing the existing name, not changing it
completely.

This matches what we do when someone wants to rename their template or
service.
2018-11-13 16:05:05 +00:00
Chris Hill-Scott
0888bdf5d4 Put ‘copy’ at end of new template name
In multiple user research sessions we’ve noticed people edit the
auto-generated template name to put something at the end of it.

This is fiddly because of the quotes we put around the name:
> Copy of ‘Exiting template’

It also means that if they keep our prefix then the template doesn’t
sort alongside the one it’s replacing.

This commit changes the name of copied templates to better match the
behaviour our users are showing.

Also adds a bit of auto numbering, just as a nice detail.
2018-11-13 15:25:02 +00:00
Chris Hill-Scott
538e090170 Merge pull request #2481 from alphagov/label-folders
Label and filter folders depending on their contents
2018-11-13 14:10:00 +00:00