Commit e0b9bce4 authored by Renfred Harper's avatar Renfred Harper
Browse files

Add basic backbone models

parent 45eefd27
var advisor = advisor || {};
advisor.Course = Backbone.Model.extend({
defaults: {
dept: 'CS',
courseid: 310
description: "desc"
},
// Toggle the `completed` state of this todo item.
toggle: function() {
this.save({
completed: !this.get('completed')
});
}
});
var advisor = advisor || {};
advisor.Program = Backbone.RelationalModel.extend({
relations: [{
type: Backbone.HasMany,
key: 'requirements',
relatedModel: 'advisor.Requirements',
collectionType: 'RequirementCollection',
reverseRelation: {
key: 'satisfies',
includeInJSON: 'id'
}
}]
});
var advisor = advisor || {};
advisor.Requirement = Backbone.RelationalModel.extend({
relations: [{
type: Backbone.HasMany,
key: 'courses',
relatedModel: 'advisor.Course',
collectionType: 'CourseCollection',
reverseRelation: {
key: 'satisfies',
includeInJSON: 'id'
}
}]
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment