Hello, we saw that when you put a link inside a calendar entry and then click on it in the frontend, the link opens in a new tab. Is it possible to have the link open in the same tab?
Calendar
Localized calendar for displaying events on one or several sites.
Hey, sorry for the late reply.
You will need to manually override the default settings. If you give me a week, i will add a setting to the calendar.
Override:
{% component 'calendar' %}
{% put scripts %}
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('{{ calendar.alias }}');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid', 'list', 'bootstrap' ],
header: {
left: 'today, prev, next',
center: 'title',
right: 'dayGridMonth, dayGridWeek, dayGridDay, list'
},
locale: '{{ calendar.property("language") }}',
events: {
url: document.location.origin + '/api/christophheich/calendar/feed/{{ __SELF__.property("limit") }}/{{ __SELF__.property("category") }}/{{ __SELF__.property("timezone") }}',
method: 'GET',
failure: function() {
alert('there was an error while fetching events!');
}
},
eventClick: function(info) {
if (info.event.url) {
window.open(info.event.url);
return false;
}
},
eventRender: function(info) {
info.el.setAttribute('title', info.event.extendedProps.description);
},
});
calendar.render();
});
</script>
{% endput %}
In the documentation section there is an explanation how to override the default settings. The part with eventClick needs to be edited from:
eventClick: function(info) {
if (info.event.url) {
window.open(info.event.url);
return false;
}
},
to ->
eventClick: function(info) {
if (info.event.url) {
window.open(info.event.url);
info.jsEvent.preventDefault();
return false;
}
},
Regards
1-2 of 2