parent
080feb9c6f
commit
2d7d691de3
@ -1,28 +0,0 @@
|
||||
package NGCP::Panel::Widget::DataTable;
|
||||
use Moose::Role;
|
||||
|
||||
has 'template' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
default => 'widgets/data_table.tt'
|
||||
);
|
||||
|
||||
#around handle => sub {
|
||||
# my ($foo, $self, $c) = @_;
|
||||
#
|
||||
# print "++++ AdminBillingOverview::handle\n";
|
||||
# return;
|
||||
#};
|
||||
|
||||
#around filter => sub {
|
||||
# my ($foo, $self, $c) = @_;
|
||||
|
||||
# return $self if(
|
||||
# $c->check_user_roles(qw/administrator/) &&
|
||||
# ref $c->controller eq 'NGCP::Panel::Controller::Dashboard'
|
||||
# );
|
||||
# return;
|
||||
#};
|
||||
|
||||
1;
|
||||
# vim: set tabstop=4 expandtab:
|
||||
@ -1,112 +0,0 @@
|
||||
[% MACRO cf_render BLOCK %]
|
||||
|
||||
[% FOREACH this_field IN cf_form.sorted_fields -%]
|
||||
|
||||
[% IF this_field.id == "contract" -%]
|
||||
|
||||
[% cf_new_table_html( cf_table="cf_table",
|
||||
cf_table_fields=cf_contract_titles ) %]
|
||||
[% cf_new_table_definition( cf_table="cf_table",
|
||||
cf_table_src='/contract/ajax',
|
||||
cf_update_field='contract\\\\.id' ) %]
|
||||
|
||||
[% END %]
|
||||
[% IF this_field.id == "contact" -%]
|
||||
|
||||
[% cf_new_table_html( cf_table="cf_table",
|
||||
cf_table_fields=cf_contact_titles ) %]
|
||||
[% cf_new_table_definition( cf_table="cf_table",
|
||||
cf_table_src='/contact/ajax',
|
||||
cf_update_field='contact\\\\.contact' ) %]
|
||||
|
||||
[%- END %]
|
||||
|
||||
[%- END %]
|
||||
|
||||
[% cf_form.render %]
|
||||
|
||||
[% END %]
|
||||
|
||||
[% MACRO cf_new_table_html BLOCK %]
|
||||
<table class="table table-bordered table-striped table-highlight table-hover" id="[% cf_table %]">
|
||||
<thead>
|
||||
<tr>
|
||||
[% FOREACH t IN cf_table_fields -%]
|
||||
<th>[% t %]</th>
|
||||
[% END -%]
|
||||
[% # one for actions -%]
|
||||
<th class="span2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="sw_action_row">
|
||||
<td>Loading</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
[% END %]
|
||||
|
||||
[% MACRO cf_new_table_definition BLOCK %]
|
||||
|
||||
[% PROCESS "helpers/defines.tt" %]
|
||||
[% ifndef_include_dt %]
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#[% cf_table %]')
|
||||
.dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"bPaginate": true,
|
||||
"bLengthChange": false,
|
||||
"bSort": true,
|
||||
"bInfo": true,
|
||||
"iDisplayLength": 4,
|
||||
"sAjaxSource": "[% c.uri_for( cf_table_src ) %]",
|
||||
|
||||
"aoColumns": [
|
||||
[% FOREACH f IN helper.column_fields -%]
|
||||
{ "sName": "[% f %]" },
|
||||
[% END -%]
|
||||
{ "mRender": function ( data, type, full ) {
|
||||
return '' +
|
||||
'<input type="checkbox"></input>' +
|
||||
'<div class="sw_actions pull-right">' +
|
||||
'<a style="display:inline;line-height:16px;" class="btn btn-small btn-primary">' +
|
||||
'<i class="icon-check" style="line-height:1em;margin-top:2px"></i> Select' +
|
||||
'</a>' +
|
||||
'</div>';
|
||||
},
|
||||
"mData": null,
|
||||
"bSortable": false
|
||||
}
|
||||
],
|
||||
"fnDrawCallback": function( oSettings ) {
|
||||
$('.sw_actions').hide();
|
||||
$('.sw_action_row').hover(
|
||||
function() { $(this).find('.sw_actions').show(); },
|
||||
function() { $(this).find('.sw_actions').hide(); }
|
||||
);
|
||||
},
|
||||
"fnRowCallback": function(nRow, aData, iDisplayIndex) {
|
||||
nRow.className = "sw_action_row";
|
||||
return nRow;
|
||||
},
|
||||
} );
|
||||
|
||||
$('#[% cf_table %] tbody tr').live('click', function () {
|
||||
var id = $(this).find("td:first").text();
|
||||
//alert(".."+id+"..");
|
||||
$("input#[% cf_update_field %]").val(id);
|
||||
$(this).addClass('highlight').siblings().removeClass('highlight');
|
||||
$(this).find("td:eq(4) input[type='checkbox']").attr("checked", true);
|
||||
$(this).siblings().find("td:eq(4) input[type='checkbox']").attr("checked", false);
|
||||
});
|
||||
|
||||
} );
|
||||
</script>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
[% # vim: set tabstop=4 syntax=html expandtab: -%]
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
Yeah!
|
||||
[% c.log.debug("****** am in widgets/data_table.tt now ****** ") %]
|
||||
Loading…
Reference in new issue