Files
notifications-admin/app/templates/views/templates/choose.html
Chris Hill-Scott f3c7a167df Add find-as-you-type on the choose template page
Not everyone knows how to use `ctrl` + `f`, and it’s not scoped to
just the list of templates.

The template you want to work with is often not the first one in the
list, but ordering by created at is useful for other reasons (mainly
around first time use).

This commit adds a find as you type control which aims to give users a
quick way of getting to the template they want to work with.
2017-03-20 11:40:19 +00:00

76 lines
2.6 KiB
HTML

{% from "components/message-count-label.html" import message_count_label %}
{% from "components/textbox.html" import textbox %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Templates
{% endblock %}
{% block maincolumn_content %}
{% if not templates %}
<h1 class="heading-large">Templates</h1>
{% if current_user.has_permissions(permissions=['manage_templates'], any_=True) %}
<p class="bottom-gutter">
You need a template before you can send
{% if current_service.can_send_letters %}
emails, text messages or letters
{%- else -%}
emails or text messages
{%- endif %}.
</p>
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id) }}" class="button">Add a new template</a>
{% else %}
<p>
You need to ask your service manager to add templates before you can send
{% if current_service.can_send_letters %}
emails, text messages or letters
{%- else -%}
emails or text messages
{%- endif %}.
</p>
{% endif %}
{% else %}
<div class="grid-row bottom-gutter-1-2">
<div class="column-two-thirds">
<h1 class="heading-large">Templates</h1>
</div>
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
<div class="column-one-third">
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id) }}" class="button align-with-heading">Add new template</a>
</div>
{% endif %}
</div>
<div class="live-search" data-module="live-search" data-targets="#template-list .column-whole">
{{ textbox(
search_form.search,
width='1-1'
) }}
</div>
<nav class="grid-row" id=template-list>
{% for template in templates %}
<div class="column-whole">
<h2 class="message-name">
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">{{ template.name }}</a>
</h2>
<p class="hint">
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
{% if template.get('updated_at', None) %}
&emsp;Last edited {{ template.get('updated_at', None)|format_date_short }}
&emsp;<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">See previous versions</a>
{% endif %}
</p>
</div>
{% endfor %}
</nav>
{% endif %}
{% endblock %}