Lists and Templates overviews refactored to use ajax. Before the refactoring, they behaved and looked a bit different to the other (Ajax) tables. The main difference in the behavior was in the row numbers (1st column) when sort order was switched. The non-ajax tables rearranged the numbers in the 1st column while the ajax-tables didn't.

Some small tweaks in table-helpers to allow selecting which fields are pulled from DB (and how they are renamed).
This commit is contained in:
Tomas Bures 2017-04-16 03:22:32 -04:00
parent e5190c9b20
commit 9fdf52674e
12 changed files with 246 additions and 192 deletions

View file

@ -12,57 +12,26 @@
<hr>
<div class="table-responsive">
<table class="table table-bordered table-hover data-table display nowrap" width="100%" data-row-sort="0,1,1,1,0,0">
<table data-topic-url="/lists" data-sort-column="1" data-sort-order="asc" class="table table-bordered table-hover data-table-ajax display nowrap" width="100%" data-row-sort="0,1,1,1,0,0">
<thead>
<th>
#
</th>
<th>
{{#translate}}Name{{/translate}}
</th>
<th>
{{#translate}}ID{{/translate}}
</th>
<th>
{{#translate}}Subscribers{{/translate}}
</th>
<th>
{{#translate}}Description{{/translate}}
</th>
<th>
&nbsp;
</th>
<th class="col-md-1">
#
</th>
<th>
{{#translate}}Name{{/translate}}
</th>
<th>
{{#translate}}ID{{/translate}}
</th>
<th>
{{#translate}}Subscribers{{/translate}}
</th>
<th>
{{#translate}}Description{{/translate}}
</th>
<th class="col-md-1">
&nbsp;
</th>
</thead>
{{#if rows}}
<tbody>
{{#each rows}}
<tr>
<th scope="row">
{{index}}
</th>
<td style="width: 30%;">
<span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span>
<a href="/lists/view/{{id}}">
{{name}}
</a>
</td>
<td>
<code>{{cid}}</code>
</td>
<td class="text-center">
{{subscribers}}
</td>
<td class="text-muted" style="width: 70%;">
{{description}}
</td>
<td>
<a href="/lists/edit/{{id}}">
{{#translate}}Edit{{/translate}}
</a>
</td>
</tr>
{{/each}}
</tbody>
{{/if}}
</table>
</div>

View file

@ -12,7 +12,7 @@
<hr>
<div class="table-responsive">
<table class="table table-bordered table-hover data-table display nowrap" width="100%" data-row-sort="0,1,0,0">
<table data-topic-url="/templates" data-sort-column="1" data-sort-order="asc" class="table table-bordered table-hover data-table-ajax display nowrap" width="100%" data-row-sort="0,1,0,0">
<thead>
<th class="col-md-1">
#
@ -27,28 +27,5 @@
&nbsp;
</th>
</thead>
{{#if rows}}
<tbody>
{{#each rows}}
<tr>
<th scope="row">
{{index}}
</th>
<td>
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> {{name}}
</td>
<td>
<p class="text-muted">{{description}}</p>
</td>
<td>
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
<a href="/templates/edit/{{id}}">
{{#translate}}Edit{{/translate}}
</a>
</td>
</tr>
{{/each}}
</tbody>
{{/if}}
</table>
</div>