From d39a073efd3049db9d440adcf342cef9c00c800e Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Wed, 10 Jul 2013 13:49:11 +0200 Subject: [PATCH] Sort subscribers by status. --- lib/NGCP/Panel/Controller/Subscriber.pm | 5 ++--- share/templates/helpers/datatables.tt | 13 +++++++++++++ share/templates/subscriber/list.tt | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 0aa2a034ed..fb228f8d1c 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -152,7 +152,6 @@ sub create_list :Chained('sub_list') :PathPart('create') :Args(0) { } } - $c->log->debug(">>>>>>>>>>>>>>>>>>>>>>>>>> subscriber NOT validated"); $c->stash(close_target => $c->uri_for()); $c->stash(create_flag => 1); $c->stash(form => $form) @@ -182,8 +181,8 @@ sub ajax :Chained('sub_list') :PathPart('ajax') :Args(0) { my $dispatch_to = '_ajax_resultset_' . $c->user->auth_realm; my $resultset = $self->$dispatch_to($c); $c->forward( "/ajax_process_resultset", [$resultset, - ["id", "username", "domain_id", "status",], - ["username", "domain_id", "status",]]); + ["id", "username", "domain_id", "contract_id", "status",], + ["username", "domain_id", "contract_id", "status",]]); $c->detach( $c->view("JSON") ); } diff --git a/share/templates/helpers/datatables.tt b/share/templates/helpers/datatables.tt index 1fb76271c7..e1f475e9c4 100644 --- a/share/templates/helpers/datatables.tt +++ b/share/templates/helpers/datatables.tt @@ -21,6 +21,19 @@ $(document).ready(function() { "bInfo": true, "iDisplayLength": 5, "sAjaxSource": "[% helper.ajax_uri %]", + [% IF helper.column_sort -%] + "aaSorting": [ + [% + FOR f IN helper.column_fields; + IF helper.column_sort == f; + -%] + [ [% loop.index %], "asc" ], + [% + END; + END; + -%] + ], + [% END -%] "aoColumns": [ [% FOREACH f IN helper.column_fields -%] { "mData": "[% f %]" }, diff --git a/share/templates/subscriber/list.tt b/share/templates/subscriber/list.tt index 8b02bc1221..bf9139b637 100644 --- a/share/templates/subscriber/list.tt +++ b/share/templates/subscriber/list.tt @@ -3,8 +3,9 @@ helper.name = 'Subscriber'; helper.data = subscribers; helper.messages = messages; - helper.column_titles = [ '#', 'Username', 'Domain #', 'Status' ]; - helper.column_fields = [ 'id', 'username', 'domain_id', 'status' ]; + helper.column_titles = [ '#', 'Username', 'Domain #', 'Contract #', 'Status' ]; + helper.column_fields = [ 'id', 'username', 'domain_id', 'contract_id', 'status' ]; + helper.column_sort = 'status'; helper.close_target = close_target; helper.create_flag = create_flag;