services.js 671 B

12345678910111213141516171819202122
  1. define( [ 'views/services/service', 'models/serviceCollection' ], function( ServiceView, ServiceCollection ) {
  2. var view = Marionette.CollectionView.extend( {
  3. collection: new ServiceCollection(),
  4. className: 'wrap apps-container', /* Reusing "App" section styles. */
  5. childView: ServiceView,
  6. initialize: function() {
  7. this.updateCollection();
  8. this.listenTo( nfRadio.channel( 'dashboard' ), 'fetch:services', this.updateCollection );
  9. },
  10. updateCollection: function() {
  11. this.collection = nfRadio.channel( 'dashboard' ).request( 'get:services' );
  12. this.render();
  13. }
  14. } );
  15. return view;
  16. } );