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 +++++++++ app/assets/javascripts/application.js | 2 +- app/assets/javascripts/ckeditor/config.js | 2 +- app/assets/javascripts/init_ckeditor.coffee | 6 ------ app/assets/javascripts/records.coffee | 9 --------- 6 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 app/assets/javascripts/admin/init_ckeditor.coffee create mode 100644 app/assets/javascripts/admin/records.coffee delete mode 100644 app/assets/javascripts/init_ckeditor.coffee delete mode 100644 app/assets/javascripts/records.coffee (limited to 'app') 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() diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 499c820..f902906 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,4 +14,4 @@ //= require jquery_ujs //= require turbolinks //= require ckeditor/init -//= require_tree . +//= require_tree ./admin diff --git a/app/assets/javascripts/ckeditor/config.js b/app/assets/javascripts/ckeditor/config.js index 44b3c23..7ff7731 100644 --- a/app/assets/javascripts/ckeditor/config.js +++ b/app/assets/javascripts/ckeditor/config.js @@ -6,7 +6,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: - // config.language = 'fr'; + config.language = 'en'; // config.uiColor = '#AADC6E'; config.height = "512px"; diff --git a/app/assets/javascripts/init_ckeditor.coffee b/app/assets/javascripts/init_ckeditor.coffee deleted file mode 100644 index 5f653af..0000000 --- a/app/assets/javascripts/init_ckeditor.coffee +++ /dev/null @@ -1,6 +0,0 @@ -ready = -> - $('.ckeditor').each -> - CKEDITOR.replace $(this).attr('id') - -$(document).ready(ready) -$(document).on('page:load', ready) diff --git a/app/assets/javascripts/records.coffee b/app/assets/javascripts/records.coffee deleted file mode 100644 index 69cd471..0000000 --- a/app/assets/javascripts/records.coffee +++ /dev/null @@ -1,9 +0,0 @@ -# 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