agenda-libre-ruby/app/assets/javascripts/events.js.coffee

12 lines
534 B
CoffeeScript

# 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).ready ->
$('form.region_selector select').change ->
this.form.submit()
selector = $('main form.region_selector + h2')
year = selector.html().substr selector.html().search(/\d{4}</), 4
selector.html selector.html().replace(/\d{4}</, '<a class="year_selector" href="?year='+year+'">'+year+'</a><')