|
1 import DS from 'ember-data'; |
|
2 import Ember from 'ember'; |
|
3 |
|
4 var Document = DS.Model.extend({ |
|
5 // id: DS.attr('string'), |
|
6 uri: DS.attr('string'), |
|
7 title: DS.attr('string'), |
|
8 language: DS.attr('string'), |
|
9 publishers: DS.attr({defaultValue: []}), |
|
10 contributors: DS.attr({defaultValue: []}), |
|
11 mediaArray: DS.attr({defaultValue: []}), |
|
12 mediaList: Ember.computed('mediaArray', function() { |
|
13 var res = []; |
|
14 var mp3 = null; |
|
15 Ember.$.forEach(this.get('mediaArray'), function(m) { |
|
16 if(m.format === 'audio/mpeg') { |
|
17 mp3 = m; |
|
18 } else if (m.format.startsWith('audio/')) { |
|
19 res.push(m); |
|
20 } |
|
21 }); |
|
22 if(mp3) { |
|
23 res.unshift(mp3); |
|
24 } |
|
25 return res; |
|
26 }) |
|
27 }); |
|
28 |
|
29 Document.reopenClass({ |
|
30 FIXTURES: [ |
|
31 { |
|
32 "id": "crdo-09-CAYCHAX_SOUND", |
|
33 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-CAYCHAX_SOUND", |
|
34 "title": "ALLOc : Caychax : Parabole", |
|
35 "language": "http://lexvo.org/id/iso639-3/oci", |
|
36 "modified": "2010-10-25T18:16:38+02:00", |
|
37 "publishers": [ ], |
|
38 "contributors": [ ], |
|
39 "mediaArray": [ ] |
|
40 }, |
|
41 { |
|
42 "id": "crdo-09-DUN_SOUND", |
|
43 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-DUN_SOUND", |
|
44 "title": "ALLOc : Dun : Parabole", |
|
45 "language": "http://lexvo.org/id/iso639-3/oci", |
|
46 "modified": "2010-10-25T18:18:23+02:00", |
|
47 "publishers": [ ], |
|
48 "contributors": [ ], |
|
49 "mediaArray": [ ] |
|
50 }, |
|
51 { |
|
52 "id": "crdo-09-LABASTIDE-DE-LORDAT_SOUND", |
|
53 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-LABASTIDE-DE-LORDAT_SOUND", |
|
54 "title": "ALLOc : La Bastide-de-Lordat : Parabole", |
|
55 "language": "http://lexvo.org/id/iso639-3/oci", |
|
56 "modified": "2010-10-25T18:20:08+02:00", |
|
57 "publishers": [ ], |
|
58 "contributors": [ ], |
|
59 "mediaArray": [ ] |
|
60 }, |
|
61 { |
|
62 "id": "crdo-09-LOUBENS_SOUND", |
|
63 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-LOUBENS_SOUND", |
|
64 "title": "ALLOc : Loubens : Parabole", |
|
65 "language": "http://lexvo.org/id/iso639-3/oci", |
|
66 "modified": "2010-10-25T18:21:23+02:00", |
|
67 "publishers": [ ], |
|
68 "contributors": [ ], |
|
69 "mediaArray": [ ] |
|
70 }, |
|
71 { |
|
72 "id": "crdo-09-MERENS-LES-VALS_SOUND", |
|
73 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-MERENS-LES-VALS_SOUND", |
|
74 "title": "ALLOc : Mérens-les-Vals : Parabole", |
|
75 "language": "http://lexvo.org/id/iso639-3/oci", |
|
76 "modified": "2010-10-25T18:22:24+02:00", |
|
77 "publishers": [ ], |
|
78 "contributors": [ ], |
|
79 "mediaArray": [ ] |
|
80 }, |
|
81 { |
|
82 "id": "crdo-09-MONTSEGUR_SOUND", |
|
83 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-MONTSEGUR_SOUND", |
|
84 "title": "ALLOc : Montségur : Parabole", |
|
85 "language": "http://lexvo.org/id/iso639-3/oci", |
|
86 "modified": "2010-10-25T18:23:14+02:00", |
|
87 "publishers": [ ], |
|
88 "contributors": [ ], |
|
89 "mediaArray": [ ] |
|
90 }, |
|
91 { |
|
92 "id": "crdo-09-PRAYOLS_SOUND", |
|
93 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-PRAYOLS_SOUND", |
|
94 "title": "ALLOc : Prayols : Parabole", |
|
95 "language": "http://lexvo.org/id/iso639-3/oci", |
|
96 "modified": "2010-10-25T18:24:06+02:00", |
|
97 "publishers": [ ], |
|
98 "contributors": [ ], |
|
99 "mediaArray": [ ] |
|
100 }, |
|
101 { |
|
102 "id": "crdo-09-QUERIGUT_SOUND", |
|
103 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-QUERIGUT_SOUND", |
|
104 "title": "ALLOc : Quérigut : Parabole", |
|
105 "language": "http://lexvo.org/id/iso639-3/oci", |
|
106 "modified": "2010-10-25T18:24:56+02:00", |
|
107 "publishers": [ ], |
|
108 "contributors": [ ], |
|
109 "mediaArray": [ ] |
|
110 }, |
|
111 { |
|
112 "id": "crdo-09-SIGUER_SOUND", |
|
113 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-SIGUER_SOUND", |
|
114 "title": "ALLOc : Siguer : Parabole", |
|
115 "language": "http://lexvo.org/id/iso639-3/oci", |
|
116 "modified": "2010-10-25T18:25:51+02:00", |
|
117 "publishers": [ ], |
|
118 "contributors": [ ], |
|
119 "mediaArray": [ ] |
|
120 }, |
|
121 { |
|
122 "id": "crdo-09-ST-MARTIN-D-OYDES_SOUND", |
|
123 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-ST-MARTIN-D-OYDES_SOUND", |
|
124 "title": "ALLOc : Saint-Martin-d'Oydes : Parabole", |
|
125 "language": "http://lexvo.org/id/iso639-3/oci", |
|
126 "modified": "2010-10-25T18:26:22+02:00", |
|
127 "publishers": [ ], |
|
128 "contributors": [ ], |
|
129 "mediaArray": [ ] |
|
130 }, |
|
131 { |
|
132 "id": "crdo-09-SURBA_SOUND", |
|
133 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-SURBA_SOUND", |
|
134 "title": "ALLOc : Surba : Parabole", |
|
135 "language": "http://lexvo.org/id/iso639-3/oci", |
|
136 "modified": "2010-10-25T18:26:42+02:00", |
|
137 "publishers": [ ], |
|
138 "contributors": [ ], |
|
139 "mediaArray": [ ] |
|
140 }, |
|
141 { |
|
142 "id": "crdo-11-GRAMAZIE_SOUND", |
|
143 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-GRAMAZIE_SOUND", |
|
144 "title": "ALLOc : Gramazie : Parabole", |
|
145 "language": "http://lexvo.org/id/iso639-3/oci", |
|
146 "modified": "2010-10-25T18:27:39+02:00", |
|
147 "publishers": [ ], |
|
148 "contributors": [ ], |
|
149 "mediaArray": [ ] |
|
150 }, |
|
151 { |
|
152 "id": "crdo-11-MOLLEVILLE_SOUND", |
|
153 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-MOLLEVILLE_SOUND", |
|
154 "title": "ALLOc : Molleville : Parabole", |
|
155 "language": "http://lexvo.org/id/iso639-3/oci", |
|
156 "modified": "2010-10-25T18:28:06+02:00", |
|
157 "publishers": [ ], |
|
158 "contributors": [ ], |
|
159 "mediaArray": [ ] |
|
160 }, |
|
161 { |
|
162 "id": "crdo-11-PUIVERT_SOUND", |
|
163 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-PUIVERT_SOUND", |
|
164 "title": "ALLOc : Puivert : Parabole", |
|
165 "language": "http://lexvo.org/id/iso639-3/oci", |
|
166 "modified": "2010-10-25T18:28:40+02:00", |
|
167 "publishers": [ ], |
|
168 "contributors": [ ], |
|
169 "mediaArray": [ ] |
|
170 }, |
|
171 { |
|
172 "id": "crdo-11-RIBOUISSE_SOUND", |
|
173 "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-RIBOUISSE_SOUND", |
|
174 "title": "ALLOc : Ribouisse : Parabole", |
|
175 "language": "http://lexvo.org/id/iso639-3/oci", |
|
176 "modified": "2010-10-25T18:29:32+02:00", |
|
177 "publishers": [ ], |
|
178 "contributors": [ ], |
|
179 "mediaArray": [ ] |
|
180 } |
|
181 ] |
|
182 }); |
|
183 |
|
184 export default Document; |