<commit_before>class ChannelItemView extends Backbone.Marionette.ItemView
  tagName: "li"

  template: "channels/_single_menu_item"

  initialize: () ->
    @addClassToggle('active')

    @model.bind('activate', @activeOn, this)
    @model.bind('deactivate', @activeOff, this)
    @model.bind('change',@render,this)

  onRender: () ->
    @$el.attr('id', 'channel-' + @model.id)
    @activeOn() if @model.isActive

_.extend ChannelItemView.prototype, ToggleMixin

class window.ChannelHeaderView extends Backbone.Marionette.ItemView
  tagName: "ul"
  className: "channel-listing"

  template: 'channels/list_header'

  templateHelpers: ->

    channel_listing_header: -> Factlink.Global.t.channels.capitalize()

  initialize: =>
    @on 'activate', (type)=> @activate(type)


  onRender: -> @renderActive()

  activate: (type) ->
    @_active = type
    @renderActive()

  renderActive: ->
    @$("li.#{@_active}").addClass('active') if @_active?

class window.ChannelListView extends Backbone.Marionette.CollectionView
  itemView: ChannelItemView
  tagName: 'ul'
  id: 'channel-listing'
  className: 'channel-listing'

class window.ChannelsView extends Backbone.Marionette.Layout
  template: 'channels/channel_list'
  className: 'channel-listing-container-container'

  regions:
    list:   '.channel-listing-container'
    header: '.channel-listing-header'

  initialize: ->
    @model = if @model? then @model.clone() else new User
    @setUserFromChannels()
    @bindTo @collection, 'reset', @setUserFromChannels, this

  setUserFromChannels: ->
    channel = window.Channels.first()
    @model.set(channel.user().attributes) if channel


  initialEvents: -> false # stop layout from refreshing after model/collection update
                    # no longer needed in marionette 1.0

  onRender: ->
    @list.show new ChannelListView(collection: @collection)
    @renderHeader()

  renderHeader: ->
    @header.show new ChannelHeaderView(model: @model, collection: @collection)

  setActiveChannel: (channel)->
    if channel.get('is_all')
      @setActive('stream')
    else
      @collection.setActiveChannel(channel)

  setActive: (type) ->
    @collection.unsetActiveChannel()
    @header.currentView.trigger 'activate', type
<commit_msg>removed no longer needed code<commit_after>class ChannelItemView extends Backbone.Marionette.ItemView
  tagName: "li"

  template: "channels/_single_menu_item"

  initialize: () ->
    @addClassToggle('active')

    @model.bind('activate', @activeOn, this)
    @model.bind('deactivate', @activeOff, this)
    @model.bind('change',@render,this)

  onRender: () ->
    @$el.attr('id', 'channel-' + @model.id)
    @activeOn() if @model.isActive

_.extend ChannelItemView.prototype, ToggleMixin

class window.ChannelHeaderView extends Backbone.Marionette.ItemView
  tagName: "ul"
  className: "channel-listing"

  template: 'channels/list_header'

  templateHelpers: ->

    channel_listing_header: -> Factlink.Global.t.channels.capitalize()

  initialize: =>
    @on 'activate', (type)=> @activate(type)


  onRender: -> @renderActive()

  activate: (type) ->
    @_active = type
    @renderActive()

  renderActive: ->
    @$("li.#{@_active}").addClass('active') if @_active?

class window.ChannelListView extends Backbone.Marionette.CollectionView
  itemView: ChannelItemView
  tagName: 'ul'
  id: 'channel-listing'
  className: 'channel-listing'

class window.ChannelsView extends Backbone.Marionette.Layout
  template: 'channels/channel_list'
  className: 'channel-listing-container-container'

  regions:
    list:   '.channel-listing-container'
    header: '.channel-listing-header'

  initialize: ->
    @model = if @model? then @model.clone() else new User
    @setUserFromChannels()
    @bindTo @collection, 'reset', @setUserFromChannels, this

  setUserFromChannels: ->
    channel = window.Channels.first()
    @model.set(channel.user().attributes) if channel

  onRender: ->
    @list.show new ChannelListView(collection: @collection)
    @renderHeader()

  renderHeader: ->
    @header.show new ChannelHeaderView(model: @model, collection: @collection)

  setActiveChannel: (channel)->
    if channel.get('is_all')
      @setActive('stream')
    else
      @collection.setActiveChannel(channel)

  setActive: (type) ->
    @collection.unsetActiveChannel()
    @header.currentView.trigger 'activate', type

{'fraction_non_alphanumeric': 0.13466391374168388, 'fraction_numerical': 0.0004588208304657031, 'mean_word_length': 4.117370892018779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1877245', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1321, 'n_words': 275}