import $ from 'jquery';
import * as Backbone from 'backbone';
import dispatcher from '../helpers/dispatcher';

class SearchBoxView extends Backbone.View {

  get el() { return '#search-box'; }

  get events() {
    return {
      'submit form': 'sendQuery'
    }
  }

  get query() {
    return $('#search-box input').val();
  }

  initialize() {
    window.console.log('SearchBoxView initialized!');
  }

  sendQuery() {
    if( this.query !== '' ) {
      dispatcher.trigger('router:go', ('search/?q=' + this.query));
    }
  }

}

export default SearchBoxView;

@@ -62,26 +62,22 @@
 %0Aimport 
-dispatcher
+Events
  from '.
@@ -86,26 +86,31 @@
 helpers/
-dispatcher
+backbone-events
 ';%0A%0Aclas
@@ -349,55 +349,69 @@
     
-window.console.log('SearchBoxView initialized!'
+this.listenTo(Events, 'search:noQuery', this.handleEmptyQuery
 );%0A 
@@ -528,22 +528,88 @@
 uery));%0A
-
     %7D%0A
+  handleEmptyQuery() %7B%0A    window.console.log('query was empty');%0A
   %7D%0A%0A%7D%0A%0A

Use Events instead of custom dispatcher