aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default/template/rating_user.tpl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/rating_user.tpl88
1 files changed, 71 insertions, 17 deletions
diff --git a/admin/themes/default/template/rating_user.tpl b/admin/themes/default/template/rating_user.tpl
index 7cc36c4fb..a37944aa3 100644
--- a/admin/themes/default/template/rating_user.tpl
+++ b/admin/themes/default/template/rating_user.tpl
@@ -1,12 +1,32 @@
+{combine_script id='jquery.dataTables' load='footer' path='themes/default/js/plugins/jquery.dataTables.js'}
+{html_style}
+.sorting { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_both.png) no-repeat center right; cursor:pointer; }
+.sorting_asc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc.png) no-repeat center right; }
+.sorting_desc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc.png) no-repeat center right; }
+
+.sorting, .sorting_asc, .sorting_desc {
+ padding: 3px 18px 3px 10px;
+}
+.sorting_asc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc_disabled.png) no-repeat center right; }
+.sorting_desc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc_disabled.png) no-repeat center right; }
+
+.dtBar {
+ text-align:left;
+ padding-left: 20px;
+}
+{/html_style}
+
<h2>{$ratings|@count} {'Users'|@translate}</h2>
<form action="{$F_ACTION}" method="GET">
<fieldset>
+<noscript>
<label>{'Sort by'|@translate}
<select name="order_by">
{html_options options=$order_by_options selected=$order_by_options_selected}
</select>
</label>
+</noscript>
<label>{'Number of rates'|@translate}&gt;
<input type="text" size="5" name="f_min_rates" value="{$F_MIN_RATES}">
</label>
@@ -17,37 +37,71 @@
</form>
{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
-{footer_script}{literal}
-function del(elt,uid,aid)
-{
- if (!confirm({/literal}'{'Are you sure?'|@translate|@escape:'javascript'}'{literal}))
+{footer_script}
+var oTable = jQuery('#rateTable').dataTable({
+ sDom : '<"dtBar"f>rt',
+ bPaginate: false,
+ aaSorting: [[4,'desc']],
+ aoColumnDefs: [
+ {
+ aTargets: ["dtc_user"],
+ },
+ {
+ aTargets: ["dtc_stat"],
+ asSorting: ["desc","asc"],
+ bSearchable: false
+ },
+ {
+ aTargets: ["dtc_rate"],
+ asSorting: ["desc","asc"],
+ bSearchable: false
+ },
+ {
+ aTargets: ["dtc_del"],
+ bSortable: false,
+ bSearchable: false
+ }
+ ]
+});
+
+function del(elt,uid,aid){
+ if (!confirm('{'Are you sure?'|@translate|@escape:'javascript'}'))
return false;
var tr = elt;
while ( tr.nodeName != "TR") tr = tr.parentNode;
tr = jQuery(tr).fadeTo(1000, 0.4);
- (new PwgWS({/literal}'{$ROOT_URL|@escape:javascript}'{literal})).callService(
- 'pwg.rates.delete', {user_id:uid, anonymous_id:aid},
+
+ (new PwgWS('{$ROOT_URL|@escape:javascript}')).callService(
+ 'pwg.rates.delete', { user_id:uid, anonymous_id:aid},
{
method: 'POST',
onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); },
- onSuccess: function(result) { if (result) {tr.remove();} else alert(result); }
+ onSuccess: function(result){
+ if (result)
+ oTable.fnDeleteRow(tr[0]);
+ else
+ alert(result);
+ }
}
);
+
return false;
}
-{/literal}{/footer_script}
-<table>
+{/footer_script}
+<table id="rateTable">
+<thead>
<tr class="throw">
- <td>{'Username'|@translate}</td>
- <td>{'Number of rates'|@translate}</td>
- <td>{'Average rate'|@translate}</td>
- <td>{'Variation'|@translate}</td>
- <td>{'Consensus deviation'|@translate|@replace:' ':'<br>'}</td>
+ <td class="dtc_user">{'Username'|@translate}</td>
+ <td class="dtc_stat">{'Number of rates'|@translate}</td>
+ <td class="dtc_stat">{'Average rate'|@translate}</td>
+ <td class="dtc_stat">{'Variation'|@translate}</td>
+ <td class="dtc_stat">{'Consensus deviation'|@translate|@replace:' ':'<br>'}</td>
{foreach from=$available_rates item=rate}
- <td>{$rate}</td>
+ <td class="dtc_rate">{$rate}</td>
{/foreach}
- <td></td>
+ <td class="dtc_del"></td>
</tr>
+</thead>
{foreach from=$ratings item=rating key=user}
<tr>
<td>{$user}</td>
@@ -62,7 +116,7 @@ function del(elt,uid,aid)
<a class="cluetip" title="|{$rate_over|@htmlspecialchars}">{$rates|@count}</a>
{/if}</td>
{/foreach}
- <td><a onclick="return del(this,{$rating.uid},'{$rating.aid}');"><img src="{$themeconf.admin_icon_dir}/delete.png" alt="[{'Delete'|@translate}]"></a></td>
+ <td><a onclick="return del(this,{$rating.uid},'{$rating.aid}');" class="icon-trash"></a></td>
</tr>
{/foreach}
</table>