cms/app-client/app/components/notice-component.js
changeset 228 a2497a2b6224
parent 217 989b9c36b849
child 270 6ddc52965fb8
equal deleted inserted replaced
227:5c9250f55f4b 228:a2497a2b6224
     4 
     4 
     5     player: Ember.inject.service(),
     5     player: Ember.inject.service(),
     6 
     6 
     7     classNames: ['notice-component'],
     7     classNames: ['notice-component'],
     8 
     8 
     9     item: Ember.computed('player.model', function() {
     9     item: Ember.computed('model', 'player.model', function() {
    10         return this.get('player').get('model');
    10         return this.get('model') || this.get('player').get('model');
    11     }),
    11     }),
    12 
    12 
    13     participants: Ember.computed('player.model.contributors', function() {
    13     participants: Ember.computed('item.contributors', function() {
    14         var participants = [];
    14         var participants = [];
    15         if(this.get('player').get('model')) {
    15         if(this.get('item')) {
    16             this.get('player').get('model').get('contributors').forEach(function(contributor) {
    16             this.get('item').get('contributors').forEach(function(contributor) {
    17                 if(contributor.name) {
    17                 if(contributor.name) {
    18                     participants.push({ name: contributor.name, role: contributor.role.split('/').pop() });
    18                     participants.push({ name: contributor.name, role: contributor.role.split('/').pop() });
    19                 }
    19                 }
    20             });
    20             });
    21         }
    21         }
    22         return participants;
    22         return participants;
    23     }),
    23     }),
    24 
    24 
    25     location: Ember.computed('player.model.geoInfo', function() {
    25     location: Ember.computed('item.geoInfo', function() {
    26         var location = '';
    26         var location = '';
    27         if(this.get('player').get('model')) {
    27         if(this.get('item')) {
    28             var meta = this.get('player').get('model').get('geoInfo').notes.find(element => element.lang);
    28             var meta = this.get('item').get('geoInfo').notes.find(element => element.lang);
    29             if(meta) {
    29             if(meta) {
    30                 location = meta.value;
    30                 location = meta.value;
    31             }
    31             }
    32         }
    32         }
    33         return location;
    33         return location;
    34     })
    34     }),
       
    35 
       
    36     actions: {
       
    37 
       
    38         close: function() {
       
    39             this.set('model', null);
       
    40         }
       
    41 
       
    42     }
    35 
    43 
    36 });
    44 });