Commit Graph

168 Commits

Author SHA1 Message Date
Chris Hill-Scott
61b8e10fc0 Merge pull request #2765 from alphagov/folder-after-delete-template
Return to a template’s folder after deleting it
2019-02-18 13:22:27 +00:00
Katie Smith
862d077f66 Removed links to add_template_by_type_endpoint
The endpoint was removed, but was still linked to in a couple of
places. Some old links were no longer needed, so have been removed.

We do still need a link to `add_template_by_type` on the 'Choose reply'
page - this page is used to allow to let someone pick a template to
reply to inbound SMS with. Since the link only appears if they have no
SMS templates, we now link to `.choose_template` with the templates and
folders form already opened at the option to add a template.
2019-02-15 08:06:06 +00:00
Chris Hill-Scott
a7b090d287 Return to a template’s folder after deleting it
It’s disconcerting going back to the root if a template is in a deeply
nested folder. Especially if you’re trying to delete multiple templates.
2019-02-14 10:32:50 +00:00
Chris Hill-Scott
b2ed3e01b4 Merge pull request #2752 from alphagov/remove-folder-flag
Remove code that is redundant now that all users have folders
2019-02-13 17:10:24 +00:00
Chris Hill-Scott
9bf92b2054 Only direct people to choosing a logo if they don’t have one
Once they have their logo set up people don’t typically need to change
it so we shouldn’t distract them with a button.
2019-02-13 15:12:36 +00:00
Chris Hill-Scott
7d7b790dc1 Remove add template as separate page
This has moved to the choose template page.
2019-02-11 17:55:58 +00:00
Chris Hill-Scott
3a5bfeb7aa Remove folders feature flag
Every service has this feature now[1] so we don’t need to check whether
or not it’s switched on any more.

1. https://github.com/alphagov/notifications-api/pull/2286
2019-02-11 17:55:57 +00:00
Tom Byers
d633bdbb6d Tidy up JS code for focusing & associated html
Makes sure the tabindex we add for focusing is
removed.

Also removes the outer fieldset from the radios
for new templates. We don't wrap form buttons in
fieldsets anywhere else and it doesn't add any
useful semantics to the form.
2019-02-11 15:24:09 +00:00
Chris Hill-Scott
e45024affd Say ‘Change’ not ‘Edit’ postage
To match the call to action on the template page.

Karl said:

> I feel good about it. You're not really editing it so much as choosing between 2 options. It feels more human.
>
> I think it only started out as edit to match all the other sections of the letter – it certainly wasn't given any real consideration.
2019-02-06 17:27:32 +00:00
Chris Hill-Scott
b98f73112d Remove existing display of postage
It’s redundant now we’re displaying it as part of the template.
2019-02-06 14:37:17 +00:00
Pea Tyczynska
64aff0ba05 Remove choose_postage feature flag so everyone can choose postage 2019-02-05 17:21:15 +00:00
Pea Tyczynska
20ae200de9 Remove choosing postage from edit template content flow 2019-02-04 14:45:33 +00:00
Pea Tyczynska
db5378bac2 Edit template postage from a separate view 2019-02-04 14:45:33 +00:00
Chris Hill-Scott
88ad982bf7 Improve display of folder path when deeply nested
It’s a bit rudimentary to only show the current place in the hierarchy
and the parent. You lose a sense of how deep you are.

But we can’t just show the full path, because it can be arbitrarily
long. So what this commit does is show the full path, but truncates the
display of any items. Further-up than the current folder or its parent.

This also helps disambiguate between folders and templates, because
folders are always shown with the folder icon.

This probably won’t affect many teams, because we don’t anticipate a lot
of deep nesting.
2019-02-01 10:28:29 +00:00
Chris Hill-Scott
a34e1ea1f0 Merge pull request #2638 from alphagov/copy-template-from-folders
Allow users to navigate folders when copying
2019-01-09 12:26:29 +00:00
Chris Hill-Scott
30886c3cdb Merge pull request #2626 from alphagov/empty-service-state-folders
Use grey buttons to add templates when service is new
2019-01-09 10:26:43 +00:00
Chris Hill-Scott
206a7806d4 Allow users to navigate folders when copying
We already have a pattern for navigation folders and searching for
templates – let’s use it for the copy page too. And I reckon we can
represent services as folders if the user has multiple services they
could copy a template from.
2019-01-08 12:21:32 +00:00
Chris Hill-Scott
3a2cfda8b2 Don’t show postage to users who can’t choose it
If you can’t choose postage on a per-template basis, you shouldn’t be
see the thing that indicates that postage can be changed.
2019-01-03 16:04:16 +00:00
Chris Hill-Scott
aaf3322662 Use folder buttons in empty state
It’s confusing to have one way of adding things when your service is new
(green button) but a different way once you’ve added your first thing
(the new grey buttons).

For services that have a `edit_folders` permission, this commit
standardises on the grey buttons for a consistent experience.
2019-01-03 11:14:22 +00:00
Pea Tyczynska
50935e79ca Test mock_update_service_template called with right args 2018-12-21 17:18:18 +00:00
Pea Tyczynska
bc1e0b7167 Test choose postage section display when editing letter template 2018-12-21 17:13:19 +00:00
Pea Tyczynska
cbead5d665 Refactor tests for displaying template postage 2018-12-21 17:13:19 +00:00
Pea Tyczynska
5144db7baa Test postage display on view template page 2018-12-21 17:13:18 +00:00
Pea Tyczynska
85b8b343e2 Service deafault radio checked by default, existing tests pass. 2018-12-21 17:13:18 +00:00
Pea Tyczynska
e1191326f4 Fix tests after enabling editing of postage on letter templates 2018-12-21 17:13:18 +00:00
Leo Hemsted
97f663f99e change operations to kebab-case
so that they better align with the front-end, where they'll be used in
data attributes. Also, making the kebab case is nice because it doesn't
give favouritism to either JS or python naming conventions
2018-12-04 16:41:47 +00:00
Chris Hill-Scott
10100e51b6 Let users add new template from the choose page
Since we’re letting users add new folders directly from the choose page
it makes sense that they should also be able to add templates from
there.

This resolves the problem we saw in user research where people found it
hard to know where to go to add a new folder when they were all behind
one green button.
2018-12-03 17:38:37 +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
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
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
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
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
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
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
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
4c9f667de3 Sort folders alphabetically
To match the order in which templates are sorted.
2018-11-12 11:53:37 +00:00
Chris Hill-Scott
cdb5b47c4d Post to the API when moving folders and templates
This commit adds logic to:
- take the list of selected folders and templates
- split it into two lists (of folders and templates)
- `POST` that data to the API, to effect the movement of said folders
  and templates

I’ve tried to architect it in such a way that we can easily add more
template ‘operations’ in the future, as we add more forms to the choose
template page.
2018-11-12 08:37:46 +00:00
Chris Hill-Scott
2743216519 Show form elements for templates and folders
This commit adds:
- checkboxes to let you select a template or folder
- radio buttons to let you select where to move those template(s) and/or
  folder(s) to

It only does the `get` part of this work; handling the `post` and
calling API will be done in a subsequent commit.
2018-11-12 08:37:46 +00:00
Chris Hill-Scott
d98ec79a9d Add more thorough tests for the template search
It would be quite easy to dissociate the search box from the things its
supposed to be searching.

This commit adds assertions to make sure that the things the search box
is targeting are on the page
2018-11-12 08:37:46 +00:00
Rebecca Law
146c7915b2 Create a template in a folder. 2018-11-08 15:53:33 +00:00
Leo Hemsted
078595da9d show list of template folders on the choose templates page
Not linking anywhere yet. Also not sorted, and not filtered by
parent_id.
2018-11-06 13:13:13 +00:00
Chris Hill-Scott
780b9bb715 Use cached property from werkzeug.utils
This means we can have a method on the service model which hits the API
(or Redis) but can be called multiple times (within the context of a
request) without making multiple network requests.

It does this by storing the results of the method on the object’s
internal `__dict__` the first time the method is called.
2018-10-30 14:55:01 +00:00
Tom Byers
3bc7c1c224 Add test for live-search on templates page
Includes addition of a mock for a list of
templates long enough to need a live-search.
2018-08-22 19:03:52 +01:00
Chris Hill-Scott
ec69aa6c39 Merge pull request #2214 from alphagov/sort-services-alpha-on-copy
Sort services alphabetically when copying template
2018-08-10 16:59:00 +01:00
Chris Hill-Scott
5108187cab Show letters in basic view
We were taking letters away from basic view because there’s no one-off
sending of letters.

But now that basic view isn’t an opt-in thing but something we’re
rolling out to all users who only have the ‘send’ permission it feels
like too drastic a change to remove letters.
2018-08-09 13:49:06 +01:00