lib/carte/client/models/card.coffee in carte-server-1.0.7 vs lib/carte/client/models/card.coffee in carte-server-1.0.8
- old
+ new
@@ -1,19 +1,25 @@
Backbone = require('backbone')
config = require('../config')
querystring = require('querystring')
+$ = require('jquery')
module.exports = class Card extends Backbone.Model
+ modelName: 'Card'
+
idAttribute: 'title'
+ query: {}
+
isNew: ()->
@_isNew
url: ()->
if @isNew()
url = '/cards.json'
else
url = '/cards/' + encodeURIComponent(@get('title')) + '.json'
+ url = url + '?' + $.param(@query) if @query != {}
config.root_path + config.api_path + url
parse: (response)->
if response.card then response.card else response