Sha256: e3bfad8d6bd53b24dfe99dca11c30e87f2782d6a27aac84acf41315f0b8d7168

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

#
# записано fearlessstar / shadows.of.unevenness@gmail.com холодным летом 2017, за бортом + 13
#

document.addEventListener 'turbolinks:load', ->
  $ ->

    console.log 'привет, регистрация на связи'

    $('#reg-button').unbind 'click'
    $('#reg-button').click ->
      nickname = $('input[name="field-nickname"]').val()
      email = $('input[name="field-email"]').val()
      phone = $('input[name="field-phone"]').val()
      password = $('input[name="field-password"]').val()

      $.ajax(
        method: 'POST'
        url: '/clients'
        data:
          client:
            email: email
            nickname: nickname
            phone: phone
            password: password).done (response) ->
              console.log "response#{response}"
              switch response.state
                when 'ok'
                  window.location.href = response.url
                when 'bad'
                  $().reg_errors_default_all
                  for detail in response.details
                    $('#' + detail + '-notice .enter-notice').addClass 'active'
                when 'shit'
                  $().user_feedback("red", response.details[0])

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
digital_heroes_startkit-0.1.1.4 app/assets/javascripts/registration.coffee
digital_heroes_startkit-0.1.1.3 app/assets/javascripts/registration.coffee
digital_heroes_startkit-0.1.1.2 app/assets/javascripts/registration.coffee
digital_heroes_startkit-0.1.1.1 app/assets/javascripts/registration.coffee
digital_heroes_startkit-0.1.1 app/assets/javascripts/registration.coffee