Sha256: 70222fec0c655ec1eedf9ca6d71a6080830024e884023a8b892f0aea93bbf8ba

Contents?: true

Size: 949 Bytes

Versions: 8

Compression:

Stored size: 949 Bytes

Contents

window.User = can.Model({
  findAll : 'GET <%= Rails.application.routes.url_helpers.domain_users_path('{domain_id}') %>'

  findOne : ('GET ' + unescape('<%= Rails.application.routes.url_helpers.domain_user_path('{domain_id}', '{id}') %>'))

  create  : (attrs, domain_id, callback) ->
    url = unescape('<%= Rails.application.routes.url_helpers.domain_users_path("{domain_id}") %>').replace("{domain_id}", domain_id)
    return $.post(url, attrs, callback, "json")

  update  : (attrs, user, url ) ->
    attrs["_method"] = "PUT"
    return $.ajax({
      url: url + '/' + user.id
      type: 'POST'
      data: attrs
      dataType: 'json'
      success: (json) ->
        dbg(json)
    })

  destroy : ('DELETE ' + unescape('<%= Rails.application.routes.url_helpers.domain_user_path('{domain_id}', '{id}') %>'))

  init: () ->
    @validatePresenceOf ['email']

}, {})

window.User.prototype.alert = () ->
  alert('<%= I18n.t('alert.user') %>')

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rmails-0.2.1 app/assets/javascripts/models/user.coffee.erb
rmails-0.2.0 app/assets/javascripts/models/user.coffee.erb
rmails-0.1.6 app/assets/javascripts/models/user.coffee.erb
rmails-0.1.5 app/assets/javascripts/models/user.coffee.erb
rmails-0.1.4 app/assets/javascripts/models/user.coffee.erb
rmails-0.1.3 app/assets/javascripts/models/user.coffee.erb
rmails-0.1.2 app/assets/javascripts/models/user.coffee.erb
rmails-0.1.1 app/assets/javascripts/models/user.coffee.erb