Sha256: b1e5b91084a5daf496607209444c6010586c7f885015e5797c68dc14ac600585

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

Backbone = require('backbone')
config = require('../../shared/config.json')
querystring = require('querystring')

module.exports = class Card extends Backbone.Model
  idAttribute: 'title'

  isNew: ()->
    @_isNew

  url: ()->
    if @isNew()
      console.log @
      console.log 'url is new'
      url = '/api/cards.json'
    else
      console.log 'url is not new'
      url = '/api/cards/' + encodeURIComponent(@get('title')) + '.json'
    if config.api_path
      url = config.api_path + url
    url

  parse: (response)->
    if response.card then response.card else response

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carte-server-0.0.12 lib/carte/client/models/card.coffee
carte-server-0.0.11 lib/carte/client/models/card.coffee
carte-server-0.0.10 lib/carte/client/models/card.coffee