use input type date to swich days in meetings agenda day view (#75017)
gitea/chrono/pipeline/head There was a failure building this commit Details

This commit is contained in:
Thomas Jund 2023-04-27 16:21:21 +02:00 committed by Thomas Jund
parent 006d732479
commit c603e2a180
2 changed files with 13 additions and 5 deletions

View File

@ -5,10 +5,20 @@ $(function() {
$(this).find('.occupation-bar').css('max-width', 100 * booked / total + '%');
});
$('.date-title').on('click', function() {
$(this).parent().find('.date-picker').toggle();
const $datePicker = $(this).parent().find('.date-picker');
$datePicker.toggle();
if ($datePicker.css("display") !== "none" && document.body.classList.contains("dayview")) {
const dateInput = document.querySelector('.date-picker--input');
dateInput.focus();
if (dateInput.showPicker) dateInput.showPicker();
}
});
$('.date-picker-opener').on('click', function() { $('.date-title').trigger('click'); });
$('.date-picker button').on('click', function() {
$('.date-picker button').on('click', function() {
if (document.body.classList.contains("dayview")) {
window.location = '../../../' + $('.date-picker--input').val().replaceAll("-", '/') + '/';
return false;
}
if ($('[name=day]').val()) {
window.location = '../../../' + $('[name=year]').val() + '/' + $('[name=month]').val() + '/' + $('[name=day]').val() + '/';
} else if ($('[name=month]').val()) {

View File

@ -18,9 +18,7 @@
<button class="date-picker-opener"><span class="sr-only">{% trans "Pick a date" %}</span></button>
{% with selected_day=view.date|date:"j" selected_month=view.date|date:"n" selected_year=view.date|date:"Y" %}
<div class="date-picker" style="display: none">
<select name="day">{% for day in view.get_days %}<option value="{{ day }}" {% if selected_day == day %}selected{% endif %}>{{day}}</option>{% endfor %}</select>
<select name="month">{% for month, month_label in view.get_months %}<option value="{{ month }}" {% if selected_month == month %}selected{% endif %}>{{ month_label }}</option>{% endfor %}</select>
<select name="year">{% for year in view.get_years %}<option value="{{ year }}" {% if selected_year == year %}selected{% endif %}>{{year}}</option>{% endfor %}</select>
<input type="date" class="date-picker--input" value="{{ view.date|date:"Y-m-d" }}" />
<button>{% trans 'Set Date' %}</button>
</div>
{% endwith %}