Commit Graph

6458 Commits

Author SHA1 Message Date
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
Pea (Malgorzata Tyczynska)
1dc63bbe63 Merge pull request #2493 from alphagov/delete_folder
Add delete folder flow
2018-11-15 14:44:39 +00:00
Pea Tyczynska
f54c2c0dc7 Update content of deletion messages following review 2018-11-15 10:51:44 +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
Tom Byers
d1805e7fc0 Merge pull request #2469 from alphagov/make-current-sticky-js-generic
Allow our sticky navs to stick to bottom as well as top
2018-11-15 09:59:37 +00:00
Tom Byers
eeb096aa62 Add missed .stopped method to Sticky Element 2018-11-14 16:42:52 +00:00
Tom Byers
8411598390 Remove transition if element is stuck onload
Fade-in and out for sticky elements should only be
when they move from being in-page to stuck from a
user interaction.
2018-11-14 10:25:08 +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
ca56561da1 Merge pull request #2489 from alphagov/pre-populate-folder-rename
Pre-populate rename folder form with current name
2018-11-14 10:13:22 +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
ce798a02e4 Merge pull request #2487 from alphagov/fix-folders-ie10
Fix templates page in IE10
2018-11-13 15:26:13 +00:00
Chris Hill-Scott
872b3f9c94 Make existing_keys a required argument
Because we should always expect its presence, even it’s an empty list.
And because having mutable default arguments can have nasty side
effects.
2018-11-13 14:27:01 +00:00
Chris Hill-Scott
807396f8b9 Add comment to explain combining of flex and float
Just so no-one thinks it’s redundant and removes it.
2018-11-13 14:22:48 +00:00
Chris Hill-Scott
66cf12ba65 Run folder-blue.svg through SVGOMG
Does the same optimisations we’ve done for the other SVGs.

https://jakearchibald.github.io/svgomg/
2018-11-13 14:15:38 +00:00
Chris Hill-Scott
32c64c11e3 Merge pull request #2461 from fidejoseph/patch-3
Update using-notify.html
2018-11-13 14:10:18 +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
Chris Hill-Scott
a82ce7de1f Fix folder navigation in IE 10
IE10 doesn’t support flexbox. We can work around this using floats.

I think the flexbox will override it, so will be ignored by newer
browsers.
2018-11-13 14:01:19 +00:00
Chris Hill-Scott
e0ecc95ac6 Fix folder icon in IE 10
IE 10 supports using SVG[1] but has some buggy behaviour when they’re
used as background images.

Without an explicit width/height it stretches the viewBox of the SVG to
fill the containing element. This causes the content of the file to
display centered within the viewBox.

Explicitly setting the width and height seems to be the thing that fixes
this. Out of the suggested fixes on Stackoverflow[2] this one seems to
be the most straightforward.

1. https://caniuse.com/#feat=svg
2. https://stackoverflow.com/questions/17944354/svg-background-image-position-is-always-centered-in-internet-explorer-despite-b
2018-11-13 13:57:03 +00:00
Chris Hill-Scott
63060d926f Rename method
Starting with `is` helps indicate that it’s going to return a boolean,
not perform an action (which is what a verb like `show` implies).
2018-11-13 12:31:31 +00:00
Chris Hill-Scott
045a4bb7f1 Swap order of arguments to get_template_folders
So that the order is the same as the arguments passed to `get_templates`
2018-11-13 12:29:57 +00:00
Pea (Malgorzata Tyczynska)
ec58e9baa6 Merge pull request #2486 from alphagov/bust_cache
Add decorator deleting cache for template folder client update method
2018-11-13 11:55:27 +00:00
Pea Tyczynska
c27b97380d Add decorator deleting cache for template folder client update method 2018-11-13 11:43:59 +00:00
Chris Hill-Scott
6c4b6774aa Label folders to show what’s in them
It feels like a solid reckon that knowing what’s in a folder before you
click on it will help you navigate around.

However, what do you show in a folder if you’re filtering by template
type? We think that:
- if you’re not filtering you should see all folders, even empty ones
- if you’re filtering you should only see folders that will get you to
  relevant templates

This matches what happens when you filter templates, we don’t ‘grey out’
the non-email templates, we hide them completely.

The logic then extends to how we describe the contents of a folder, ie
we won’t count its subfolders if they don’t contain templates of the
type we’re looking for. This means that however you see the folder
described (eg ‘3 templates, 1 folder’) will match what you see when you
click into it.
2018-11-13 11:10:21 +00:00
Chris Hill-Scott
7fc5bf41b7 Add a grandchild folder to the test cases
This will make it easier to generate all the necessary permutations we
need to test.
2018-11-13 11:10:20 +00:00
Chris Hill-Scott
012b560673 Make a helper function for generating templates
Having this stuff split across various points in `conftest.py` was
making my brain melt.

This way I feel like it’s easier to see the input/output of the test.
2018-11-13 11:10:20 +00:00
Chris Hill-Scott
10fe78bb31 Only show relevant folders
A folder is relevant if it, or any of its descents contain a template of
the kind you’re looking for.

If you’re not filtering by template type then you should see all
folders.
2018-11-13 11:10:20 +00:00
Chris Hill-Scott
084c020d0c Test for template hints
This commit extends the tests to not only look at the name of the
displayed templates and folders, but also the hint text underneath.

Because there are going to be more variations of this hint text in the
future we need to make sure it’s tested.

Doing this in its own commit so only the meaningful changes show up in
the commits that actually change stuff.
2018-11-13 11:10:20 +00:00
Chris Hill-Scott
5db7025e12 Make line breaks consistent
Putting each item on its own line makes the diff cleaner in subsequent
commits, and makes each pytest param consistent.
2018-11-13 11:10:20 +00:00
Chris Hill-Scott
66f66b95bf Make a helper function for testing folders
Splitting this out into a function makes it easier to see what’s going
on in the tests.
2018-11-13 11:10:19 +00:00
Pea (Malgorzata Tyczynska)
0a4b6dbb33 Merge pull request #2482 from alphagov/update_folder
Add a new endpoint for managing a folder, use it to rename folder
2018-11-13 10:49:08 +00:00
Pea Tyczynska
565d29ed43 Add a new endpoint for managing a folder, use it to rename folder
- Add a GET / POST view: manage template folder
- Add a template for that view, where a user can rename their
folder
- Add an API client method for updating a folder

- Test the new feature, including the test that service without
permissions cannot manage a folder
2018-11-13 10:38:56 +00:00
Chris Hill-Scott
8bedcb5af8 Move data transformation into the form
Follows what we’re doing with the folders stuff. Avoids having too many
very straightforward methods on the model. Especially when the data they
need is only used by the form. So it’s better to encapsulate the logic
in the form.
2018-11-13 09:57:17 +00:00
Chris Hill-Scott
5cc2f3c589 Merge pull request #2480 from alphagov/networkrail.co.uk
Add Network Rail to allowed domains
2018-11-13 09:46:23 +00:00
Chris Hill-Scott
2639e2c46f Sort API keys alphabetically
Currently the order of API keys seems to be non-deterministic:
d46caa184e/app/dao/api_key_dao.py (L32-L39)

Generally we sort things alphabetically, unless there’s a good reason to
do otherwise.

This commit sorts the API keys alphabetically.
2018-11-12 16:11:13 +00:00
Chris Hill-Scott
591bbe9a49 Don’t do multiple get API calls when revoking
It’s redundant to make two API calls here, one to get all keys and one
to get a single key. Since the API calls are sequential we can speed
things up by getting the one key from the list of all keys.
2018-11-12 16:11:13 +00:00
Chris Hill-Scott
d1c9dcfb1d Put API keys on service model
Similar to how we put templates on the service model, it means less
logic needs to happen in the view code.
2018-11-12 16:11:13 +00:00
Rebecca Law
302078ac28 Merge pull request #2475 from alphagov/add-folder-icons-to-list
Add folder icons to list
2018-11-12 15:26:44 +00:00
Chris Hill-Scott
7ac4369eb5 Add Network Rail to allowed domains 2018-11-12 13:58:45 +00:00
Katie Smith
6f2c4601a8 Merge pull request #2451 from alphagov/csv-upload-sender-id
Store the sender_id that should be used for a job in S3 metadata
2018-11-12 13:42:13 +00:00
Katie Smith
0f90bde958 Store the sender_id that should be used for a job in S3 metadata
Currently, a user can select a reply-to email address or text message
sender when uploading a CSV file but this is ignored and the default is
always used instead. As a first step towards changing this, this adds
the sender_id (if selected) to the S3 metadata so that this information
can be used when processing the job.
2018-11-12 13:34:33 +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
07dd59f5b6 Add folder icons to template list
To make it easier to identify what is a folder.
2018-11-12 11:53:37 +00:00
Chris Hill-Scott
fb339a08a8 Refactor CSS to better use inherited naming 2018-11-12 11:53:37 +00:00
Rebecca Law
8dc7e6e5f8 Merge pull request #2470 from alphagov/move-into-existing-folders
Let users move things into folders
2018-11-12 11:40:00 +00:00
Chris Hill-Scott
55fa85d79b Fix copypaste error 2018-11-12 09:54:25 +00:00
Chris Hill-Scott
3cac9ac5cc Rename method to be more explicit 2018-11-12 09:21:47 +00:00