Skip to content

Instantly share code, notes, and snippets.

@hrajchert
Created January 6, 2016 15:11
Show Gist options
  • Save hrajchert/f8b5221bfc8e428eee5c to your computer and use it in GitHub Desktop.
Save hrajchert/f8b5221bfc8e428eee5c to your computer and use it in GitHub Desktop.
(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