* First draft - all the big changes * Changing some more references to 'internal' * Relocate internal request tests to admin * Relocate internal system tests to admin * Fix trailing space * Test fix * Move queries from internal to admin * Docs updates * Rename internal stimuls controllers to admin (plus docs) * Rename admin layout * Fix routing after rebase * Fixes for latest added admin interfaces * Serviceworker ignore paths
47 lines
1 KiB
JavaScript
47 lines
1 KiB
JavaScript
import { Controller } from 'stimulus';
|
|
|
|
export default class BufferController extends Controller {
|
|
static targets = ['header', 'bodyText'];
|
|
|
|
tagBufferUpdateConfirmed() {
|
|
this.clearPreviousBadge();
|
|
|
|
this.headerTarget.innerHTML +=
|
|
'<span class="ml-2 badge badge-success">Confirm</span>';
|
|
}
|
|
|
|
tagBufferUpdateDismissed() {
|
|
this.clearPreviousBadge();
|
|
|
|
this.headerTarget.innerHTML +=
|
|
'<span class="ml-2 badge badge-danger">Dismiss</span>';
|
|
}
|
|
|
|
highlightElement() {
|
|
this.element.classList.add('bg-highlighted', 'border-highlighted');
|
|
setTimeout(() => {
|
|
this.element.classList.remove('bg-highlighted');
|
|
}, 350);
|
|
}
|
|
|
|
autosizeBodyText() {
|
|
this.bodyTextTarget.rows = this.bodyTextTarget.value.split(
|
|
/\r\n|\r|\n/,
|
|
).length;
|
|
}
|
|
|
|
clearPreviousBadge() {
|
|
const badge = this.headerTarget.querySelector('.badge');
|
|
if (badge) {
|
|
badge.remove();
|
|
}
|
|
}
|
|
|
|
get bufferUpdateId() {
|
|
return parseInt(this.data.get('id'), 10);
|
|
}
|
|
|
|
set bufferUpdateId(value) {
|
|
this.data.set('id', value);
|
|
}
|
|
}
|