Commit d82c419f by Etienne Freiss

Merge branch 'evolution_bdm' into ticket_1727

parents 7c1eda7d 49b745b2
Pipeline #1546 failed with stage
in 1 minute 27 seconds
...@@ -193,5 +193,5 @@ td{ ...@@ -193,5 +193,5 @@ td{
#calendar_explaination_button { #calendar_explaination_button {
max-width: 60%; max-width: 60%;
margin: 2rem auto -1rem auto; margin: 2rem auto 0.5rem auto;
} }
\ No newline at end of file
...@@ -178,7 +178,7 @@ function init_shifts_list() { ...@@ -178,7 +178,7 @@ function init_shifts_list() {
function init_calendar_page() { function init_calendar_page() {
let template_explanations = $("#calendar_explaination_template"); let template_explanations = $("#calendar_explaination_template");
if (vw <= 768) { if (vw <= 992) {
$(".loading-calendar").show(); $(".loading-calendar").show();
$("#calendar_explaination_area").hide(); $("#calendar_explaination_area").hide();
...@@ -188,10 +188,10 @@ function init_calendar_page() { ...@@ -188,10 +188,10 @@ function init_calendar_page() {
closeModal, closeModal,
"J'ai compris" "J'ai compris"
); );
}); }).show();
} else { } else {
$("#calendar_explaination_button").hide(); $("#calendar_explaination_button").hide();
$("#calendar_explaination_area").html(template_explanations.html()); $("#calendar_explaination_area").html(template_explanations.html()).show();
} }
if (incoming_shifts !== null) { if (incoming_shifts !== null) {
...@@ -209,11 +209,18 @@ function init_calendar_page() { ...@@ -209,11 +209,18 @@ function init_calendar_page() {
let default_initial_view = ""; let default_initial_view = "";
let header_toolbar = {}; let header_toolbar = {};
if (vw <=768) { if (vw <= 768) {
default_initial_view = 'listWeek';
header_toolbar = {
left: 'title',
center: 'listWeek,timeGridDay',
right: 'prev,next today'
};
} else if (vw <=992) {
default_initial_view = 'listWeek'; default_initial_view = 'listWeek';
header_toolbar = { header_toolbar = {
left: 'title', left: 'title',
center: '', center: 'dayGridMonth,listWeek,timeGridDay',
right: 'prev,next today' right: 'prev,next today'
}; };
} else { } else {
...@@ -313,12 +320,14 @@ function init_calendar_page() { ...@@ -313,12 +320,14 @@ function init_calendar_page() {
} }
}, },
eventDidMount: function() { eventDidMount: function() {
if (vw <= 768) { // Calendar is hidden at first on mobile to hide header change when data is loaded
$(".fc .fc-header-toolbar").addClass("resp-header-toolbar"); $(".loading-calendar").hide();
$("#calendar").show();
// Calendar is hidden at first on mobile to hide header change when data is loaded if (vw <= 992) {
$(".loading-calendar").hide(); $(".fc .fc-header-toolbar").addClass("resp-header-toolbar");
$("#calendar").show(); } else {
$(".fc .fc-header-toolbar").removeClass("resp-header-toolbar");
} }
} }
}); });
...@@ -386,4 +395,9 @@ function init_shifts_exchange() { ...@@ -386,4 +395,9 @@ function init_shifts_exchange() {
$("#shifts_exchange_content").show(); $("#shifts_exchange_content").show();
init_calendar_page(); init_calendar_page();
} }
}
$(window).smartresize(function(){
vw = window.innerWidth;
init_calendar_page();
});
}
\ No newline at end of file
...@@ -251,3 +251,30 @@ $(document).ready(function() { ...@@ -251,3 +251,30 @@ $(document).ready(function() {
update_dom(); update_dom();
}; };
}); });
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
};
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
}
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery,'smartresize');
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment