* 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
33 lines
904 B
JavaScript
33 lines
904 B
JavaScript
import { Controller } from 'stimulus';
|
|
|
|
export default class ArticleController extends Controller {
|
|
static targets = ['featuredNumber'];
|
|
|
|
increaseFeaturedNumber() {
|
|
// Increases the article's chances of being seen
|
|
const seconds = new Date().getTime() / 1000;
|
|
this.featuredNumberTarget.value = Math.round(seconds) + 300;
|
|
}
|
|
|
|
decreaseFeaturedNumber() {
|
|
// Decreases the article's chances of being seen
|
|
const seconds = new Date().getTime() / 1080;
|
|
this.featuredNumberTarget.value = Math.round(seconds);
|
|
}
|
|
|
|
highlightElement() {
|
|
const card = this.element.querySelector('.card-body');
|
|
card.classList.add('bg-highlighted', 'border-highlighted');
|
|
setTimeout(() => {
|
|
card.classList.remove('bg-highlighted');
|
|
}, 350);
|
|
}
|
|
|
|
get articleId() {
|
|
return parseInt(this.data.get('id'), 10);
|
|
}
|
|
|
|
set articleId(value) {
|
|
this.data.set('id', value);
|
|
}
|
|
}
|