-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update datatables - Refactor + Fix annoying bug with double sorting/asc/desc - Add new functionality for filtering, cleaning and purging
- Loading branch information
Showing
8 changed files
with
230 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css"> | ||
<script type="text/javascript" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script> | ||
|
||
|
||
|
||
|
||
|
||
<script> | ||
$(document).ready(function(){ | ||
$('[data-table]').DataTable({ | ||
pageLength: 100 | ||
}); | ||
}); | ||
</script> | ||
|
||
<style> | ||
/* Fixes a clash with Bootstrap/Bolt annoying double indicators */ | ||
table.dataTable thead .sorting_asc:after, | ||
table.dataTable thead .sorting_desc:after, | ||
table.dataTable thead .sorting:after { | ||
content: '' !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{% extends '_base/_page-nav.twig' %} | ||
|
||
{% block page_nav title %} | ||
|
||
{% block page_title __(title) %} | ||
|
||
{% block page_main %} | ||
|
||
{{ include('@is_useful/backend/_navigation.twig') }} | ||
|
||
<h3>Filter</h3> | ||
<p>Filter using a part of a message or an IP address. Afterwards you can purge records.</p> | ||
<form class="form-inline" action="{{ path('is_useful.feedback.clean') }}" method="get"> | ||
<input class="form-control" type="text" name="filter" value="{{ app.request.query.get('filter') }}"> | ||
<button class="btn btn-primary" type="submit"> | ||
<i class="fa fa-filter"></i> Filter | ||
</button> | ||
</form> | ||
<hr> | ||
<h3>Clean</h3> | ||
<p>Clean up records. This will remove empty and invalid records.</p> | ||
<form action="{{ path('is_useful.feedback.clean.post') }}" method="post"> | ||
<button class="btn btn-secondary" type="submit"> | ||
<i class="fa fa-ban"></i> Clean | ||
</button> | ||
</form> | ||
|
||
{% if feedback is not empty and app.request.query.get('filter') %} | ||
<hr> | ||
<h3>Purge</h3> | ||
<p>Remove all records that are shown below.</p> | ||
<form action="{{ path('is_useful.feedback.clean.post') }}" method="post"> | ||
<input type="hidden" name="filter" value="{{ app.request.query.get('filter') }}"> | ||
<button class="btn btn-danger" type="submit"> | ||
<i class="fa fa-ban"></i> Remove all records with: [{{ app.request.query.get('filter') }}] | ||
</button> | ||
</form> | ||
<hr> | ||
{% endif %} | ||
|
||
|
||
{% if feedback is not empty %} | ||
<table data-table> | ||
<thead> | ||
<th>Page</th> | ||
<th>IP</th> | ||
<th>Date</th> | ||
<th>Message</th> | ||
{# <th>Actions</th> #} | ||
</thead> | ||
<tbody> | ||
{% for item in feedback %} | ||
{% set ip = item.ip %} | ||
{% set datetime = item.datetime %} | ||
{% set message = item.message %} | ||
{% set deleteLink = path('is_useful.feedback.delete', { id: item.id }) %} | ||
{% set statusReadLink = path('is_useful.feedback.status', { id: item.id, status: 'read' }) %} | ||
{% set statusDoneLink = path('is_useful.feedback.status', { id: item.id, status: 'done' }) %} | ||
{% set viewLink = item.is_useful_id is not empty ? path('is_useful.view', { id: item.is_useful_id }) : '' %} | ||
|
||
<tr> | ||
{% setcontent record = "#{item.contenttype}/#{item.contentid}" %} | ||
<td class="is-useful"> | ||
<a href="{{ viewLink }}" title="View detailed feedback for this page"> | ||
{{ record.title|default('(Untitled)') }} | ||
</a> | ||
</td> | ||
<td class="is-useful-ip">{{ ip }}</td> | ||
<td class="is-useful-datetime">{{ datetime }}</td> | ||
<td class="is-useful-message"> | ||
{% if message is not empty %} | ||
<div class="well well-sm"> | ||
{{ message }} | ||
</div> | ||
{% endif %} | ||
</td> | ||
{# | ||
<td> | ||
<a class="btn btn-secondary" href="{{ statusReadLink }}"><i class="fa fa-eye"></i> <span class="visible-md-inline visible-lg-inline">Mark as read</span></a> | ||
<a class="btn btn-secondary btn-success" href="{{ statusDoneLink }}"><i class="fa fa-check"></i> <span class="visible-md-inline visible-lg-inline">Mark as done</span></a> | ||
<a class="btn btn-tertiary" href="{{ deleteLink }}" onclick="return confirm('Are you sure?')"><i class="fa fa-trash"></i></a> | ||
</td> | ||
#} | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% else %} | ||
|
||
{% endif %} | ||
|
||
{{ include('@is_useful/backend/_datatables.twig') }} | ||
|
||
{% endblock page_main %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters