Sha256: f8ba4eb97c0e4e8d3d50d71cbd5a2a93af621f096a73cf4b9a6842b72746540c

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

class window.app.BaseResource extends Backbone.Model
  virtual_attributes: []

  sync: (method, model, options) ->
    @configureAjax()
    Backbone.sync method, model, options

  toJSON: (options) ->
    _.omit( _.clone( @attributes ), @virtual_attributes )

  url: ->
    base = super
    base = @appendLocaleInfo(base)

  configureAjax: ->
    $.ajaxSetup
      headers:
        Authorization: $.base64.encode api_token

  appendLocaleInfo: (uri) ->
    uri + (if uri.indexOf('?') then '?' else '&') + 'hl=' + encodeURIComponent( i18n.locale )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iugu-ux-0.8.5 vendor/assets/javascripts/iugu-ux/components/base_resource.js.coffee