Sha256: be24d40697a8ffa0da1fc2bf2c5ca04b4fa000c863263c15c7635496fe3f24b6

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

@TheAudit = do ->
  init: ->
    do @init_controller_action_select
    do @init_datapickers

  init_datapickers: ->
    now = new Date
    plus_12  = new Date now.getFullYear(), (now.getMonth()+12), now.getDate()
    minus_12 = new Date now.getFullYear(), (now.getMonth()-12), now.getDate()

    $("[data-role='date_start'], [data-role='date_end']").datepicker
      minDate: minus_12,
      maxDate: plus_12
      dateFormat: 'yy-mm-dd'

  init_controller_action_select: ->
    $('@ctrl_acts select').on 'change', (e) ->
      select = $ e.target
      value = select.val()

      path = '?'
      path = "?controller_action=#{ $(e.target).val() }" if value.length
      location.href path

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
the_audit-0.0.2 app/assets/javascripts/the_audit.js.coffee