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/pref_table.tt

151 lines
5.3 KiB

<a href="[% c.uri_for() %]">&lt; Back</a>
[% 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="ngcp-separator"></div>
<div class="accordion" id="preference_groups">
[% FOREACH group IN helper.pref_groups %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#preference_groups" href="#collapse[% group.id %]">[% group.name %]</a>
</div>
<div class="accordion-body collapse" id="collapse[% group.id %]">
<div class="accordion-inner">
<table class="table table-bordered table-striped table-highlight table-hover" id="preferences_table[% group.id %]">
<thead>
<tr>
[% # one for description -%]
<th></th>
<th>Name</th>
<th>Value</th>
[% # one for actions -%]
<th class="span3"></th>
</tr>
</thead>
<tbody>
[% FOREACH r IN group.prefs %]
[% NEXT IF r.voip_preference_groups_id != group.id %]
<tr class="sw_action_row">
<td>
<a href="#" onclick="$.msgbox(
'[% r.description.squote | html %]',
{
type:'info',
buttons:[
{type:'cancel',value:'Close'}
]
}); return false;"><i class="icon-question-sign"></i></a>
</td>
<td>
[% r.attribute %]
</td>
<td>
[% IF r.data_type == "boolean" %]
<input type="checkbox" disabled="disabled"
[% IF r.value %]checked="checked"[% END %]/>
[% ELSIF r.data_type == "string" || r.data_type == "int" %]
[% IF r.max_occur == 1 %]
[% r.value %]
[% ELSE %]
[% FOR value IN r.value -%]
[% IF value.substr(0,1) == '#' -%]
<span class="ngcp-entry-disabled">[% value.substr(1) %]</span>
[% ELSE -%]
[% value %]
[% END -%]
<br/>
[% END %]
[% END %]
[% ELSIF r.data_type == "enum" %]
<select disabled="disabled">
[% FOREACH e IN r.enums %]
<option [% IF r.value == e.value || (!r.value.defined && e.default_val == 1) %]selected="selected"[% END %]>[% e.label %]</option>
[% END %]
</select>
[% END %]
</td>
<td>
<div class="sw_actions pull-right">
<a class="btn btn-small btn-primary" href="[% c.uri_for(helper.domain_id,'preferences', r.id, 'edit') %]"><i class="icon-edit"></i> Edit</a>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
[% END %]
</div>
<script type="text/javascript">
$(function() {
$('#preference_groups').on('shown', function (e) {
localStorage.setItem('lastTab', $("#preference_groups .in").attr('id'));
});
//go to the latest tab, if it exists:
var lastTab = localStorage.getItem('lastTab');
if (lastTab) {
$('#'+lastTab).addClass("in");//collapse("show"); collapse does annoying animation
}
});
</script>
[% IF helper.edit_preference -%]
[%
PROCESS "helpers/modal.tt";
modal_header(m.create_flag=0,
m.name = "Preference " _ helper.preference_meta.attribute);
-%]
[% IF helper.preference_meta.max_occur != 1 %]
<div class="modal-body">
[% FOREACH v IN helper.preference.all %]
[% IF v.value.substr(0,1) == '#' %]
<input type="text" value="[% v.value.substr(1) %]" disabled="disabled" class="ngcp-entry-disabled"></input>
[% ELSE %]
<input type="text" value="[% v.value %]" disabled="disabled"></input>
[% END %]
<a href="?delete=[% v.id %]"><i class="icon-trash"></i></a>
[% IF v.value.substr(0,1) == '#' %]
<a href="?activate=[% v.id %]"><i class="icon-ok"></i></a>
[% ELSE %]
<a href="?deactivate=[% v.id %]"><i class="icon-ban-circle"></i></a>
[% END %]
<br />
[% END %]
<form action="[% helper.form.action %]" method="post">
[% helper.form.fields.2.render %]
<span class="">[% helper.form.field("add").render %]</span>
</form>
</div>
[% ELSE %]
[% helper.form.render -%]
[% END %]
[%
modal_footer();
-%]
<script>
$(function () {
$('#mod_edit').modal({keyboard: false, backdrop: 'static'});
$('#mod_close').click(function(event) {
window.location.href="[% c.uri_for(helper.domain_id, 'preferences') %]";
});
});
</script>
[% END -%]
[% # vim: set tabstop=4 syntax=html expandtab: -%]