Added sorting and position ùmanagement to modules.

This commit is contained in:
Franck Allimant
2013-12-06 18:59:46 +01:00
parent e96088080d
commit 8c864021f5
9 changed files with 215 additions and 13 deletions

View File

@@ -6,9 +6,60 @@
</caption>
<thead>
<tr>
<th>{intl l="Name"}</th>
<th>{intl l="Description"}</th>
<th>{intl l="Enable/Disable"}</th>
<th>
{admin_sortable_header
current_order=$module_order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/modules'}
request_parameter_name='module_order'
label="{intl l='Name'}"
}
</th>
<th>
{admin_sortable_header
current_order=$module_order
order='code'
reverse_order='code_reverse'
path={url path='/admin/modules'}
request_parameter_name='module_order'
label="{intl l='Code'}"
}
</th>
<th>
{admin_sortable_header
current_order=$module_order
order='title'
reverse_order='title_reverse'
path={url path='/admin/modules'}
request_parameter_name='module_order'
label="{intl l='Description'}"
}
</th>
<th class="text-center">
{admin_sortable_header
current_order=$module_order
order='enabled'
reverse_order='enabled_reverse'
path={url path='/admin/modules'}
request_parameter_name='module_order'
label="{intl l='Enable/Disable'}"
}
</th>
<th class="text-center">
{admin_sortable_header
current_order=$module_order
order='manual'
reverse_order='manual_reverse'
path={url path='/admin/modules'}
request_parameter_name='module_order'
label="{intl l='Position'}"
}
</th>
{module_include location='modules_table_header'}
@@ -17,11 +68,13 @@
</thead>
<tbody>
{loop type="module" name="module.{$module_type}" module_type={$module_type|default:1} backend_context=1}
{loop type="module" name="module.{$module_type}" module_type={$module_type|default:1} order=$module_order backend_context=1}
<tr>
<td><a href="#">{$TITLE}</a></td>
<td>{$TITLE}</td>
<td>{$CODE}</td>
<td>{$CHAPO}</td>
<td>
<td class="text-center">
<div class="make-switch switch-small module-activation" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>">
<input type="checkbox" {if $ACTIVE}checked{/if}>
</div>
@@ -34,6 +87,18 @@
</noscript>
</td>
<td class="text-center">
{admin_position_block
resource="admin.modules"
access="UPDATE"
path={url path="admin/module/update-position"}
url_parameter="module_id"
in_place_edit_class="modulePositionChange"
position=$POSITION
id=$ID
}
</td>
{module_include location='modules_table_row'}
<td class="text-right">

View File

@@ -80,6 +80,10 @@
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(document).ready(function() {
var url_management = "{url path="/admin/module/toggle-activation/"}";
@@ -112,6 +116,28 @@
$(".module-delete-action").click(function(){
$("#delete_module_id").val($(this).data("id"));
});
{* Inline editing of object position using bootstrap-editable *}
$('.modulePositionChange').editable({
type : 'text',
title : '{intl l="Enter new module position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url noamp='1' path='/admin/modules/update-position' module_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id'))
.replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
});
</script>
{/block}