Skip to content

Instantly share code, notes, and snippets.

@lrjbrual
Created September 3, 2020 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrjbrual/b866901afe738c9487d2373b879ad108 to your computer and use it in GitHub Desktop.
Save lrjbrual/b866901afe738c9487d2373b879ad108 to your computer and use it in GitHub Desktop.
Ryans blogs
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')
})
})
@lrjbrual
Copy link
Author

lrjbrual commented Sep 3, 2020

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment