mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
Make banner on template page real
This commit is contained in:
@@ -3,6 +3,7 @@ from flask_login import login_required
|
|||||||
|
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.main.forms import TemplateForm
|
from app.main.forms import TemplateForm
|
||||||
|
from app import job_api_client
|
||||||
from app.main.dao.services_dao import get_service_by_id
|
from app.main.dao.services_dao import get_service_by_id
|
||||||
from app.main.dao import templates_dao as tdao
|
from app.main.dao import templates_dao as tdao
|
||||||
from app.main.dao import services_dao as sdao
|
from app.main.dao import services_dao as sdao
|
||||||
@@ -13,6 +14,7 @@ from client.errors import HTTPError
|
|||||||
@login_required
|
@login_required
|
||||||
def manage_service_templates(service_id):
|
def manage_service_templates(service_id):
|
||||||
try:
|
try:
|
||||||
|
jobs = job_api_client.get_job(service_id)['data']
|
||||||
templates = tdao.get_service_templates(service_id)['data']
|
templates = tdao.get_service_templates(service_id)['data']
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
if e.status_code == 404:
|
if e.status_code == 404:
|
||||||
@@ -22,6 +24,7 @@ def manage_service_templates(service_id):
|
|||||||
return render_template(
|
return render_template(
|
||||||
'views/manage-templates.html',
|
'views/manage-templates.html',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
|
has_jobs=bool(jobs),
|
||||||
templates=[tdao.TemplatesBrowsableItem(x) for x in templates])
|
templates=[tdao.TemplatesBrowsableItem(x) for x in templates])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,16 @@ GOV.UK Notify | Manage templates
|
|||||||
|
|
||||||
<h1 class="heading-large">Templates</h1>
|
<h1 class="heading-large">Templates</h1>
|
||||||
|
|
||||||
{{ banner(
|
|
||||||
'<a href="{}">Try sending a text message</a>'.format(
|
{% if not has_jobs %}
|
||||||
url_for(".choose_sms_template", service_id=service_id)
|
{{ banner(
|
||||||
)|safe,
|
'<a href="{}">Try sending a text message</a>'.format(
|
||||||
subhead='Next step',
|
url_for(".choose_sms_template", service_id=service_id)
|
||||||
type="tip"
|
)|safe,
|
||||||
)}}
|
subhead='Next step',
|
||||||
|
type="tip"
|
||||||
|
)}}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="column-two-thirds">
|
<div class="column-two-thirds">
|
||||||
|
|||||||
Reference in New Issue
Block a user