mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2025-01-03 07:12:36 +00:00
Restore warning message and clean up code #236
This commit is contained in:
parent
fa314fbcc0
commit
fe536a49b7
@ -66,10 +66,10 @@ foreach ($this->items as $i => $item) :
|
||||
<td class="text-center">
|
||||
<?php if ($item->applied) : ?>
|
||||
<button type="button" class="btn btn-sm btn-success submitPatch"
|
||||
data-task="revert-<?php echo (int) $item->applied; ?>"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
|
||||
data-task="revert" data-id="<?php echo (int) $item->applied; ?>"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
|
||||
<?php else : ?>
|
||||
<button type="button" class="btn btn-sm btn-primary submitPatch"
|
||||
data-task="apply-<?php echo (int) $item->pull_id; ?>"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>
|
||||
data-task="apply" data-id="<?php echo (int) $item->pull_id; ?>"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -10,9 +10,7 @@ if (typeof Joomla === 'undefined') {
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
|
||||
var submitPatch = document.querySelectorAll(".submitPatch");
|
||||
var pullIdForm = document.querySelector("#pull_id");
|
||||
|
||||
/**
|
||||
* EventListener which listens on submitPatch Button,
|
||||
@ -24,10 +22,35 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||
submitPatch.forEach(function (element) {
|
||||
element.addEventListener("click", function (event) {
|
||||
var currentTarget = event.currentTarget;
|
||||
var data = currentTarget.dataset.task.split("-");
|
||||
var task = currentTarget.dataset.task
|
||||
var id = currentTarget.dataset.id
|
||||
|
||||
pullIdForm.value = data[1];
|
||||
Joomla.submitform(data[0]);
|
||||
PatchTester.submitpatch(task, id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
!function (Joomla, window, document) {
|
||||
'use strict';
|
||||
|
||||
window.PatchTester = {
|
||||
/**
|
||||
* Process the patch action
|
||||
*
|
||||
* @param {String} task The task to perform
|
||||
* @param {Number} id The item ID
|
||||
*/
|
||||
submitpatch: function (task, id) {
|
||||
var idField = document.getElementById('pull_id');
|
||||
idField.value = id;
|
||||
|
||||
Joomla.submitform(task);
|
||||
}
|
||||
};
|
||||
|
||||
Joomla.submitbutton = function (task) {
|
||||
if (task !== 'reset' || confirm(Joomla.JText._('COM_PATCHTESTER_CONFIRM_RESET', 'Resetting will attempt to revert all applied patches and removes all backed up files. This may result in a corrupted environment. Are you sure you want to continue?'))) {
|
||||
Joomla.submitform(task);
|
||||
}
|
||||
};
|
||||
}(Joomla, window, document);
|
||||
|
Loading…
Reference in New Issue
Block a user