Sélection par séance, réordonnancement et exclusion vie du labo
This commit is contained in:
@@ -2,6 +2,49 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Drag-and-drop reordering of items within each category list.
|
||||
// The submit order of checkboxes follows DOM order, and the exporter
|
||||
// renders each section in stored order — so reordering rows here is enough
|
||||
// for the new order to appear in the generated HTML after saving.
|
||||
// -------------------------------------------------------------------------
|
||||
function makeSortable($container, itemSelector) {
|
||||
if (!$.fn.sortable) return;
|
||||
$container.sortable({
|
||||
items: itemSelector,
|
||||
handle: '.thalim-nl-drag-handle',
|
||||
axis: 'y',
|
||||
containment: 'parent',
|
||||
tolerance: 'pointer',
|
||||
cursor: 'grabbing',
|
||||
opacity: 0.9,
|
||||
placeholder: 'thalim-nl-sortable-placeholder',
|
||||
forcePlaceholderSize: true,
|
||||
});
|
||||
}
|
||||
|
||||
function initSortable() {
|
||||
var $root = $('#thalim-nl-sections-wrap');
|
||||
|
||||
$root.find('.thalim-nl-section-body').each(function () {
|
||||
var $body = $(this);
|
||||
if ($body.find('.thalim-nl-seminar-group').length) {
|
||||
// Seminars: reorder whole seminars (séances stay chronological).
|
||||
makeSortable($body, '> .thalim-nl-seminar-group');
|
||||
} else {
|
||||
// Normal categories: reorder post rows.
|
||||
makeSortable($body, '> .thalim-nl-post-row');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// A click on the drag handle must not toggle its enclosing checkbox label.
|
||||
$(document).on('click', '.thalim-nl-drag-handle', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(initSortable);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Month change → AJAX reload sections + update TinyMCE intro
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -24,6 +67,7 @@
|
||||
if (!response.success) return;
|
||||
|
||||
$wrap.html(response.data.html);
|
||||
initSortable();
|
||||
|
||||
// Update TinyMCE intro — do NOT re-render wp_editor
|
||||
var introEditor = typeof tinymce !== 'undefined' && tinymce.get('thalim_nl_intro');
|
||||
|
||||
Reference in New Issue
Block a user