Files
edx-platform/cms/static/js/certificates/models/signatory.js
asadiqbal 13508c7681 SOL-1379
2015-11-06 18:45:36 +05:00

46 lines
1.3 KiB
JavaScript

// Backbone.js Application Model: Certificate Signatory
define([ // jshint ignore:line
'underscore',
'underscore.string',
'backbone',
'backbone-relational',
'gettext'
],
function(_, str, Backbone, BackboneRelational, gettext) {
'use strict';
_.str = str;
var Signatory = Backbone.RelationalModel.extend({
idAttribute: "id",
defaults: {
name: '',
title: '',
organization: '',
signature_image_path: ''
},
initialize: function() {
// Set up the initial state of the attributes set for this model instance
this.setOriginalAttributes();
return this;
},
parse: function (response) {
// Parse must be defined for the model, but does not need to do anything special right now
return response;
},
setOriginalAttributes: function() {
// Remember the current state of this model (enables edit->cancel use cases)
this._originalAttributes = this.parse(this.toJSON());
},
reset: function() {
// Revert the attributes of this model instance back to initial state
this.set(this._originalAttributes, { parse: true, validate: true });
}
});
return Signatory;
});