This commit is contained in:
fredtempez 2020-03-08 18:19:52 +01:00
parent b3595f144c
commit c8040983a6
6 changed files with 45 additions and 11 deletions

View File

@ -3332,7 +3332,7 @@ class template {
$html .= '<tr>';
$i = 0;
foreach($tr as $td) {
$html .= '<td id="pos' . ($i+1) . '" class="col' . $cols[$i++] . '">' . $td . '</td>';
$html .= '<td " class="pos' . ($i+1) . ' col' . $cols[$i++] . '">' . $td . '</td>';
}
$html .= '</tr>';
}

View File

@ -6,6 +6,8 @@
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
@ -62,11 +64,18 @@ directoryDOM.on("change", function() {
/**
* Tri de la galerie
* Tri dynamique de la galerie
*/
$( document ).ready(function() {
$('tbody > tr').sort(function (a, b) {
return +$('td#pos3', b).text() > +$('td#pos3', a).text();
}).appendTo('tbody');
var $tbody = $('#galleryTable tbody');
$tbody.find('tr').sort(function (a, b) {
var tda = $(a).find('td.pos3:eq(0)').text();
var tdb = $(b).find('td.pos3:eq(0)').text();
// if a < b return 1
return tda > tdb ? 1
// else if a > b return -1
: tda < tdb ? -1
// else they are equal - return 0
: 0;
}).appendTo($tbody);
});

View File

@ -45,7 +45,7 @@
</div>
</div>
<?php if($module::$galleries): ?>
<?php echo template::table([4, 6,1, 1, 1], $module::$galleries, ['Nom', 'Dossier cible', 'Ordre', '', '']); ?>
<?php echo template::table([4, 6,1, 1, 1], $module::$galleries, ['Nom', 'Dossier cible', 'Ordre', '', ''], ['id' => 'galleryTable']); ?>
<?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?>

View File

@ -17,7 +17,7 @@
<div class="block">
<h4>Informations générales</h4>
<div class="row">
<div class="col4">
<div class="col5">
<?php echo template::text('galleryEditName', [
'label' => 'Nom',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'name'])
@ -33,7 +33,7 @@
'noDirty' => true // Désactivé à cause des modifications en ajax
]); ?>
</div>
<div class="col4">
<div class="col3">
<?php echo template::select('galleryEditSort', $module::$sort, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort']),
'label' => 'Tri des images',

View File

@ -0,0 +1,25 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @authorFrédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
$( document ).ready(function() {
/*
asc=false;
var sorted=$('.pictureBox').sort(function(a,b){
return (asc ==
($(a).data('sort') < $(b).data('sort'))) ? 1 : -1;
});
asc = asc ? false : true;
$('body').html(sorted);
*/
});

View File

@ -5,7 +5,7 @@
<?php if($i % 2 === 1): ?>
<div class="row">
<?php endif; ?>
<div class="col6">
<div class="col6" div="pos<?php echo $gallery['config']['order']; ?>" >
<a
href="<?php echo helper::baseUrl() . $this->getUrl(0); ?>/<?php echo $galleryId; ?>"
class="galleryPicture"