Sha256: 0cdd8591641288e6baaa643c5c97feeb874520c6c2ffe652bcc6c384346e652b

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

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

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

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

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

  destroy : (item, callback) ->
    url = unescape('<%= Rails.application.routes.url_helpers.domain_alias_path('{domain_id}', '{id}') %>').replace("{domain_id}", item.virtual_domain_id).replace("{id}", item.id)
    return $.post(url, {"_method":"DELETE"}, callback, "json")


  init: () ->
    @validatePresenceOf ['source', 'destination']

}, {})

window.Alias.prototype.alert = () ->
  alert('<%= I18n.t('alert.alias') %>')

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmails-0.2.5 app/assets/javascripts/models/alias.coffee.erb
rmails-0.2.4 app/assets/javascripts/models/alias.coffee.erb
rmails-0.2.3 app/assets/javascripts/models/alias.coffee.erb
rmails-0.2.2 app/assets/javascripts/models/alias.coffee.erb