changer le look du calendar légèrement et régler problème avec déconnection des test
CI - Security, Lint & Tests / validate (push) Canceled after 0s
CI - Security, Lint & Tests / validate (push) Canceled after 0s
This commit is contained in:
@@ -137,12 +137,18 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
|
||||
right: ''
|
||||
},
|
||||
events: '/matches/api/events',
|
||||
eventClick: function(info) {
|
||||
showEventModal(info.event);
|
||||
},
|
||||
eventClassNames: function(arg) {
|
||||
return [eventClassName(arg.event)];
|
||||
},
|
||||
eventContent: function(arg) {
|
||||
return renderEventContent(arg);
|
||||
},
|
||||
dateClick: function(info) {
|
||||
if (canScheduleMatches) {
|
||||
var dateStr = info.dateStr;
|
||||
@@ -158,7 +164,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
},
|
||||
slotMinTime: '12:00:00',
|
||||
slotMaxTime: '24:00:00'
|
||||
slotMaxTime: '24:00:00',
|
||||
slotEventOverlap: true,
|
||||
dayMaxEvents: false,
|
||||
nowIndicator: true,
|
||||
height: 'auto'
|
||||
});
|
||||
calendar.render();
|
||||
|
||||
@@ -177,6 +187,41 @@ function changeView(viewName) {
|
||||
}
|
||||
}
|
||||
|
||||
function eventClassName(event) {
|
||||
var props = event.extendedProps || {};
|
||||
if (props.type === 'team_match') { return 'fc-event--team-match'; }
|
||||
if (props.type === 'one_on_one') { return 'fc-event--one-on-one'; }
|
||||
return props.match_type === 'team_vs_team' ? 'fc-event--team' : 'fc-event--scrim';
|
||||
}
|
||||
|
||||
function eventIcon(type, matchType) {
|
||||
if (type === 'team_match') { return 'fa-trophy'; }
|
||||
if (type === 'one_on_one') { return 'fa-user-friends'; }
|
||||
if (matchType === 'team_vs_team') { return 'fa-shield-alt'; }
|
||||
if (matchType === 'player_vs_player') { return 'fa-users'; }
|
||||
return 'fa-gamepad';
|
||||
}
|
||||
|
||||
function renderEventContent(arg) {
|
||||
// Built with DOM nodes + textContent: the title comes from a JSON endpoint
|
||||
// and has never been HTML-escaped, so it must not reach innerHTML.
|
||||
var props = arg.event.extendedProps || {};
|
||||
var wrap = makeEl('div', 'fc-event-body');
|
||||
|
||||
var icon = makeEl('i', 'fas ' + eventIcon(props.type, props.match_type));
|
||||
icon.setAttribute('aria-hidden', 'true');
|
||||
wrap.appendChild(icon);
|
||||
|
||||
var text = makeEl('span', 'fc-event-text');
|
||||
if (!arg.event.allDay && arg.timeText && arg.view.type.indexOf('dayGrid') === 0) {
|
||||
text.appendChild(makeEl('span', 'fc-event-time', arg.timeText));
|
||||
}
|
||||
text.appendChild(makeEl('span', 'fc-event-title', arg.event.title));
|
||||
wrap.appendChild(text);
|
||||
|
||||
return { domNodes: [wrap] };
|
||||
}
|
||||
|
||||
// --- Create Event Modal ---
|
||||
function showCreateEventModal(dateStr) {
|
||||
document.getElementById('createEventDate').textContent = dateStr;
|
||||
|
||||
Reference in New Issue
Block a user