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

157 lines
5.6 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.

<style type="text/css" scoped="scoped">
body {
overflow-y: scroll;
}
.entry-disabled {
text-decoration: line-through;
}
</style>
<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 style="margin-top:10px;"></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="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" style="visibility:hidden;">
<a style="display:inline;line-height:16px;" class="btn btn-small btn-primary" href="[% c.uri_for(helper.domain_id,'preferences', r.id, 'edit') %]"><i class="icon-edit" style="line-height:1em;margin-top:2px"></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 -%]
<div id="mod_edit" class="modal hide" style="display:block">
<div class="modal-header">
<button id="mod_close" type="button" class="close">×</button>
<h3>Edit Preference [% helper.preference_meta.attribute %]</h3>
</div>
[% 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="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 %]
</div>
<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: -%]