Calendar: Invitee can delete own invitation when event is not editable - refs BT#19390

pull/4099/head
Angel Fernando Quiroz Campos 4 years ago
parent 8e1ae7d22b
commit eec125879d
  1. 19
      main/template/default/agenda/month.tpl

@ -485,6 +485,8 @@ $(document).ready(function() {
} }
var startDateToString = start.format("{{ js_format_date }}"); var startDateToString = start.format("{{ js_format_date }}");
var delete_url = '{{ web_agenda_ajax_url }}&a=delete_event&id='+calEvent.id;
// Edit event. // Edit event.
if (calEvent.editable) { if (calEvent.editable) {
$('#visible_to_input').hide(); $('#visible_to_input').hide();
@ -596,7 +598,6 @@ $(document).ready(function() {
$("#dialog-form").dialog("open"); $("#dialog-form").dialog("open");
var url = '{{ web_agenda_ajax_url }}&a=edit_event&id='+calEvent.id+'&view='+view.name; var url = '{{ web_agenda_ajax_url }}&a=edit_event&id='+calEvent.id+'&view='+view.name;
var delete_url = '{{ web_agenda_ajax_url }}&a=delete_event&id='+calEvent.id;
$("#dialog-form").dialog({ $("#dialog-form").dialog({
buttons: { buttons: {
@ -800,6 +801,22 @@ $(document).ready(function() {
} }
}; };
{% if agenda_collective_invitations and 'personal' == type %}
buttons['{{ "Delete"|get_lang }}'] = function () {
$.ajax({
url: delete_url,
success:function() {
calendar.fullCalendar('removeEvents',
calEvent
);
calendar.fullCalendar('refetchEvents');
calendar.fullCalendar('rerenderEvents');
$("#simple-dialog-form").dialog('close');
}
});
};
{% endif %}
if ('session' === calEvent.type) { if ('session' === calEvent.type) {
buttons['{{ "GoToCourse"|get_lang }}'] = function() { buttons['{{ "GoToCourse"|get_lang }}'] = function() {
window.location.href = calEvent.course_url; window.location.href = calEvent.course_url;

Loading…
Cancel
Save