Open
Description
Via @caseydedore:
var models = {
Course: function () {
this.id = 0;
this.title = '';
this.itemCode = '';
this.type = 0;
this.ccYear = 0;
this.credits = 0;
this.lessons = [];
this.prerequisites = [];
this.prerequisiteGroups = [];
this.prerequisiteMaterials = [];
this.prerequisiteOthers = [];
this.comments = '';
this.isCore = false;
this.isPrint = false;
this.getIsLocal = function () {
return this.itemCode.indexOf('.LC') >= 0;
};
this.getIsApplication = function () {
return this.type === 4;
};
this.isAdvanced = function () {
return this.type !== 4 &&
!this.getIsLocal() &&
!this.isCore;
};
this.isPrint = function () {
return this.type !== 2;
};
this.application = {
id: '',
title: '',
number: ''
};
},
Worksheet: function () {
this.id = 0;
this.comments = '';
this.title = '';
this.type = 'roadmap';
this.author = '';
this.tooltips = [];
this.trackDefaults = '';
this.ccID = '';
this.comment = '';
this.lastUpdated = '';
this.createDate = '';
this.programId = 0;
this.curriculumStartDate = '';
this.clcsSelectable = 0;
this.programDefault = 0;
this.sortOrder = 0;
this.getWorksheetType = function() {
if (uiConfig.adminMode.getIsAdmin()) {
return $('input[type=radio][name=worksheet_type]:checked').val();
} else if ($defaultViewSelector.find('option:selected').attr('data-snapshot') == '1' ||
$('#radio_snapshot').prop('checked')) {
return 'snapshot';
}
return this.type;
};
}
};
// var course = new models.Course();
// var worksheet = new models.Worksheet();
http://www.samselikoff.com/blog/some-Javascript-constructor-patterns/
Metadata
Metadata
Assignees
Labels
No labels