diff --git a/app/assets/stylesheets/components/message.scss b/app/assets/stylesheets/components/message.scss index 87c1198a8..55267d554 100644 --- a/app/assets/stylesheets/components/message.scss +++ b/app/assets/stylesheets/components/message.scss @@ -24,17 +24,34 @@ margin-top: $gutter; } -.template-list-item, -.template-list-item-with-checkbox { - position: relative; -} +.template-list { -.template-list-item-with-checkbox { + &-item { - padding-left: $gutter * 2; + &-with-checkbox { + + position: relative; + padding-left: $gutter * 2; + + .multiple-choice { + position: absolute; + left: 0; + } + + } - .multiple-choice { - position: absolute; - left: 0; } + + &-folder { + + a { + text-indent: 40px; + background-image: file-url('folder-blue-bold.svg'); + background-repeat: no-repeat; + background-size: auto 20px; + background-position: 0px 2px; + } + + } + } diff --git a/app/models/service.py b/app/models/service.py index d24abdd47..7780347f4 100644 --- a/app/models/service.py +++ b/app/models/service.py @@ -289,7 +289,10 @@ class Service(): @cached_property def all_template_folders(self): - return template_folder_api_client.get_template_folders(self.id) + return sorted( + template_folder_api_client.get_template_folders(self.id), + key=lambda folder: folder['name'].lower(), + ) @cached_property def all_template_folder_ids(self): diff --git a/app/templates/views/templates/_template_list.html b/app/templates/views/templates/_template_list.html index f4425c8e9..96ecbff53 100644 --- a/app/templates/views/templates/_template_list.html +++ b/app/templates/views/templates/_template_list.html @@ -10,7 +10,7 @@ value=template_folder.id, ) }} {% endif %} -

+

{{ template_folder.name }} diff --git a/tests/app/main/views/test_template_folders.py b/tests/app/main/views/test_template_folders.py index cfc33d07c..9628b6a95 100644 --- a/tests/app/main/views/test_template_folders.py +++ b/tests/app/main/views/test_template_folders.py @@ -133,10 +133,10 @@ def test_should_show_templates_folder_page( ): mock_get_template_folders.return_value = [ - {'id': PARENT_FOLDER_ID, 'name': 'folder_one', 'parent_id': None}, {'id': str(uuid.uuid4()), 'name': 'folder_two', 'parent_id': None}, - {'id': CHILD_FOLDER_ID, 'name': 'folder_one_one', 'parent_id': PARENT_FOLDER_ID}, + {'id': PARENT_FOLDER_ID, 'name': 'folder_one', 'parent_id': None}, {'id': str(uuid.uuid4()), 'name': 'folder_one_two', 'parent_id': PARENT_FOLDER_ID}, + {'id': CHILD_FOLDER_ID, 'name': 'folder_one_one', 'parent_id': PARENT_FOLDER_ID}, ] service_one['permissions'] += ['letter', 'edit_folders'] diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index f82512854..1a57db7e5 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -252,10 +252,10 @@ def test_should_show_radio_buttons_for_move_destination( assert radios == page.select('input[name=move_to]') assert [x['value'] for x in radios] == [ - PARENT_FOLDER_ID, FOLDER_TWO_ID, CHILD_FOLDER_ID, FOLDER_ONE_TWO_ID + PARENT_FOLDER_ID, CHILD_FOLDER_ID, FOLDER_ONE_TWO_ID, FOLDER_TWO_ID, ] assert [x.text.strip() for x in labels] == [ - 'folder_one', 'folder_two', 'folder_one_one', 'folder_one_two' + 'folder_one', 'folder_one_one', 'folder_one_two', 'folder_two', ] assert page.select_one('button[name=operation]')['value'] == 'move'