From aaacf69fdcaef360d081e5b7ec9d763691bf63d3 Mon Sep 17 00:00:00 2001 From: karlchillmaid Date: Wed, 20 Feb 2019 14:39:40 +0000 Subject: [PATCH 1/4] Updated new template menu content Updated new template menu content to make it consistent with the `New template` button and `Copy an existing template` page --- app/main/forms.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 525e20737..ddaf23e4e 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1233,10 +1233,10 @@ class TemplateAndFoldersSelectionForm(Form): ] self.add_template_by_template_type.choices = list(filter(None, [ - ('email', 'Email template'), - ('sms', 'Text message template'), - ('letter', 'Letter template') if allow_adding_letter_template else None, - ('copy-existing', 'Copy of an existing template') if allow_adding_copy_of_template else None, + ('email', 'Email'), + ('sms', 'Text message'), + ('letter', 'Letter') if allow_adding_letter_template else None, + ('copy-existing', 'Copy an existing template') if allow_adding_copy_of_template else None, ])) def is_selected(self, template_folder_id): @@ -1277,7 +1277,7 @@ class TemplateAndFoldersSelectionForm(Form): add_new_folder_name = StringField('Folder name', validators=[required_for_ops('add-new-folder')]) move_to_new_folder_name = StringField('Folder name', validators=[required_for_ops('move-to-new-folder')]) - add_template_by_template_type = RadioFieldWithRequiredMessage('Add new', validators=[ + add_template_by_template_type = RadioFieldWithRequiredMessage('New template', validators=[ required_for_ops('add-new-template'), Optional(), ], required_message='Select the type of template you want to add') From 03a2b28269b486c4439bcf3259dcd085ea816651 Mon Sep 17 00:00:00 2001 From: karlchillmaid Date: Wed, 20 Feb 2019 14:58:14 +0000 Subject: [PATCH 2/4] Corrected: Add to new folder button Corrected: Add to new folder button --- app/assets/javascripts/templateFolderForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/templateFolderForm.js b/app/assets/javascripts/templateFolderForm.js index 43436cfe8..302c2825f 100644 --- a/app/assets/javascripts/templateFolderForm.js +++ b/app/assets/javascripts/templateFolderForm.js @@ -197,7 +197,7 @@
- +
1 selected
From 884734a1b2c7aa93c1349a054ac9a09307db3d4c Mon Sep 17 00:00:00 2001 From: karlchillmaid Date: Wed, 20 Feb 2019 15:05:08 +0000 Subject: [PATCH 3/4] Updated button content Updated button content --- app/templates/views/templates/_move_to.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/templates/views/templates/_move_to.html b/app/templates/views/templates/_move_to.html index b538142ca..0b28555f5 100644 --- a/app/templates/views/templates/_move_to.html +++ b/app/templates/views/templates/_move_to.html @@ -15,17 +15,17 @@
- Move to a new folder + Add to new folder {{ textbox(templates_and_folders_form.move_to_new_folder_name, width='1-1') }} - {{ page_footer('Move to a new folder', button_name='operation', button_value='move-to-new-folder') }} + {{ page_footer('Add to new folder', button_name='operation', button_value='move-to-new-folder') }}
{% endif %}
- Add a new folder + Add new folder {{ textbox(templates_and_folders_form.add_new_folder_name, width='1-1') }} - {{ page_footer('New folder', button_name='operation', button_value='add-new-folder') }} + {{ page_footer('Add new folder', button_name='operation', button_value='add-new-folder') }}
From fe57d0adc8f7c88e50e436429077b3f0f931662d Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 20 Feb 2019 15:12:44 +0000 Subject: [PATCH 4/4] Fix tests --- tests/app/main/views/test_letters.py | 4 ++-- tests/app/main/views/test_templates.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/app/main/views/test_letters.py b/tests/app/main/views/test_letters.py index 3711b9623..e274f79bf 100644 --- a/tests/app/main/views/test_letters.py +++ b/tests/app/main/views/test_letters.py @@ -55,11 +55,11 @@ def test_letters_lets_in_without_permission( @pytest.mark.parametrize('permissions, choices', [ ( ['email', 'sms', 'letter'], - ['Email template', 'Text message template', 'Letter template', 'Copy of an existing template'] + ['Email', 'Text message', 'Letter', 'Copy an existing template'] ), ( ['email', 'sms'], - ['Email template', 'Text message template', 'Copy of an existing template'] + ['Email', 'Text message', 'Copy an existing template'] ), ]) def test_given_option_to_add_letters_if_allowed( diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 725c15489..1b5884ca1 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -290,9 +290,9 @@ def test_should_show_live_search_if_service_has_lots_of_folders( 'sms', 'copy-existing', ], [ - 'Email template', - 'Text message template', - 'Copy of an existing template', + 'Email', + 'Text message', + 'Copy an existing template', ]), pytest.param(['letter'], [ 'email', @@ -300,10 +300,10 @@ def test_should_show_live_search_if_service_has_lots_of_folders( 'letter', 'copy-existing', ], [ - 'Email template', - 'Text message template', - 'Letter template', - 'Copy of an existing template', + 'Email', + 'Text message', + 'Letter', + 'Copy an existing template', ]), )) def test_should_show_new_template_choices_if_service_has_folder_permission( @@ -327,7 +327,7 @@ def test_should_show_new_template_choices_if_service_has_folder_permission( raise ElementNotFound() assert normalize_spaces(page.select_one('#add_new_template_form fieldset legend').text) == ( - 'Add new' + 'New template' ) assert [ choice['value'] for choice in page.select('#add_new_template_form input[type=radio]')