cms/app-client/app/components/notice-component.js
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--
Player forward and backward

import Ember from 'ember';

export default Ember.Component.extend({

    player: Ember.inject.service(),

    classNames: ['notice-component'],

    item: Ember.computed('model', 'player.model', function() {
        return this.get('model') || this.get('player').get('model');
    }),

    participants: Ember.computed('item.contributors', function() {
        var participants = [];
        if(this.get('item')) {
            this.get('item').get('contributors').forEach(function(contributor) {
                if(contributor.name) {
                    participants.push({ name: contributor.name, role: contributor.role.split('/').pop() });
                }
            });
        }
        return participants;
    }),

    location: Ember.computed('item.geoInfo', function() {
        var location = '';
        if(this.get('item')) {
            var meta = this.get('item').get('geoInfo').notes.find(element => element.lang);
            if(meta) {
                location = meta.value;
            }
        }
        return location;
    }),

    actions: {

        close: function() {
            this.set('model', null);
        }

    }

});