| author | ymh <ymh.work@gmail.com> |
| Wed, 05 Dec 2018 19:00:08 +0100 | |
| changeset 193 | 99e342f9fb0c |
| parent 138 | a1fb2ced3049 |
| permissions | -rw-r--r-- |
|
129
d48946d164c6
Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
export const ActionEnum = { |
|
d48946d164c6
Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
NONE: 0, |
|
d48946d164c6
Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
CREATED: 1, |
|
d48946d164c6
Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
UPDATED: 2, |
|
d48946d164c6
Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
DELETED: 3 |
|
d48946d164c6
Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
} |
|
138
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
7 |
|
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
8 |
export const defaultAnnotationsCategories = [ |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
9 |
{ key: 'important', name: 'Important', color: '#F1C40F' }, |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
10 |
{ key: 'keyword', name: 'Mot-clé', color: '#2ECC71' }, |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
11 |
{ key: 'comment', name: 'Commentaire', color: '#3498DB', hasComment: true } |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
12 |
]; |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
13 |
|
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
14 |
|
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
15 |
export const extractAnnotationCategories = (protocol) => { |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
16 |
const metacategories = (protocol)?protocol['metacategories']:null; |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
17 |
if(!metacategories) { |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
18 |
return defaultAnnotationsCategories; |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
19 |
} |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
20 |
return metacategories.map((m) => { |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
21 |
return { |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
22 |
key: m.id, |
| 193 | 23 |
name: m.name || m.title, |
|
138
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
24 |
description: m.description, |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
25 |
color: m.color, |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
26 |
hasComment: m.has_comment |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
27 |
} |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
28 |
}) |
|
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
129
diff
changeset
|
29 |
} |