mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-02 04:20:34 -04:00
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:
committed by
Alexey Bezhan
parent
37295f4b6e
commit
7cbf5de240
@@ -1,4 +1,3 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||
|
||||
|
||||
28
app/notify_client/template_folder_api_client.py
Normal file
28
app/notify_client/template_folder_api_client.py
Normal 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()
|
||||
Reference in New Issue
Block a user