mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-26 02:33:03 -04:00
20 lines
491 B
CoffeeScript
20 lines
491 B
CoffeeScript
# Clears the finished at date field when
|
|
# a planting is marked unfinished, and
|
|
# repopulates the field with a cached value
|
|
# marking unfinished is undone.
|
|
|
|
jQuery ->
|
|
previousValue = ''
|
|
$('#planting_finished').on('click', ->
|
|
finished = $('#planting_finished_at')
|
|
if @checked
|
|
if previousValue.length
|
|
date = previousValue
|
|
finished.val(date)
|
|
else
|
|
finished.trigger('focus')
|
|
else
|
|
previousValue = finished.val()
|
|
finished.val('')
|
|
)
|