You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-panel/share/templates/helpers/table_form.tt

72 lines
3.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

[% PROCESS "helpers/create_form.tt" %]
[% PROCESS "helpers/defines.tt" %]
<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>
<a class="btn btn-primary btn-large" href="[% c.uri_for(c.action, c.req.captures, 'search') %]"><i class="icon-search"></i> Search [% 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">
<thead>
<tr>
[% FOREACH t IN helper.column_titles -%]
<th>[% t %]</th>
[% END -%]
[% # one for actions -%]
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH set IN helper.data -%]
<tr class="sw_action_row">
[% FOREACH field IN helper.column_fields -%]
<td>[% set.$field %]</td>
[% END -%]
<td class="span3">
<div class="sw_actions pull-right">
<a class="btn btn-small btn-primary" href="[% c.uri_for(set.id, 'edit') %]" style="display:inline;line-height:16px;"><i class="icon-edit" style="line-height:1em;margin-top:2px"></i> Edit</a>
<a class="btn btn-small btn-secondary" href="[% c.uri_for(set.id, 'delete') %]" data-confirm="Delete" style="display:inline;line-height:16px;"><i class="icon-trash" style="line-height:1em;margin-top:2px"></i> Delete</a>
</div>
</td>
</tr>
[% END -%]
</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>
[% # helper.form_object.render %]
[% cf_render( cf_form=helper.form_object,
cf_contract_fields=helper.contract_fields,
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: -%]