mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 23:08:24 -04:00
Merge pull request #2559 from alphagov/template-js
Template folder form smart JS
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
{% from "components/radios.html" import radios %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
<div id="sticky_template_forms" class="js-stick-at-bottom-when-scrolling">
|
||||
<button type="submit" name="operation" value="unknown" hidden></button>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
{% if templates_and_folders_form.move_to.choices and template_list.templates_to_show %}
|
||||
<div id="move_to_folder_radios">
|
||||
{{ radios(templates_and_folders_form.move_to) }}
|
||||
{{ page_footer('Move', button_name='operation', button_value='move_to_existing_folder') }}
|
||||
{{ page_footer('Move', button_name='operation', button_value='move-to-existing-folder') }}
|
||||
</div>
|
||||
<div id="move_to_new_folder_form">
|
||||
<fieldset>
|
||||
<legend class="visuallyhidden">Move to a new folder</legend>
|
||||
{{ textbox(templates_and_folders_form.move_to_new_folder_name) }}
|
||||
{{ page_footer('Move to a new folder', button_name='operation', button_value='move_to_new_folder') }}
|
||||
{{ page_footer('Move to a new folder', button_name='operation', button_value='move-to-new-folder') }}
|
||||
</fieldset>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -19,13 +21,14 @@
|
||||
<fieldset>
|
||||
<legend class="visuallyhidden">Add a new folder</legend>
|
||||
{{ textbox(templates_and_folders_form.add_new_folder_name) }}
|
||||
{{ page_footer('New folder', button_name='operation', button_value='add_new_folder') }}
|
||||
{{ page_footer('New folder', button_name='operation', button_value='add-new-folder') }}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="add_new_template_form">
|
||||
<fieldset>
|
||||
<legend class="visuallyhidden">Add a new template</legend>
|
||||
{{ radios(templates_and_folders_form.add_template_by_template_type) }}
|
||||
{{ page_footer('Continue', button_name='operation', button_value='add_template') }}
|
||||
{{ page_footer('Continue', button_name='operation', button_value='add-new-template') }}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
{{ unlabelled_checkbox(
|
||||
id='templates-or-folder-{}'.format(item.id),
|
||||
name='templates_and_folders',
|
||||
data=templates_and_folders_form.is_selected(item.id),
|
||||
value=item.id,
|
||||
) }}
|
||||
{% endif %}
|
||||
|
||||
@@ -60,8 +60,9 @@
|
||||
</div>
|
||||
{% if current_user.has_permissions('manage_templates') %}
|
||||
<div class="column-one-third">
|
||||
{% if not can_manage_folders %}
|
||||
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id, template_folder_id=current_template_folder_id) }}" class="button align-with-heading">Add new template</a>
|
||||
|
||||
{% endif %}
|
||||
{% if can_manage_folders and current_template_folder_id %}
|
||||
<a href="{{ url_for('.manage_template_folder', service_id=current_service.id, template_folder_id=current_template_folder_id) }}" class="align-with-heading">Manage</a>
|
||||
{% endif %}
|
||||
@@ -78,11 +79,12 @@
|
||||
{{ live_search(target_selector='#template-list .template-list-item', show=show_search_box, form=search_form) }}
|
||||
|
||||
{% if can_manage_folders %}
|
||||
{% call form_wrapper() %}
|
||||
{% call form_wrapper(
|
||||
module='template-folder-form',
|
||||
data_kwargs={'prev-state': templates_and_folders_form.op or None}
|
||||
) %}
|
||||
{% include 'views/templates/_template_list.html' %}
|
||||
{% with templates=templates, template_folders=template_folders, templates_and_folders_form=templates_and_folders_form %}
|
||||
{% include 'views/templates/_move_to.html' %}
|
||||
{% endwith %}
|
||||
{% include 'views/templates/_move_to.html' %}
|
||||
{% endcall %}
|
||||
|
||||
{% else %}
|
||||
|
||||
Reference in New Issue
Block a user