fixes #2229 created date filter, handle parent and child dates

Add and outline check for parent date and grey check for child dates
This commit is contained in:
Linty
2024-09-19 18:00:07 +02:00
parent 874db88b5d
commit 634711ca3a
2 changed files with 10 additions and 28 deletions
+7 -25
View File
@@ -189,7 +189,6 @@ $(document).ready(function () {
// On custom date input select
$(".custom_posted_date .date_posted-option input").change(function() {
const parentOption = $(this).parent();
const currentYear = $(this).data('year');
const selector = `.custom_posted_date #container_${currentYear}`;
@@ -256,6 +255,10 @@ $(document).ready(function () {
date_created_str += ', ';
}
});
$('.date_created-option.year').each(function () {
updateDateFilters(`.custom_created_date #${$(this).attr('id')}`);
});
}
// change badge label if filter not empty
@@ -297,30 +300,9 @@ $(document).ready(function () {
// On custom date input select
$(".custom_created_date .date_created-option input").change(function() {
var parentOption = $(this).parent()
if($(this).is(":checked")){
// Toggle tick icon on selected date in custom list
$(this).siblings('label').find('.checked-icon').show();
// Add class selected to selected option,
// We want to find which are selected to handle the others
$(this).addClass('selected')
$(parentOption).addClass('selected')
$(parentOption).find('.mcs-icon').addClass('selected')
}
else
{
// Toggle tick icon on selected date in custom list
$(this).siblings('label').find('.checked-icon').hide();
// Add class selected to selected option,
// We want to find which are selected to handle the others
$(this).removeClass('selected')
$(parentOption).removeClass('selected')
$(parentOption).find('.mcs-icon').removeClass('selected')
}
// if this is selected then disable selecting children, and display grey tick
const currentYear = $(this).data('year');
const selector = `.custom_created_date #container_${currentYear}`;
updateDateFilters(selector);
// Used to select custom in preset list if dates are selected
if($('.custom_created_date input:checked').length > 0)
@@ -403,7 +403,7 @@ const prefix_icon = 'gallery-icon-';
{foreach from=$LIST_DATE_CREATED key=y item=year}
<div class="date_created-option year" id="container_{$y}">
<div class="year_input">
<input type="checkbox" id="date_created_{$y}" value='y{$y}'>
<input type="checkbox" id="date_created_{$y}" value='y{$y}' data-year="{$y}">
<i class="gallery-icon-up-open accordion-toggle" data-type='year'></i>
<label for="date_created_{$y}" id="{$y}">
<span class="date-period">{$year.label}</span>
@@ -416,7 +416,7 @@ const prefix_icon = 'gallery-icon-';
{foreach from=$year.months key=m item=month}
<div class="date_created-option month" id="container_{$m}">
<div class="month_input">
<input type="checkbox" id="date_created_{$m}" value='m{$m}'>
<input type="checkbox" id="date_created_{$m}" value='m{$m}' data-year="{$y}">
<i class="gallery-icon-up-open accordion-toggle" data-type='month'></i>
<label for="date_created_{$m}" id="{$m}">
<span class="date-period">{$month.label}</span>
@@ -428,7 +428,7 @@ const prefix_icon = 'gallery-icon-';
<div class="days_container">
{foreach from=$month.days key=d item=day}
<div class="date_created-option day" id="container_{$d}">
<input type="checkbox" id="date_created_{$d}" value='d{$d}'>
<input type="checkbox" id="date_created_{$d}" value='d{$d}' data-year="{$y}">
<label for="date_created_{$d}" id="{$d}">
<span class="date-period">{$day.label}</span>
<span class="date_created-badge">{$day.count}</span>