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>'; $html .= '<tr>';
$i = 0; $i = 0;
foreach($tr as $td) { 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>'; $html .= '</tr>';
} }

View File

@ -6,6 +6,8 @@
* *
* @author Rémi Jean <remi.jean@outlook.com> * @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean * @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 * @license GNU General Public License, version 3
* @link http://zwiicms.com/ * @link http://zwiicms.com/
*/ */
@ -62,11 +64,18 @@ directoryDOM.on("change", function() {
/** /**
* Tri de la galerie * Tri dynamique de la galerie
*/ */
$( document ).ready(function() { $( document ).ready(function() {
$('tbody > tr').sort(function (a, b) { var $tbody = $('#galleryTable tbody');
return +$('td#pos3', b).text() > +$('td#pos3', a).text(); $tbody.find('tr').sort(function (a, b) {
}).appendTo('tbody'); 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>
</div> </div>
<?php if($module::$galleries): ?> <?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 else: ?>
<?php echo template::speech('Aucune galerie.'); ?> <?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -17,7 +17,7 @@
<div class="block"> <div class="block">
<h4>Informations générales</h4> <h4>Informations générales</h4>
<div class="row"> <div class="row">
<div class="col4"> <div class="col5">
<?php echo template::text('galleryEditName', [ <?php echo template::text('galleryEditName', [
'label' => 'Nom', 'label' => 'Nom',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'name']) 'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'name'])
@ -33,13 +33,13 @@
'noDirty' => true // Désactivé à cause des modifications en ajax 'noDirty' => true // Désactivé à cause des modifications en ajax
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col3">
<?php echo template::select('galleryEditSort', $module::$sort, [ <?php echo template::select('galleryEditSort', $module::$sort, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort']), 'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort']),
'label' => 'Tri des images', 'label' => 'Tri des images',
'help' => 'Les images sont triées par nom de fichier grâce à la méthode naturelle qui donne de meilleurs résultats lorsque les images sont numérotées.' 'help' => 'Les images sont triées par nom de fichier grâce à la méthode naturelle qui donne de meilleurs résultats lorsque les images sont numérotées.'
]); ?> ]); ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

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