cms/app-client/app/controllers/application.js
changeset 209 35cb7200bb0a
parent 204 dd969e178944
child 212 f2c6080a73aa
equal deleted inserted replaced
208:59b63cdda9e8 209:35cb7200bb0a
    83             }
    83             }
    84         }
    84         }
    85         return true;
    85         return true;
    86     },
    86     },
    87 
    87 
       
    88     player: Ember.inject.service(),
       
    89 
    88     detail: null,
    90     detail: null,
    89 
    91 
    90     currentId: null,
       
    91     currentItem: Ember.computed('currentId', function() {
       
    92         Ember.$(".result-item").toggleClass("playing", false);
       
    93         if (this.get('currentId') === null){
       
    94             return null;
       
    95         }
       
    96         Ember.$("div[id='" + this.get('currentId') + "']").toggleClass("playing", true);
       
    97         return this.store.findRecord('document', this.get('currentId'));
       
    98     }),
       
    99 
    92 
   100     modalItem: Ember.computed('detail', function() {
    93     modalItem: Ember.computed('detail', function() {
   101         return this.store.findRecord('document', this.get('detail'));
    94         return this.store.findRecord('document', this.get('detail'));
   102     }),
    95     }),
       
    96 
       
    97     itemIdObserver: Ember.observer('player.itemId', function() {
       
    98         var self = this;
       
    99         this.store.findRecord('document', this.get('player').get('itemId'), { reload: true }).then(function(it){
       
   100             self.get('player').set('item', it);
       
   101         });
       
   102     }),
       
   103 
       
   104     init: function() {
       
   105         this._super(...arguments);
       
   106         this.get('player');
       
   107     },
   103 
   108 
   104     actions: {
   109     actions: {
   105 
   110 
   106         changeDocument: function(docDirection){
   111         changeDocument: function(docDirection){
   107             var direction = (docDirection === "next") ? 1 : -1;
   112             var direction = (docDirection === "next") ? 1 : -1;