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
This commit is contained in:
Leo Hemsted
2018-11-01 15:33:09 +00:00
committed by Alexey Bezhan
parent 37295f4b6e
commit 7cbf5de240
11 changed files with 134 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
from __future__ import unicode_literals
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache

View File

@@ -0,0 +1,28 @@
from app.notify_client import NotifyAdminAPIClient, cache
class TemplateFolderAPIClient(NotifyAdminAPIClient):
# Fudge assert in the super __init__ so
# we can set those variables later.
def __init__(self):
super().__init__('a' * 73, 'b')
@cache.delete('service-{service_id}-template-folders')
def create_template_folder(
self,
service_id,
name,
parent_id=None
):
data = {
'name': name,
'parent_id': parent_id
}
return self.post('/service/{}/template-folder'.format(service_id), data)['data']['id']
@cache.set('service-{service_id}-template-folders')
def get_template_folders(self, service_id):
return self.get('/service/{}/template-folder'.format(service_id))['data']
template_folder_api_client = TemplateFolderAPIClient()