Hide template nav if service has one of each

There are a bunch of services that just have one text message template
and one email template.

In this case the template navigation is essentially the same as the
list of templates – a user can just differentiate by looking at the two
templates. Adding the nav would just be noise in this case.
This commit is contained in:
Chris Hill-Scott
2017-06-23 13:51:22 +01:00
parent 867143e871
commit 3e335c3250
2 changed files with 9 additions and 6 deletions

View File

@@ -102,13 +102,16 @@ def choose_template(service_id, template_type='all'):
])
]
templates_on_page = [
template for template in templates
if template_type in ['all', template['template_type']]
]
return render_template(
'views/templates/choose.html',
templates=[
template for template in templates
if template_type in ['all', template['template_type']]
],
show_template_nav=has_multiple_template_types,
templates=templates_on_page,
show_search_box=(len(templates_on_page) > 7),
show_template_nav=has_multiple_template_types and (len(templates) > 2),
template_nav_items=template_nav_items,
template_type=template_type,
search_form=SearchTemplatesForm(),

View File

@@ -54,7 +54,7 @@
</div>
{% endif %}
{% if templates|length > 7 %}
{% if show_search_box %}
<div data-module="autofocus">
<div class="live-search" data-module="live-search" data-targets="#template-list .column-whole">
{{ textbox(