Sha256: 7f2ed16fb8fd7411217298d356f3413952448920d8ba4850ef7ed95dd91bbc24

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 KB

Contents

ready = ->
  self = this

  class AdminController
    init: ->
      #need to add datepicker to newly added inputs from nested_form_for
      $('body').on 'click','.add-semester', ->
        setTimeout ->
          $('.datepicker').datepicker_i18n()
        ,500

    index: ->
      self.admin.upload_picture()
      $(document).on 'keyup', '.dynamicAttributeName', ->
        nameElem = $(@)
        valueElem = nameElem.closest('.row')
                            .find('.dynamicAttributeValue')
        value = nameElem.val()

        valueElem.attr 'id', "grading_method_criteria_#{value}"
        valueElem.attr 'name', "grading_method[criteria][#{value}]"

      $(document).on 'click', '.remove-criteria-row', (e)->
        e.preventDefault()
        if confirm('Are you sure?')
          $(@).closest('.row').html ''

      $(document).on 'click', '.add-criteria-row', (e)->
        e.preventDefault()

        contents = "<div class='row'> #{$('.attribute-template').html()} </div>"
        $(@).before(contents);


    edit: ->
      self.admin.country_dropdown()
      self.admin.upload_picture_ajax()

    edit_master: ->
      self.admin.upload_picture_ajax()

    new: ->
      self.admin.country_dropdown()

    school_details: ->
      self.admin.upload_picture()

  @admin.admin = new AdminController

$(document).ready(ready)
$(document).on('page:load', ready)

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_admin-0.3.0 app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.3.0.pre.4 app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.3.0.pre.3 app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.3.0.pre.2 app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.3.0.pre.1 app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.3.0.pre.0 app/assets/javascripts/gaku/admin/admin.coffee
gaku-0.2.4 admin/app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.2.4 app/assets/javascripts/gaku/admin/admin.coffee
gaku-0.2.3 admin/app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.2.3 app/assets/javascripts/gaku/admin/admin.coffee
gaku-0.2.2 admin/app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.2.2 app/assets/javascripts/gaku/admin/admin.coffee
gaku-0.2.1 admin/app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.2.1 app/assets/javascripts/gaku/admin/admin.coffee
gaku-0.2.0 admin/app/assets/javascripts/gaku/admin/admin.coffee
gaku_admin-0.2.0 app/assets/javascripts/gaku/admin/admin.coffee