forked from wissenbach/oaclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.js
46 lines (31 loc) · 936 Bytes
/
model.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
43
44
45
46
YUI().use('model', 'model-list', 'view', 'node', 'event', 'io', 'json', function(Y) {
var isNumber = function (value) {
return typeof value === 'number' && !isNaN(value);
}
OAClient.AnnotationModel = Y.Base.create ('annotationModel', Y.Model, [], {
validate: function (attributes) {
if (!isNumber(attributes.posFrom) ||
!isNumber(attributes.posTo))
return 'posFrom and posTo must be a number';
}
}, {
ATTRS: {
uri: {value: null},
bodyMediatype: {value: null},
bodyContent:{value: null},
posFrom: {value: null,
validator: isNumber
},
posTo: {value: null,
validator: isNumber
},
}
});
OAClient.AnnotationList = function(config) {
OAClient.AnnotationList.superclass.constructor.apply(this, arguments);
};
Y.extend (OAClient.AnnotationList, Y.ModelList, {
name: 'annotationList',
model: OAClient.AnnotationModel
});
});