blob: 3862b09f4306c008ac869d7a622ac40b1017114f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# 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/
create_record_toggle = (checked) ->
if checked
$(".record-description-field").show()
else
$(".record-description-field").hide()
published_field_toggle = (checked) ->
if checked
$(".should-create-record-field input[type=checkbox]").prop("disabled", false)
else
$(".should-create-record-field input[type=checkbox]").prop("disabled", true)
$(".should-create-record-field input[type=checkbox]").prop("checked", false)
create_record_toggle(false)
$(document).on "turbolinks:load", ->
if $(".published-field").length > 0
published_field_toggle($(".published-field input[type=checkbox]").prop("checked"))
$(".should-create-record-field input[type=checkbox]").change ->
create_record_toggle($(this).prop("checked"))
$(".published-field input[type=checkbox]").change ->
published_field_toggle($(this).prop("checked"))
$("input[type=tags]").each ->
tagsInput(this)
$(".tags-input input[type=text]").autocomplete({
source: Routes.suggest_tags_path()
})
$(".image-uploads pre").click ->
navigator.clipboard.writeText($(this).text());
|