Added change order tpl
This commit is contained in:
parent
80d76d2127
commit
6220d8a4f0
1 changed files with 76 additions and 0 deletions
76
templates/admin/change_order_scripts.phtml
Normal file
76
templates/admin/change_order_scripts.phtml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<%inherit file="dashboard.phtml"/>
|
||||
<%block name="content">
|
||||
<p><a href="${url_for('admin_app.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> <a href="${url_for('admin_app.pastafari2_edit_update', server_id=server_data['id'])}">${server_data['hostname']}</a></p>
|
||||
<div id="scripts_list" class="form">
|
||||
% for script in scripts:
|
||||
|
||||
<p><label>${script['name']}</label>: <span class="position" id="position_${script['id']}">${script['position']}</span></p>
|
||||
|
||||
% endfor
|
||||
</div>
|
||||
<p><input type="button" value="${lang('pastafari2', 'change_scripts_order', 'Change scripts order')}" id="change_order" /></p>
|
||||
<p><a href="${url_for('admin_app.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> <a href="${url_for('admin_app.pastafari2_edit_update', server_id=server_data['id'])}">${server_data['hostname']}</a></p>
|
||||
</%block>
|
||||
<%block name="jscript_block">
|
||||
<script type="text/javascript" src="${make_media_url('js/Sortable.min.js', 'pastafari2')}"></script>
|
||||
<script>
|
||||
sortable_list=document.getElementById('scripts_list');
|
||||
|
||||
sortable_var=new Sortable(sortable_list, {
|
||||
animation: 150,
|
||||
/*ghostClass: 'blue-background-class'*/
|
||||
});
|
||||
|
||||
$('#change_order').click(function () {
|
||||
|
||||
$('#layer_loading').show();
|
||||
|
||||
var order_id=[];
|
||||
|
||||
$('.position').each(function () {
|
||||
|
||||
var item_id=$(this).attr('id').replace('postion_', '');
|
||||
|
||||
order_id.push(item_id);
|
||||
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url:"",
|
||||
data: {order_id: JSON.stringify(order_id)},
|
||||
success: function (data) {
|
||||
|
||||
$('#layer_loading').hide();
|
||||
|
||||
if(!data.error) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
alert(data.txt_error);
|
||||
|
||||
}
|
||||
|
||||
//$('#layer_loading').hide();
|
||||
|
||||
},
|
||||
error: function (data) {
|
||||
|
||||
$('#layer_loading').hide();
|
||||
alert('Error: '+data.status+' '+data.statusText);
|
||||
|
||||
},
|
||||
dataType: 'json',
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</%block>
|
||||
Loading…
Add table
Add a link
Reference in a new issue