|
|
[% PROCESS "helpers/create_form.tt" %]
|
|
|
[% PROCESS "helpers/defines.tt" %]
|
|
|
|
|
|
[% ifndef_include_dt %]
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
$('#maintable')
|
|
|
.dataTable( {
|
|
|
"bProcessing": true,
|
|
|
"bServerSide": true,
|
|
|
"bPaginate": true,
|
|
|
"bLengthChange": false,
|
|
|
"bSort": true,
|
|
|
"bInfo": true,
|
|
|
"iDisplayLength": 5,
|
|
|
"sAjaxSource": "[% c.uri_for( c.controller.action_for('ajax') ) %]",
|
|
|
|
|
|
"aoColumns": [
|
|
|
[% FOREACH f IN helper.column_fields -%]
|
|
|
{ "sName": "[% f %]" },
|
|
|
[% END -%]
|
|
|
{ "mRender": function ( data, type, full ) {
|
|
|
return '' +
|
|
|
'<div class="sw_actions pull-right">' +
|
|
|
'<a style="display:inline;line-height:16px;" class="btn btn-small btn-primary" href="[% c.uri_for( c.controller.action_for("") ) %]/' + full[0] + '/edit">' +
|
|
|
'<i class="icon-edit" style="line-height:1em;margin-top:2px"></i> Edit' +
|
|
|
'</a>' +
|
|
|
'<a style="display:inline;line-height:16px;margin-left:5px;" class="btn btn-small btn-secondary" href="[% c.uri_for( c.controller.action_for("") ) %]/' + full[0] + '/delete">' +
|
|
|
'<i class="icon-trash" style="line-height:1em;margin-top:2px"></i> Delete' +
|
|
|
'</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;
|
|
|
},
|
|
|
} );
|
|
|
|
|
|
} );
|
|
|
</script>
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
<a class="btn btn-primary btn-large" href="[% c.uri_for(c.action, c.req.captures, 'create') %]"><i class="icon-star"></i> Create [% helper.name %]</a>
|
|
|
</div>
|
|
|
[% IF helper.messages -%]
|
|
|
<div class="row">
|
|
|
[% FOREACH m IN helper.messages -%]
|
|
|
<div class="alert alert-[% m.type %]">[% m.text %]</div>
|
|
|
[% END -%]
|
|
|
</div>
|
|
|
[% END -%]
|
|
|
<div class="row">
|
|
|
<table class="table table-bordered table-striped table-highlight table-hover" id="maintable">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
[% FOREACH t IN helper.column_titles -%]
|
|
|
<th>[% t %]</th>
|
|
|
[% END -%]
|
|
|
[% # one for actions -%]
|
|
|
<th class="span3"></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
<tr class="sw_action_row">
|
|
|
<td>Loading</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
[% IF helper.edit_object || helper.create_flag == 1 -%]
|
|
|
<div id="mod_edit" class="modal hide" style="display:block">
|
|
|
<div class="modal-header">
|
|
|
<button id="mod_close" type="button" class="close">×</button>
|
|
|
<h3>[% helper.create_flag == 1 ? 'Create' : 'Edit' %] [% helper.name %]</h3>
|
|
|
</div>
|
|
|
[% cf_render( cf_form=helper.form_object,
|
|
|
cf_contract_titles=helper.contract_titles,
|
|
|
cf_contact_titles=helper.contact_titles ) %]
|
|
|
</div>
|
|
|
<script>
|
|
|
$(function () {
|
|
|
$('#mod_edit').modal({keyboard: false, backdrop: 'static'});
|
|
|
$('#mod_close').click(function(event) {
|
|
|
window.location.href="[% helper.close_target ? helper.close_target : c.uri_for() %]";
|
|
|
});
|
|
|
|
|
|
// on clicking a button within the form, add a hidden field "submitid"
|
|
|
// determining the name of the button being clicked
|
|
|
$('input[type=button]').click(function() {
|
|
|
$(this).parents('form').find('#submitid').attr('value', $(this).attr('name'));
|
|
|
$(this).parents('form').submit();
|
|
|
});
|
|
|
});
|
|
|
</script>
|
|
|
[% END -%]
|
|
|
[% # vim: set tabstop=4 syntax=html expandtab: -%]
|
|
|
|