* Add LandingPage domain model * Rely on Rails data integrity and remove previous code * Remove superfluous equality check * Restore landing_page class method * Add and fix specs * Do not attach landing page modal controller unnecessarily
24 lines
477 B
JavaScript
24 lines
477 B
JavaScript
import ModalController from './modal_controller';
|
|
|
|
export default class LandingPageModalController extends ModalController {
|
|
static targets = ['landingPageCheckbox'];
|
|
|
|
openModal() {
|
|
if (this.landingPageCheckboxTarget.checked) {
|
|
this.toggleModal();
|
|
}
|
|
}
|
|
|
|
confirm(event) {
|
|
event.preventDefault();
|
|
|
|
this.closeModal();
|
|
}
|
|
|
|
cancel(event) {
|
|
event.preventDefault();
|
|
|
|
this.landingPageCheckboxTarget.checked = false;
|
|
this.closeModal();
|
|
}
|
|
}
|