Commit Graph

6396 Commits

Author SHA1 Message Date
Chris Hill-Scott
74a4400bc7 Update URLs to match change in API 2018-11-12 08:37:46 +00:00
Chris Hill-Scott
9de4b4598f Don’t show move when there’s nothing to move 2018-11-12 08:37:46 +00:00
Chris Hill-Scott
38e8cca606 Show page if all you got is empty folders 2018-11-12 08:37:46 +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
980d66bdaa Add helper function for filtering templates by type
This code was making the view method more cluttered than it needed to
be. Moving it will help make space for the `post` request handling code.
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
921de47164 Refactor template navigation options into model
This has two advantages:
- less logic in the view
- lets us filer the available navigation by which channels (email, text
  letter) a service has available
2018-11-12 08:37:46 +00:00
Chris Hill-Scott
4df96f3682 Add model properties for template and folder IDs
We’re going to need a way to find out if, for a given ID:
1. its a template or a folder
2. if it belongs to a given service

To do 2., we can make a set of all the IDs, to see if a given ID is a
member of that set.

To do 1. we can make two sets, one for templates and one for folders.

The natural home for these sets is on the service model.
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
Chris Hill-Scott
e4f8f4e98a Merge pull request #2379 from alphagov/add-folder-icons
Add folder icons
2018-11-09 15:05:28 +00:00
Rebecca Law
812a4f4ecc Merge pull request #2473 from alphagov/438-services
Service count to 438 and orgs to 132
2018-11-09 13:31:22 +00:00
Pete Herlihy
d9d9db2140 Service count to 438 and orgs to 132 2018-11-09 12:50:46 +00:00
Rebecca Law
73fce86b40 Merge pull request #2468 from alphagov/add-parent-folder-id-when-creating-template
Create a template in a folder.
2018-11-09 11:12:30 +00:00
Rebecca Law
9f4ef2e269 Remove service_once from method signature 2018-11-09 11:04:42 +00:00
Rebecca Law
a4d9dc4616 Added a test for create template with parent folder id 2018-11-09 10:47:21 +00:00
Rebecca Law
146c7915b2 Create a template in a folder. 2018-11-08 15:53:33 +00:00
karlchillmaid
30ed9cfaca Merge pull request #2467 from alphagov/data-protection-act-update
Updated data protection law description
2018-11-08 15:37:28 +00:00
Alexey Bezhan
622fdfedc9 Merge pull request #2452 from alphagov/create-template-folders
Create template folders
2018-11-08 11:58:39 +00:00
karlchillmaid
528a176651 Updated data protection law description
Original content: 'Notify complies with the Data Protection Act.'
This should be updated to take account of GDPR – for example, 'Notify complies with data protection law' (which covers both DPA and GDPR).
This change is consistent with the Service Manual.
2018-11-08 11:16:18 +00:00
Chris Hill-Scott
18277b9f15 Use CSS selector instead of page.find in template folders tests
Co-Authored-By: allait <al@fueledbylemons.com>
2018-11-08 11:09:00 +00:00
Chris Hill-Scott
e74819eaf8 Merge pull request #2414 from alphagov/reduce-logging-during-tests
Reduce logging noise in traceback output
2018-11-07 16:21:18 +00:00
Chris Hill-Scott
d7cf28c07e Merge pull request #2464 from alphagov/ashfield.gov.uk
Mark agreement signed by Ashfield District Council
2018-11-07 15:53:53 +00:00
Chris Hill-Scott
345f3b2d68 Mark agreement signed by Ashfield District Council 2018-11-07 15:36:25 +00:00
Chris Hill-Scott
c0c0015dc4 Merge pull request #2448 from alphagov/alphabetical-sort-letter-brandings
Make letter brandings easier to find with sorting and filtering
2018-11-07 13:50:05 +00:00
Chris Hill-Scott
a02a8efca1 Merge pull request #2460 from alphagov/hex-error-message
Make hex colour code error more helpful
2018-11-07 11:18:08 +00:00
Chris Hill-Scott
666d55e82b Merge pull request #2428 from alphagov/api-key-page-neatness
Make API key page handle multiple lines of text better
2018-11-07 11:17:53 +00:00
Chris Hill-Scott
514a98f946 Make hex colour code error more helpful
I just got stuck for like a whole minute on this.
2018-11-07 10:49:04 +00:00
Chris Hill-Scott
f8aaa34cdb Merge pull request #2457 from alphagov/remove-integration-testing
Remove integration testing
2018-11-07 10:26:30 +00:00
Chris Hill-Scott
b1832a4c43 Remove link to integration testing page
This page has ben deprecated.
2018-11-06 17:25:33 +00:00
Chris Hill-Scott
156d38499a Remove integration testing content
This is covered in the new client library documentation. All of the
client libraries now have their documentation published in the new
format.
2018-11-06 17:24:30 +00:00
Chris Hill-Scott
77457c81de Merge pull request #2427 from alphagov/add-notifications-page-test
Add test for the notifications page when there are failed notifications
2018-11-06 16:14:44 +00:00
Chris Hill-Scott
22d3ab9ba2 Hide duplicative form legend 2018-11-06 16:12:12 +00:00
Chris Hill-Scott
216d7d1ec9 Merge pull request #2453 from alphagov/model-service-update
Use the model for updating a service and its permissions
2018-11-06 16:07:26 +00:00
Chris Hill-Scott
9c35b9bdcb Merge pull request #2445 from alphagov/pyup-update-pytest-3.9.3-to-3.10.0
Update pytest to 3.10.0
2018-11-06 14:22:14 +00:00
Alexey Bezhan
75b4533805 Fix template type selector to preserve current folder 2018-11-06 13:45:42 +00:00
Alexey Bezhan
aaca537792 Create new folders inside the current folder
When adding a new folder it is created inside the currently active
one. The user is returned to the previously active folder page,
which shows the added folder.

This adds a new route to the add template/folder views. Thankfully,
`url_for` recognizes when `template_folder_id` is `None` and will use
the URL without `/folders/...`, so users without folder permissions
should be unaffected by this change.
2018-11-06 13:45:42 +00:00
Alexey Bezhan
9e5ca45d38 Add tests for template folder navigation 2018-11-06 13:22:08 +00:00
Alexey Bezhan
731d41f993 Add current template folder path to header and page title
When a folder is selected the full path is displayed in page title
and header (for example `Templates / Folder1 / Folder2`). Elements
of the path link to the corresponding folder. Current folder is not
linked.
2018-11-06 13:13:13 +00:00
Alexey Bezhan
20abe96fc9 Link template folders to their contents
Clicking on template folder navigates to a page that displays that
folder's contents.

This reuses the existing choose template view by adding a filter
based on optional `template_folder_id` argument.

Service model methods are rewritten to match `all_templates` and
`get_template`. New `get_template_folder_path` method returns a
list of folders (from root to the current one) that the selected
folder is nested inside.
2018-11-06 13:13:13 +00:00
Alexey Bezhan
29bed8ba55 Add Service.get_templates method with filters by type and folder
With the addition of template folders we need to filter templates
based on a combination of type and parent folder ID.

This replaces the existing `templates_by_type` method with
`get_templates`, which supports both type and parent folder filters,
avoiding a need to create specific methods for each use case.

We still need the templates property to exist in some way in order
to cache it, but it needs to be clear that it's different from
`.get_templates`. One option was to make it "private" (i.e. `_templates`),
and always use `.get_templates` in the rest of the code, but this requires
adding "include all folders" to `.get_templates`, which doesn't have an
obvious interface since `parent_folder_id=None` already means "top-level
only".

This will probably come up again when we need to look into adding
templates from nested folders into the page for live search, but
for now renaming `Service.templates` to `.all_templates` makes it
clear what the property contains.
2018-11-06 13:13:13 +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
Leo Hemsted
1ecf360e7f add template folder form 2018-11-06 13:13:12 +00:00
Leo Hemsted
7cbf5de240 add new template folder
The add new templates page now has option to add template folders.
Tweaked wording of other options and h1 to clarify options since it's
not all about templates any more.

Added api client and stuff for it
2018-11-06 13:13:12 +00:00
Chris Hill-Scott
10013a19aa Add live search to letter brandings
Matches what we do for email branding, makes the one you’re lookig for
quicker to find.
2018-11-06 13:08:58 +00:00
Chris Hill-Scott
37295f4b6e Merge pull request #2449 from alphagov/tech-docs-php-node
Link to tech docs format for .NET, PHP and Node
2018-11-06 13:08:37 +00:00
Chris Hill-Scott
43988661d6 Sort selected item to the top
When you land on the page it’s good to be able to quickly see what the
currently-set value is, before you change it.

This is unnecessarily hard if the selected item is buried half way down
the page. This commit moves it to the top.
2018-11-06 13:06:48 +00:00
Chris Hill-Scott
c960fef8f8 Always put HM Government at the top of the list
It’s the default, so we should treat it the same way we treat GOV.UK in
the email branding selection.
2018-11-06 13:04:45 +00:00
Chris Hill-Scott
65cc6adabf Sort letter brandings alphabetically
Currently the brandings have non-deterministic sorting, which means
the order changes from page load to page load. This makes it hard to
find the item you’re looking for.

This commit sorts them by the name of the branding, same as for email
brandings.
2018-11-06 13:02:40 +00:00
Chris Hill-Scott
684d4f7782 Refactor setting value on letter branding form
WTForms lets you pre-populate a form’s value by passing it in as an
argument to the constructor.

This will be good for us because it will let us access that value in
the constructor later on.
2018-11-06 13:00:30 +00:00
Chris Hill-Scott
72ddd107ef Merge pull request #2450 from alphagov/httpretty-no-more
Remove httpretty dependency
2018-11-06 12:59:32 +00:00