Sha256: 06dd11d82cb895f83ae533a18300f8679536fcacdc9f3b9c8bc65e39c4c326a3

Contents?: true

Size: 955 Bytes

Versions: 7

Compression:

Stored size: 955 Bytes

Contents

$(document).on 'ready page:load', ->
  $(document).on 'focus', 'input.datepicker:not(.hasDatepicker)', ->
    input = $(@)

    # Only create datepickers in compatible browsers
    return if input[0].type is 'date'
    console.log input
    input.datepicker( "option", "dateFormat", "dd-mm-yy" )
    # defaults = dateFormat: 'dd-mm-yy'
    # options  = input.data 'datepicker-options'
    # input.datepicker $.extend(defaults, options)
  

  $('.datepicker:not(.hasDatepicker)').each ->
    if $(@).val().length > 0
      p = $(@).val().split('-')
      $(@).val("#{p[2]}-#{p[1]}-#{p[0]}") 

  change_to_icon('.view_link', 'eye')
  change_to_icon('.delete_link', 'trash')
  change_to_icon('.edit_link', 'pencil')


# klass is class of group, icon_klass is icon name from font awesome
change_to_icon = (klass, icon_name) ->
  buttons = $(klass)
  $.each buttons, (_, button) ->
    button.text = ''
    $(button).addClass(klass+'_image fa fa-'+icon_name)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
face_of_active_admin-0.0.16 app/assets/javascripts/face_of_active_admin/base.js.coffee
face_of_active_admin-0.0.15 app/assets/javascripts/face_of_active_admin/base.js.coffee
face_of_active_admin-0.0.14 app/assets/javascripts/face_of_active_admin/base.js.coffee
face_of_active_admin-0.0.13 app/assets/javascripts/face_of_active_admin/base.js.coffee
face_of_active_admin-0.0.12 app/assets/javascripts/face_of_active_admin/base.js.coffee
face_of_active_admin-0.0.11 app/assets/javascripts/face_of_active_admin/base.js.coffee
face_of_active_admin-0.0.10 app/assets/javascripts/face_of_active_admin/base.js.coffee