Completed first-round of updates for the zone templates list view.

This commit is contained in:
Matt Scott 2023-02-19 20:50:27 -05:00
parent c4d9bf3a9c
commit f1d17c166a

View File

@ -1,45 +1,35 @@
{% extends "base.html" %} {% extends "base.html" %}
{% set active_page = "admin_domain_template" %} {% set active_page = "admin_domain_template" %}
{% block title %}<title>Zone Templates - {{ SITE_NAME }}</title>{% endblock %}
{% block title %}
<title>
Templates - {{ SITE_NAME }}
</title>
{% endblock %}
{% block dashboard_stat %} {% block dashboard_stat %}
<div class="content-header">
<div class="content-header">
<div class="container-fluid"> <div class="container-fluid">
<div class="row mb-2"> <div class="row mb-2">
<div class="col-sm-6"> <div class="col-sm-6">
<h1 class="m-0 text-dark"> <h1 class="m-0 text-dark">Zone Templates</h1>
Templates
<small>List</small>
</h1>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<ol class="breadcrumb float-sm-right"> <ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li> <li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
<li class="breadcrumb-item active">Templates - List</li> <li class="breadcrumb-item active">Zone Templates</li>
</ol> </ol>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
{% with errors = get_flashed_messages(category_filter=["error"]) %} {% with errors = get_flashed_messages(category_filter=["error"]) %}
{% if errors %} {% if errors %}
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="alert alert-danger alert-dismissible"> <div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;
</button>
<h4> <h4>
<i class="fa-solid fa-ban"></i> Error! <i class="fa-solid fa-ban"></i> Error!
</h4> </h4>
@ -56,25 +46,30 @@
</div> </div>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card card-outline card-primary shadow">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Templates</h3> <h3 class="card-title">Templates</h3>
<div class="card-tools">
<a href="{{ url_for('admin.create_template') }}"> <a href="{{ url_for('admin.create_template') }}">
<button type="button" class="btn btn-primary float-right"> <button type="button" class="btn btn-primary">
<i class="fa-solid fa-plus"></i>&nbsp;Create Template <i class="fa-solid fa-plus"></i> Create Template
</button> </button>
</a> </a>
</div> </div>
<div class="card-body"> </div>
<table id="tbl_template_list" class="table table-bordered table-striped"> <!-- /.card-header -->
<div class="card-body table-responsive">
<table id="tbl_template_list"
class="table table-bordered table-striped table-hover table-sm records">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Description</th> <th>Description</th>
<th>Number of Records</th> <th>Total Records</th>
<th width="20%">Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -85,26 +80,27 @@
<strong>{{ template.name }}</strong> <strong>{{ template.name }}</strong>
</a> </a>
</td> </td>
<td> <td>{{ template.description }}</td>
{{ template.description }} <td>{{ template.records|count }}</td>
</td>
<td>
{{ template.records|count }}
</td>
<td> <td>
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button class="btn btn-primary dropdown-toggle" type="button"
id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
<i class="fa-solid fa-bars"></i>&nbsp;Actions <i class="fa-solid fa-bars"></i>&nbsp;Actions
</button> </button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu"> <div class="dropdown-menu" aria-labelledby="dropdownMenu">
<button type="button" class="dropdown-item btn-warning" onclick="window.location.href='{{ url_for('admin.edit_template', template=template.name) }}'"> <button type="button" class="dropdown-item btn-warning"
onclick="window.location.href='{{ url_for('admin.edit_template', template=template.name) }}'">
<i class="fa-solid fa-edit"></i>&nbsp;Edit Template <i class="fa-solid fa-edit"></i>&nbsp;Edit Template
</button> </button>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button type="button"class="dropdown-item btn-secondary button_delete" id="{{template.name}}"> <button type="button"
<font color="red"> class="dropdown-item btn-secondary button_delete"
id="{{ template.name }}">
<span style="color: red;">
<i class="fa-solid fa-trash"></i>&nbsp;Delete Template <i class="fa-solid fa-trash"></i>&nbsp;Delete Template
</font> </span>
</button> </button>
</div> </div>
</div> </div>
@ -114,16 +110,29 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<!-- /.card-body -->
</div> </div>
<!-- /.card -->
</div> </div>
<!-- /.col -->
</div> </div>
<!-- /.row -->
</div> </div>
</section> <!-- /.container-fluid -->
</section>
{% endblock %}
{% block head_styles %}
<style>
/* Page Specific Overrides */
table.records tbody td:first-of-type,
table.records tbody td:nth-child(0n+2) { text-align: left; }
</style>
{% endblock %} {% endblock %}
{% block extrascripts %} {% block extrascripts %}
<script> <script>
// set up template data table // Initialize DataTables
$("#tbl_template_list").DataTable({ $("#tbl_template_list").DataTable({
"paging": true, "paging": true,
"lengthChange": true, "lengthChange": true,
@ -142,7 +151,7 @@
window.location.href = '{{ url_for('admin.templates') }}'; window.location.href = '{{ url_for('admin.templates') }}';
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block modals %} {% block modals %}