docbrown/app/javascript/admin/controllers/article_controller.js
Katie Davis 76453b41fb
Updates ESLint rules to error on default imports (#12512)
* add rule

* add named imports

* more missed files

* so many files
2021-02-02 10:24:03 -05:00

28 lines
836 B
JavaScript

import { Controller } from 'stimulus';
export class ArticleController extends Controller {
static classes = ['bgHighlighted', 'borderHighlighted'];
static targets = ['featuredNumber', 'cardBody'];
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.cardBodyTarget;
card.classList.add(this.bgHighlightedClass, this.borderHighlightedClass);
setTimeout(() => {
card.classList.remove(this.bgHighlightedClass);
}, 350);
}
}