mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 07:28:25 -04:00
Merge pull request #2638 from alphagov/copy-template-from-folders
Allow users to navigate folders when copying
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
{% from "components/folder-path.html" import copy_folder_path, page_title_folder_path %}
|
||||
{% from "components/live-search.html" import live_search %}
|
||||
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
@@ -8,30 +9,49 @@
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="bottom-gutter-3-2">
|
||||
<div class="bottom-gutter-1-2">
|
||||
<h1 class="heading-large">Copy an existing template</h1>
|
||||
{{ copy_folder_path(template_folder_path, current_service.id, from_service) }}
|
||||
</div>
|
||||
<nav>
|
||||
{% for service in services %}
|
||||
{% set templates = service.get_templates(current_service.permissions) %}
|
||||
{% if templates and services|length > 1 %}
|
||||
<h2 class="">
|
||||
{{ service.name }}
|
||||
</h2>
|
||||
<div class="left-gutter-4-3 bottom-gutter-3-2">
|
||||
{% endif %}
|
||||
{% for template in templates %}
|
||||
<h2 class="message-name">
|
||||
<a href="{{ url_for('.copy_template', service_id=current_service.id, template_id=template.id, from_service=service.id) }}">{{ template.name }}</a>
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ message_count_label(1, template.template_type, suffix='')|capitalize }} template
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% if templates %}
|
||||
{% if not services_templates_and_folders.templates_to_show %}
|
||||
<p class="template-list-empty">
|
||||
This folder is empty
|
||||
</p>
|
||||
{% else %}
|
||||
{{ live_search(target_selector='#template-list .template-list-item', show=True, form=search_form) }}
|
||||
<nav id="template-list">
|
||||
{% for item in services_templates_and_folders %}
|
||||
<div class="template-list-item {% if item.ancestors %}template-list-item-hidden-by-default{% endif %} {% if not item.ancestors %}template-list-item-without-ancestors{% endif %}">
|
||||
<h2 class="message-name {% if item.is_folder or (item.ancestors and not item.is_folder) %}template-list-folder{% endif %}">
|
||||
{% for ancestor in item.ancestors %}
|
||||
{% if ancestor.is_service %}
|
||||
<a href="{{ url_for('.choose_template_to_copy', service_id=current_service.id, from_service=ancestor.service_id) }}">
|
||||
{% else %}
|
||||
<a href="{{ url_for('.choose_template_to_copy', service_id=current_service.id, from_folder=ancestor.id) }}">
|
||||
{% endif %}
|
||||
{{ ancestor.name }}
|
||||
</a> <span class="message-name-separator">/</span>
|
||||
{% endfor %}
|
||||
{% if item.is_service %}
|
||||
<a href="{{ url_for('.choose_template_to_copy', service_id=current_service.id, from_service=item.service_id) }}">
|
||||
<span class="live-search-relevant">{{ item.name }}</span>
|
||||
</a>
|
||||
{% elif item.is_folder %}
|
||||
<a href="{{ url_for('.choose_template_to_copy', service_id=current_service.id, from_service=item.service_id, from_folder=item.id) }}">
|
||||
<span class="live-search-relevant">{{ item.name }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('.copy_template', service_id=current_service.id, template_id=item.id, from_service=item.service_id) }}">
|
||||
<span class="live-search-relevant">{{ item.name }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ item.hint }}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</nav>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user