From 21240f6664c65abf75439f92cea3cc1dcabc8d54 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 2 Jul 2017 22:34:39 -0400 Subject: Fixed the "create record" checkbox in admin Some weird stuff about javascript and precompiliation. Will get around to cleaning up some of the javascript soon. --- app/assets/javascripts/admin/init_ckeditor.coffee | 6 ++++++ app/assets/javascripts/admin/records.coffee | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 app/assets/javascripts/admin/init_ckeditor.coffee create mode 100644 app/assets/javascripts/admin/records.coffee (limited to 'app/assets/javascripts/admin') diff --git a/app/assets/javascripts/admin/init_ckeditor.coffee b/app/assets/javascripts/admin/init_ckeditor.coffee new file mode 100644 index 0000000..5f653af --- /dev/null +++ b/app/assets/javascripts/admin/init_ckeditor.coffee @@ -0,0 +1,6 @@ +ready = -> + $('.ckeditor').each -> + CKEDITOR.replace $(this).attr('id') + +$(document).ready(ready) +$(document).on('page:load', ready) diff --git a/app/assets/javascripts/admin/records.coffee b/app/assets/javascripts/admin/records.coffee new file mode 100644 index 0000000..69cd471 --- /dev/null +++ b/app/assets/javascripts/admin/records.coffee @@ -0,0 +1,9 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ +$(document).on "turbolinks:load", -> + $(".should-create-record-field input[type=checkbox]").change -> + if $(".should-create-record-field input[type=checkbox]").prop("checked") + $(".record-description-field").show() + else + $(".record-description-field").hide() -- cgit 1.4.1