author | Chloe Laisne <chloe.laisne@gmail.com> |
Sat, 16 Jul 2016 17:23:47 +0200 | |
changeset 240 | aa101458cd4e |
parent 228 | a2497a2b6224 |
child 270 | 6ddc52965fb8 |
permissions | -rw-r--r-- |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
1 |
import Ember from 'ember'; |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
2 |
|
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
3 |
export default Ember.Component.extend({ |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
4 |
|
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
5 |
player: Ember.inject.service(), |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
6 |
|
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
7 |
classNames: ['notice-component'], |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
8 |
|
228
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
9 |
item: Ember.computed('model', 'player.model', function() { |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
10 |
return this.get('model') || this.get('player').get('model'); |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
11 |
}), |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
12 |
|
228
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
13 |
participants: Ember.computed('item.contributors', function() { |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
14 |
var participants = []; |
228
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
15 |
if(this.get('item')) { |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
16 |
this.get('item').get('contributors').forEach(function(contributor) { |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
17 |
if(contributor.name) { |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
18 |
participants.push({ name: contributor.name, role: contributor.role.split('/').pop() }); |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
19 |
} |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
20 |
}); |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
21 |
} |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
22 |
return participants; |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
23 |
}), |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
24 |
|
228
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
25 |
location: Ember.computed('item.geoInfo', function() { |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
26 |
var location = ''; |
228
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
27 |
if(this.get('item')) { |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
28 |
var meta = this.get('item').get('geoInfo').notes.find(element => element.lang); |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
29 |
if(meta) { |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
30 |
location = meta.value; |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
31 |
} |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
32 |
} |
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
33 |
return location; |
228
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
34 |
}), |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
35 |
|
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
36 |
actions: { |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
37 |
|
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
38 |
close: function() { |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
39 |
this.set('model', null); |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
40 |
} |
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
41 |
|
a2497a2b6224
Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents:
217
diff
changeset
|
42 |
} |
217
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
43 |
|
989b9c36b849
Toolbar and Notice component styles
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
44 |
}); |