2016-07-02 16:48:47 +02:00
|
|
|
$(document).on 'turbolinks:load', ->
|
2016-09-12 00:12:24 +02:00
|
|
|
$('#event_start_time').change ->
|
|
|
|
if $('#event_start_time').val() >= $('#event_end_time').val()
|
|
|
|
$('#event_end_time').val($('#event_start_time').val())
|
|
|
|
$('#event_end_time').change ->
|
|
|
|
if $('#event_start_time').val() >= $('#event_end_time').val()
|
|
|
|
$('#event_start_time').val($('#event_end_time').val())
|
|
|
|
|
2018-09-02 19:10:37 +02:00
|
|
|
# Quick mechanism so that the ice cube rule only appears when useful
|
2016-09-12 00:12:24 +02:00
|
|
|
$('#event_repeat').each ->
|
|
|
|
if $(this).val() == '0'
|
|
|
|
$('.field.rule').hide()
|
2016-09-11 17:40:49 +02:00
|
|
|
|
2016-09-12 00:12:24 +02:00
|
|
|
$(this).change ->
|
|
|
|
if $(this).val() > 0
|
|
|
|
$('.field.rule').show()
|
2018-01-21 23:25:31 +01:00
|
|
|
$('.field.rule input').attr 'required', 'required'
|
2016-09-12 00:12:24 +02:00
|
|
|
else
|
|
|
|
$('.field.rule').hide()
|
2018-01-21 23:25:31 +01:00
|
|
|
$('.field.rule input').removeAttr 'required'
|
2016-09-11 17:40:49 +02:00
|
|
|
|
2014-08-16 11:19:27 +02:00
|
|
|
# Manage event tags edition
|
|
|
|
$('#event_tags').each ->
|
|
|
|
elt = $(this)
|
|
|
|
$.ajax
|
|
|
|
url: '/tags.json'
|
|
|
|
.done (data) ->
|
|
|
|
tags = jQuery.map data, (n) -> n[0]
|