lib/carte/client/models/card.coffee in carte-server-0.0.7 vs lib/carte/client/models/card.coffee in carte-server-0.0.8
- old
+ new
@@ -1,6 +1,7 @@
Backbone = require('backbone')
+config = require('../../shared/config.json')
module.exports = class Card extends Backbone.Model
idAttribute: 'title'
isNew: ()->
@@ -8,12 +9,15 @@
url: ()->
if @isNew()
console.log @
console.log 'url is new'
- '/api/cards.json'
+ url = '/api/cards.json'
else
console.log 'url is not new'
- '/api/cards/' + @get('title') + '.json'
+ url = '/api/cards/' + @get('title') + '.json'
+ if config.api_path
+ url = config.api_path + url
+ url
parse: (response)->
if response.card then response.card else response