about summary refs log tree commit diff stats
path: root/app/assets
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/admin/records.coffee24
-rw-r--r--app/assets/stylesheets/admin/layout.scss6
2 files changed, 26 insertions, 4 deletions
diff --git a/app/assets/javascripts/admin/records.coffee b/app/assets/javascripts/admin/records.coffee index 69cd471..3a1ed51 100644 --- a/app/assets/javascripts/admin/records.coffee +++ b/app/assets/javascripts/admin/records.coffee
@@ -1,9 +1,25 @@
1# Place all the behaviors and hooks related to the matching controller here. 1# Place all the behaviors and hooks related to the matching controller here.
2# All this logic will automatically be available in application.js. 2# All this logic will automatically be available in application.js.
3# You can use CoffeeScript in this file: http://coffeescript.org/ 3# You can use CoffeeScript in this file: http://coffeescript.org/
4
5create_record_toggle = (checked) ->
6 if checked
7 $(".record-description-field").show()
8 else
9 $(".record-description-field").hide()
10
11published_field_toggle = (checked) ->
12 if checked
13 $(".should-create-record-field input[type=checkbox]").prop("disabled", false)
14 else
15 $(".should-create-record-field input[type=checkbox]").prop("disabled", true)
16 $(".should-create-record-field input[type=checkbox]").prop("checked", false)
17 create_record_toggle(false)
18
4$(document).on "turbolinks:load", -> 19$(document).on "turbolinks:load", ->
20 if $(".published-field").length > 0
21 published_field_toggle($(".published-field input[type=checkbox]").prop("checked"))
5 $(".should-create-record-field input[type=checkbox]").change -> 22 $(".should-create-record-field input[type=checkbox]").change ->
6 if $(".should-create-record-field input[type=checkbox]").prop("checked") 23 create_record_toggle($(this).prop("checked"))
7 $(".record-description-field").show() 24 $(".published-field input[type=checkbox]").change ->
8 else 25 published_field_toggle($(this).prop("checked"))
9 $(".record-description-field").hide()
diff --git a/app/assets/stylesheets/admin/layout.scss b/app/assets/stylesheets/admin/layout.scss index 6645709..f68cf6a 100644 --- a/app/assets/stylesheets/admin/layout.scss +++ b/app/assets/stylesheets/admin/layout.scss
@@ -190,6 +190,12 @@ body {
190 } 190 }
191} 191}
192 192
193.published-field {
194 label {
195 font-size: .75em;
196 }
197}
198
193.record-description-field { 199.record-description-field {
194 display: none; 200 display: none;
195 margin-top: 1em; 201 margin-top: 1em;