{ 'use strict'; var Model = base.Model.extend({ initialize: function() { base.Model.prototype.initialize.call(this); this.set('user', new user.Model()); }, parse: function(response, xhr) { response['event-filters'] = new OptionsCollection(response['event-filters']); response['site-menus'] = new OptionsCollection(response['site-menus']); response['event-filters'].get('event_start_filter').get('options').each(function(option) { var after = Date.parse(option.attributes.criteria.after); var afterIsToday = after.toDateString() == (new Date()).toDateString(); option.attributes.attributes.title = afterIsToday ? 'Today': after.toLocaleDateString(); option.attributes.text = afterIsToday ? 'Today': after.toLocaleDateString(); option.attributes.criteria.after = after.getTime() / 1000; option.attributes.criteria.before = Date.parse(option.attributes.criteria.before).getTime() / 1000; }); return response; }, url: function() { return helpers.urlFor('/application/', { mock: true }); } }); var OptionsCollection = base.Collection.extend({ model: base.Model.extend({ relations: [{ key: 'options', relatedModel: base.Model.extend({}), type: Backbone.HasMany }] }) }); return Model; }); —