Style folder hierarchy in headings

This makes the display of folders in the `<h1>` look like the prototype.

It alters the behaviour we’ve initially built here by only ever showing
a maximum of two levels of hierarchy (the current folders and its
parent).
This commit is contained in:
Chris Hill-Scott
2018-11-16 13:41:55 +00:00
parent 754ae743ca
commit d49622c5dc
5 changed files with 176 additions and 34 deletions

View File

@@ -316,6 +316,12 @@ class Service():
]
def get_template_folder(self, folder_id):
if folder_id is None:
return {
'id': None,
'name': 'Templates',
'parent_id': None,
}
return self._get_by_id(self.all_template_folders, folder_id)
def is_folder_visible(self, template_folder_id, template_type='all'):
@@ -335,19 +341,16 @@ class Service():
return False
def get_template_folder_path(self, template_folder_id):
if template_folder_id is None:
return []
id_to_folder = {folder['id']: folder for folder in self.all_template_folders}
folder = self.get_template_folder(template_folder_id)
folder = id_to_folder[template_folder_id]
path = [folder]
if folder['id'] is None:
return [folder]
while folder['parent_id']:
folder = id_to_folder[folder['parent_id']]
path.append(folder)
return list(reversed(path))
return [
self.get_template_folder(folder['parent_id']),
folder,
]
def get_template_folders_and_templates(self, template_type, template_folder_id):
return (