Created
January 6, 2016 15:11
-
-
Save hrajchert/f8b5221bfc8e428eee5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
angular | |
.module('acamica.admin') | |
.factory('AdminLessonResourceModel', AdminLessonResourceModelFactory); | |
/** | |
* @ngdoc service | |
* @name acamica.admin.factory:AdminLessonResourceModel | |
* | |
* @description | |
* TODO: Describe this service | |
* | |
*/ | |
AdminLessonResourceModelFactory.$inject = ['BaseAdminModel']; | |
function AdminLessonResourceModelFactory (BaseAdminModel) { | |
var AdminLessonResourceModel = function (obj, isNew) { | |
BaseAdminModel.call(this, obj, isNew); | |
this._fromObject(obj); | |
}; | |
AdminLessonResourceModel.create = function (lessonId) { | |
var obj = { | |
lesson_id: lessonId, | |
type: 'link', | |
name: 'link', | |
res: 'http://' | |
}; | |
return new AdminLessonResourceModel(obj, true); | |
}; | |
AdminLessonResourceModel.prototype.fields = [ | |
'name', | |
'type', | |
'res', | |
'start_time', | |
'lesson_id' | |
]; | |
AdminLessonResourceModel.prototype.route = function () { | |
return 'lessons/' + this.lesson_id + '/resources'; | |
}; | |
BaseAdminModel.extend(AdminLessonResourceModel, []); | |
return AdminLessonResourceModel; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment