Files
notifications-admin/app/templates/views/templates/choose.html
Alexey Bezhan e6d4c7aaa8 Don't link folders in the folder path if user doesn't have permission
This updates folder_path macro to not link to any folders that
the user doesn't have permission for.
2019-04-01 10:50:39 +01:00

92 lines
3.4 KiB
HTML

{% from "components/folder-path.html" import folder_path, page_title_folder_path %}
{% from "components/pill.html" import pill %}
{% from "components/message-count-label.html" import message_count_label %}
{% from "components/textbox.html" import textbox %}
{% from "components/live-search.html" import live_search %}
{% from "components/form.html" import form_wrapper %}
{% from "components/page-footer.html" import page_footer %}
{% extends "withnav_template.html" %}
{% set page_title = 'Templates' %}
{% block service_page_title %}
{{ page_title_folder_path(
template_folder_path,
fallback_page_title=page_title,
show_fallback_page_title=not current_service.all_template_folders
) }}
{% endblock %}
{% block maincolumn_content %}
{% if (not current_service.all_templates) and (not current_service.all_template_folders) %}
<h1 class="heading-large">
{{ page_title }}
</h1>
{% if current_user.has_permissions('manage_templates') %}
<p class="bottom-gutter top-gutter">
You need a template before you can send
{% if 'letter' in current_service.permissions %}
emails, text messages or letters
{%- else -%}
emails or text messages
{%- endif %}.
</p>
{% else %}
<p class="top-gutter">
You need to ask your service manager to add templates before you can send
{% if 'letter' in current_service.permissions %}
emails, text messages or letters
{%- else -%}
emails or text messages
{%- endif %}.
</p>
{% endif %}
{% else %}
<div class="grid-row {% if current_service.all_template_folders %}bottom-gutter-1-2{% else %}bottom-gutter-2-3{% endif %}">
<div class="{% if current_user.has_permissions('manage_templates') %} column-five-sixths {% else %} column-two-thirds {% endif %}">
{{ folder_path(
folders=template_folder_path,
service_id=current_service.id,
template_type=template_type,
current_user=current_user,
fallback_page_title=page_title,
show_fallback_page_title=not current_service.all_template_folders
) }}
</div>
{% if current_user.has_permissions('manage_templates') and current_template_folder_id and user_has_template_folder_permission %}
<div class="column-one-sixth">
<a href="{{ url_for('.manage_template_folder', service_id=current_service.id, template_folder_id=current_template_folder_id) }}" class="folder-heading-manage-link">Manage</a>
</div>
{% endif %}
</div>
{% endif %}
{% if show_template_nav %}
<div class="bottom-gutter">
{{ pill(template_nav_items, current_value=template_type, show_count=False) }}
</div>
{% endif %}
{{ live_search(target_selector='#template-list .template-list-item', show=show_search_box, form=search_form) }}
{% if current_user.has_permissions('manage_templates') and user_has_template_folder_permission %}
{% call form_wrapper(
class='sticky-scroll-area',
module='template-folder-form',
data_kwargs={'prev-state': templates_and_folders_form.op or None}
) %}
{% include 'views/templates/_template_list.html' %}
{% include 'views/templates/_move_to.html' %}
{% endcall %}
{% else %}
{% include 'views/templates/_template_list.html' %}
{% endif %}
{% endblock %}