aboutsummaryrefslogtreecommitdiffstats
path: root/templates/staff/tables/table.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/staff/tables/table.html')
-rw-r--r--templates/staff/tables/table.html165
1 files changed, 165 insertions, 0 deletions
diff --git a/templates/staff/tables/table.html b/templates/staff/tables/table.html
new file mode 100644
index 00000000..aa26818f
--- /dev/null
+++ b/templates/staff/tables/table.html
@@ -0,0 +1,165 @@
+{% extends "main/base.html" %}
+{% block title %}Staff | Home{% endblock %}
+{% block og_title %}Staff | Home{% endblock %}
+{% block og_description %}Landing page for the staff management area{% endblock %}
+{% block content %}
+ <div class="uk-container uk-section uk-container-small">
+ <a class="uk-button uk-button-default" href="{{ url_for("staff.tables.index") }}"><i class="uk-icon fa-fw fas fa-arrow-left"></i> &nbsp;Back</a>
+
+ {% if page == "all" %}
+ <a class="uk-button uk-button-dark" href="{{ url_for("staff.tables.table", table=table, page=1) }}"><i class="uk-icon fa-fw fas fa-bars"></i> &nbsp;Page 1</a>
+ {% else %}
+ <a class="uk-button uk-button-dark" href="{{ url_for("staff.tables.table", table=table, page="all") }}"><i class="uk-icon fa-fw fas fa-bars"></i> &nbsp;All Data</a>
+ {% endif %}
+
+ {% if not table_obj.locked %}
+ <a class="uk-button uk-button-primary" href="{{ url_for("staff.tables.edit", table=table) }}"><i class="uk-icon fa-fw fas fa-plus"></i> &nbsp;Add</a>
+ {% endif %}
+
+ <h1 class="uk-title uk-text-center">
+ <span style="font-family: monospace">
+ {{ table }}
+
+ {% if table_obj.locked %}
+ <i class="uk-icon fa-fw fas fa-lock" title="Table locked for editing"></i>
+ {% endif %}
+ </span>
+ </h1>
+
+ <form action="{{ url_for("staff.tables.table", table=table, page="all") }}" method="get" class="uk-width-1-1">
+ <div class="uk-form-custom uk-width-1-1 uk-flex">
+ {% if search %}
+ <input class="uk-input uk-width-expand" name="search" type="text" placeholder="Search (RE2)" value="{{ search }}" />
+ {% else %}
+ <input class="uk-input uk-width-expand" name="search" type="text" placeholder="Search (RE2)" />
+ {% endif %}
+
+ <div class="uk-width-auto uk-flex-auto">
+ <select class="uk-select uk-width-1-1" name="search-key" title="Table Key">
+ <option style="font-weight: bold;">{{ table_obj.primary_key }}</option>
+ {% for key in table_obj.keys %}
+ {% if key != table_obj.primary_key %}
+ {% if search_key == key %}
+ <option selected>{{ key }}</option>
+ {% else %}
+ <option>{{ key }}</option>
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ </select>
+ </div>
+
+ <button class="uk-button uk-button-primary uk-width-auto" type="submit"><i class="uk-icon fas fa-search"></i></button>
+ <a class="uk-button uk-button-dark uk-width-auto" target="_blank" href="https://github.com/google/re2/wiki/Syntax"><i class="uk-icon fas fa-question-circle"></i></a>
+ </div>
+ </form>
+
+ {% macro paginate() %}
+ {% if pages != "all" %}
+ <ul class="uk-pagination uk-flex-center" uk-margin>
+ {% if page > 1 %}
+ <li><a href="{{ url_for("staff.tables.table", table=table, page=page - 1) }}"><span uk-pagination-previous></span></a></li>
+ {% else %}
+ <li class="uk-disabled"><a><span uk-pagination-previous></span></a></li>
+ {% endif %}
+
+ {% if page == 1 %}
+ <li class="uk-active"><a href="{{ url_for("staff.tables.table", table=table, page=1) }}">1</a></li>
+ {% else %}
+ <li><a href="{{ url_for("staff.tables.table", table=table, page=1) }}">1</a></li>
+ {% endif %}
+
+ {% if page >= 5 %}
+ <li class="uk-disabled"><a>...</a></li>
+ {% endif %}
+
+ {% set current_page = page - 2 %}
+
+ {% for num in range(5) %}
+ {% if current_page + num > 1 and current_page + num < pages %}
+ {% if current_page + num == page %}
+ <li class="uk-active"><a href="{{ url_for("staff.tables.table", table=table, page=current_page + num) }}">{{ current_page + num }}</a></li>
+ {% else %}
+ <li><a href="{{ url_for("staff.tables.table", table=table, page=current_page + num) }}">{{ current_page + num }}</a></li>
+ {% endif %}
+ {% endif %}
+ {% set current_page = current_page - 1 %}
+ {% endfor %}
+
+ {% if pages - page > 3 %}
+ <li class="uk-disabled"><a>...</a></li>
+ {% endif %}
+
+ {% if pages != 1 %}
+ {% if page == pages %}
+ <li class="uk-active"><a href="{{ url_for("staff.tables.table", table=table, page=pages) }}">{{ pages }}</a></li>
+ {% else %}
+ <li><a href="{{ url_for("staff.tables.table", table=table, page=pages) }}">{{ pages }}</a></li>
+ {% endif %}
+ {% endif %}
+
+ {% if page < pages %}
+ <li><a href="{{ url_for("staff.tables.table", table=table, page=page + 1) }}"><span uk-pagination-next></span></a></li>
+ {% else %}
+ <li class="uk-disabled"><a><span uk-pagination-next></span></a></li>
+ {% endif %}
+ </ul>
+ {% endif %}
+ {% endmacro %}
+
+ {{ paginate() }}
+
+ </div>
+ <div class="uk-container uk-section">
+ {% if documents %}
+ <table class="uk-table uk-table-striped uk-overflow-auto">
+ <thead>
+ <tr>
+ {% if not table_obj.locked %}
+ <th class="uk-table-shrink uk-text-center">
+ <i class="uk-icon fa-fw fas fa-pencil"></i>
+ </th>
+ {% endif %}
+
+ {% for key in table_obj.keys %}
+ <th title="{{ key }}">
+ {% if key == table_obj.primary_key %}
+ <strong>{{ key }}</strong>
+ {% else %}
+ {{ key }}
+ {% endif %}
+ </th>
+ {% endfor %}
+ </tr>
+ </thead>
+ <tbody>
+ {% for doc in documents %}
+ <tr>
+ {% if not table_obj.locked %}
+ <td class="uk-table-shrink">
+ <a href="{{ url_for("staff.tables.edit", table=table, key=doc[table_obj.primary_key]) }}">
+ <i class="uk-icon fa-fw fas fa-pencil"></i>
+ </a>
+ </td>
+ {% endif %}
+
+ {% for key in table_obj.keys %}
+ <td class="uk-text-truncate" style="font-family: monospace" title="{{ doc[key] }}">
+ {% if key == table_obj.primary_key %}
+ <strong>{{ doc[key] }}</strong>
+ {% else %}
+ {{ doc[key] }}
+ {% endif %}
+ </td>
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% else %}
+ <p class="uk-text-center">No documents found</p>
+ {% endif %}
+
+ {{ paginate() }}
+ </div>
+{% endblock %} \ No newline at end of file