Created
September 3, 2020 10:11
-
-
Save lrjbrual/b866901afe738c9487d2373b879ad108 to your computer and use it in GitHub Desktop.
Ryans blogs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("@rails/ujs").start() | |
require("turbolinks").start() | |
require("@rails/activestorage").start() | |
require("channels") | |
require("trix") | |
require("@rails/actiontext") | |
import '../stylesheets/application' | |
// for the unhide and hide the text | |
document.addEventListener('turbolinks:load', () => { | |
document.addEventListener('click', () => { | |
let element = event.target.closest('.paragraph-content') | |
if (!element) return; | |
element.classList.add('d-none') | |
element.nextElementSibling.classList.remove('d-none') | |
}) | |
document.addEventListener('click', () => { | |
if (!event.target.matches('.cancel')) return; | |
let element = event.target.closest('.paragraph-form') | |
element.classList.add('d-none') | |
element.previousElementSibling.classList.remove('d-none') | |
}) | |
}) |
Author
lrjbrual
commented
Sep 3, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment