Skip to content

Commit

Permalink
休会フォームの注意を「読みました」のチェックボックスとボタンが連動するようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
TakashimaAyaka authored and TakashimaAyaka committed Sep 20, 2022
1 parent ec1ae9e commit 9b733ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/javascript/hibernation_agreements.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
document.addEventListener('DOMContentLoaded', () => {
const checkbox = document.querySelector('.js-hibernation-agreements-checkbox')
const submit = document.querySelector('.js-hibernation-agreements-submit')

checkbox.addEventListener('change', () => {
if (checkbox.checked) {
submit.classList.remove('is-disabled')
submit.classList.add('is-danger')
} else {
submit.classList.add('is-disabled')
submit.classList.remove('is-danger')
}
})
})
1 change: 1 addition & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import '../training-info-toggler.js'
import '../company-products.js'
import '../welcome_message_for_adviser.js'
import '../regular-events.js'
import '../hibernation_agreements.js'

import VueMounter from '../VueMounter.js'
import Hello from '../components/hello.vue'
Expand Down
4 changes: 2 additions & 2 deletions app/views/hibernation/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ header.page-header
.block-checks.is-1-item.is-centered
.block-checks__item
.a-block-check.is-checkbox
input.a-toggle-checkbox#aaa(type='checkbox')
input.a-toggle-checkbox.js-hibernation-agreements-checkbox#aaa(type='checkbox')
label.a-block-check__label(for='aaa')
| 読みました

Expand All @@ -86,5 +86,5 @@ header.page-header
class: 'a-button is-md is-secondary is-block'
li.form-actions__item.is-main
= f.submit '休会する',
class: 'a-button is-md is-danger is-block',
class: 'a-button is-md is-block js-hibernation-agreements-submit is-disabled',
data: { confirm: '本当によろしいですか?' }

0 comments on commit 9b733ec

Please sign in to comment.