-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
certificate_exception.js
42 lines (34 loc) · 1.17 KB
/
certificate_exception.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Backbone.js Application Model: CertificateWhitelist
/*global define, RequireJS */
;(function(define){
'use strict';
define([
'underscore',
'underscore.string',
'backbone',
'gettext'
],
function(_, str, Backbone, gettext){
return Backbone.Model.extend({
idAttribute: 'id',
defaults: {
user_id: '',
user_name: '',
user_email: '',
created: '',
certificate_generated: '',
notes: ''
},
url: function() {
return this.get('url');
},
validate: function(attrs){
if (!str.trim(attrs.user_name) && !str.trim(attrs.user_email)) {
return gettext('Student username/email field is required and can not be empty. ' +
'Kindly fill in username/email and then press "Add to Exception List" button.');
}
}
});
}
);
}).call(this, define || RequireJS.define);