Skip to content

Commit

Permalink
Schedule Agenda: Fixes for select and delete Events (#2875)
Browse files Browse the repository at this point in the history
  • Loading branch information
maurofmferrao authored Jan 28, 2025
1 parent 42a0865 commit 04880b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
11 changes: 9 additions & 2 deletions ui/src/core/xibo-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,9 @@ $(function() {
$('.cal-context tbody tr').removeClass('selected');
$('.cal-context tbody tr').removeClass('selected-linked');

// Remove previous layout preview
destroyMiniLayoutPreview();

// If the element was already selected return
// so that it can deselect everything
if (alreadySelected) {
Expand Down Expand Up @@ -918,7 +921,8 @@ $(function() {
layoutPreviewUrl.replace(':id', $self.data('elemId')),
);

XiboInitialise('');
// Initialize container for the Schedule modal handling
XiboInitialise('#CalendarContainer');
}

// Select the clicked element and the linked elements
Expand Down Expand Up @@ -1114,8 +1118,11 @@ window.setupScheduleForm = function(dialog) {
XiboSubmitResponse(xhr, $form);

if (xhr.success && calendar !== undefined) {
// Reload the Calendar
// Clear option cache
calendar.options['clearCache'] = true;
// Make sure we remove mini layout preview
destroyMiniLayoutPreview();
// Reload the Calendar
calendar.view();
}
},
Expand Down
17 changes: 13 additions & 4 deletions ui/src/core/xibo-cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -3059,10 +3059,7 @@ window.createMiniLayoutPreview = function(previewUrl) {
});

$layoutPreview.find('#closeBtn').off().on('click', function() {
// Close preview and empty content
$layoutPreview.find('#content').html('');
$layoutPreview.removeClass('show');
$layoutPreview.remove();
destroyMiniLayoutPreview();
});

$layoutPreview.find('#newTabBtn').off().on('click', function() {
Expand Down Expand Up @@ -3092,6 +3089,18 @@ window.createMiniLayoutPreview = function(previewUrl) {
$layoutPreview.addClass('show');
};

/**
* Destroy mini layout preview
*/
window.destroyMiniLayoutPreview = function() {
const $layoutPreview = $('.mini-layout-preview');

// Close preview and empty content
$layoutPreview.find('#content').html('');
$layoutPreview.removeClass('show');
$layoutPreview.remove();
};

/**
* https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript
* @param {number} size
Expand Down

0 comments on commit 04880b4

Please sign in to comment.