Sha256: 5430116b23763c89117f5a7428881b2fbf800e309776994252422fd0c532232f

Contents?: true

Size: 568 Bytes

Versions: 2

Compression:

Stored size: 568 Bytes

Contents

Backbone = require('backbone')
config = require('../config')
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

2 entries across 2 versions & 1 rubygems

Version Path
carte-server-0.0.14 lib/carte/client/models/card.coffee
carte-server-0.0.13 lib/carte/client/models/card.coffee