<commit_before>define [
  'marionette'
  'cs!collections/media-types'
  'cs!views/workspace/menu/add'
  'cs!views/workspace/sidebar/toc'
  'hbs!templates/layouts/workspace/sidebar'
  'filtered-collection'
], (Marionette, mediaTypes, AddView, TocView, sidebarTemplate) ->

  return class Sidebar extends Marionette.Layout
    template: sidebarTemplate

    initialize: () ->
      @filteredMediaTypes = new Backbone.FilteredCollection(null, {collection:mediaTypes})

    regions:
      addContent: '.add-content'
      toc: '.workspace-sidebar'

    events:
      'click .handle': () -> @$el.toggleClass('minimized')

    onShow: () ->
      model = @model
      collection = @collection or model.getChildren()

      if model
        # This is a tree sidebar
        @filteredMediaTypes.setFilter (type) -> return type.id in model.accept
      else
        # This is the Picker/Roots Sidebar
        collection = new Backbone.FilteredCollection(null, {collection:collection})
        collection.setFilter (content)  -> return content.getChildren

      # TODO: Make the collection a FilteredCollection that only shows @model.accepts
      @addContent.show(new AddView {context:model, collection:@filteredMediaTypes})
      @toc.show(new TocView {model:model, collection:collection})<commit_msg>set the width and height of the main container div to make it easier to align sidebars<commit_after>define [
  'jquery'
  'marionette'
  'cs!collections/media-types'
  'cs!views/workspace/menu/add'
  'cs!views/workspace/sidebar/toc'
  'hbs!templates/layouts/workspace/sidebar'
  'filtered-collection'
], ($, Marionette, mediaTypes, AddView, TocView, sidebarTemplate) ->

  return class Sidebar extends Marionette.Layout
    template: sidebarTemplate

    initialize: () ->
      @filteredMediaTypes = new Backbone.FilteredCollection(null, {collection:mediaTypes})

    regions:
      addContent: '.add-content'
      toc: '.workspace-sidebar'

    events:
      'click .handle': () -> @$el.toggleClass('minimized')

    onShow: () ->
      model = @model
      collection = @collection or model.getChildren()

      if model
        # This is a tree sidebar
        @filteredMediaTypes.setFilter (type) -> return type.id in model.accept
      else
        # This is the Picker/Roots Sidebar
        collection = new Backbone.FilteredCollection(null, {collection:collection})
        collection.setFilter (content)  -> return content.getChildren

      # TODO: Make the collection a FilteredCollection that only shows @model.accepts
      @addContent.show(new AddView {context:model, collection:@filteredMediaTypes})
      @toc.show(new TocView {model:model, collection:collection})

    onWindowResize: () ->
      $window = $(window)
      $scrollable = @$el.find('> .boxed-group > .boxed-group-inner')
      height = $window.height() - $scrollable.offset().top
      $scrollable.css {height:height}

    onRender: () ->
      # Update the width/height of main so we can have Scrollable boxes that vertically stretch the entire page
      $window = $(window)
      $window.on('resize', @onWindowResize.bind(@))
      @onWindowResize()
{'fraction_non_alphanumeric': 0.11601150527325024, 'fraction_numerical': 0.0, 'mean_word_length': 3.3776223776223775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '5892095', 'n_tokens_mistral': 932, 'n_tokens_neox': 893, 'n_words': 221}