   initialize: ->
     @_added_channels_view = new AutoCompletedAddedChannelsView
       collection: @collection
-      mainView: this
 
-    [@model, @search_collection] = searchCollection(TopicSearchResults)
+    [@model, @search_collection] = @searchCollection(TopicSearchResults)
 
     @_text_input_view = new TextInputView model: @model
 

#= require ./generic/text_input_view
searchCollection = (type)->
  model = new Backbone.Model text: ''
  collection = new type()
  model.on 'change', -> collection.searchFor model.get('text')

  [model, collection]

class window.AutoCompletedAddToChannelView extends Backbone.Marionette.Layout
  tagName: "div"
  className: "add-to-channel"
  events:
    "click div.auto_complete": "addCurrentlySelectedChannel"

  regions:
    'added_channels': 'div.added_channels_container'

      'slug_title', @search_collection, @collection)

    @_auto_completes_view = new AutoCompletesView
      model: @model
      collection: @filtered_search_collection

    @bindTextViewToSteppableViewAndSelf(@_text_input_view, @_auto_completes_view)

  onRender: ->
    @added_channels.show @_added_channels_view
    @auto_completes.show @_auto_completes_view
    @input.show @_text_input_view

  addCurrent: ->
    @disable()
    afterAdd = =>
      @model.set text:''
