Fix status of delete button when archived. Change title to say that you can't delete due to archived

This commit is contained in:
Isaac Connor 2021-05-19 20:29:31 -04:00
parent f6a271c90d
commit a4df8df5e5
1 changed files with 4 additions and 3 deletions

View File

@ -936,7 +936,8 @@ function initPage() {
editBtn.prop('disabled', !canEdit.Events); editBtn.prop('disabled', !canEdit.Events);
exportBtn.prop('disabled', !canView.Events); exportBtn.prop('disabled', !canView.Events);
downloadBtn.prop('disabled', !canView.Events); downloadBtn.prop('disabled', !canView.Events);
deleteBtn.prop('disabled', !canEdit.Events); deleteBtn.prop('disabled', !(!eventData.Archived && canEdit.Events));
deleteBtn.prop('title', eventData.Archived ? "You cannot delete an archived event." : "");
// Don't enable the back button if there is no previous zm page to go back to // Don't enable the back button if there is no previous zm page to go back to
backBtn.prop('disabled', !document.referrer.length); backBtn.prop('disabled', !document.referrer.length);
@ -979,14 +980,14 @@ function initPage() {
// Manage the UNARCHIVE button // Manage the UNARCHIVE button
bindButton('#unarchiveBtn', 'click', null, function onUnarchiveClick(evt) { bindButton('#unarchiveBtn', 'click', null, function onUnarchiveClick(evt) {
if ( ! canEdit.Events ) { if (!canEdit.Events) {
enoperm(); enoperm();
return; return;
} }
evt.preventDefault(); evt.preventDefault();
$j.getJSON(thisUrl + '?request=events&task=unarchive&eids[]='+eventData.Id) $j.getJSON(thisUrl + '?request=events&task=unarchive&eids[]='+eventData.Id)
.done( function(data) { .done( function(data) {
//FIXME: update the status of the unarchive button reather than reload the whole page //FIXME: update the status of the unarchive button rather than reload the whole page
window.location.reload(true); window.location.reload(true);
}) })
.fail(logAjaxFail); .fail(logAjaxFail);