Sha256: 68c6d4da9eb11933a079dd0920073ea48c61b738be524909a23a19132cce5db7

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

# Global helpers should be used in comments as well
window.setErrors = (model, errors) ->
  for attribute, error of errors
    $label = $("label[for=#{model}_#{attribute}]")
    $field = $("##{model}_#{attribute}}")
    unless $label.size() is 0
      $label.addClass('error')
      $(errorTemplate(error[0])).insertAfter($label)
    else
      $field.addClass('error')
      $(errorTemplate(error[0])).insertAfter($field)
    
window.resetErrors = ->
  $('.error').removeClass('error')
  $('small.error_description').remove()
    
window.errorTemplate = (error) -> "<small class='error_description'>#{error}</small>"

window.kublogPath = '<%= Kublog.root_path %>'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kublog-0.0.1.1 app/assets/javascripts/kublog/shared.js.coffee.erb