<commit_before>goog.provide 'acorn.player.ContentView'

goog.require 'acorn.player.controls.ControlToolbarView'
goog.require 'acorn.shells.Shell'



ControlToolbarView = acorn.player.controls.ControlToolbarView

# acorn Player:
# ------------------------------------------------------------------
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                       Shell.MediaView                          |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# ------------------------------------------------------------------
# | Shell.MediaView:controlsView         ContentView:acornControls |
# ------------------------------------------------------------------


# View to experience an acorn. Renders shells' MediaViews, and the controls.
class acorn.player.ContentView extends athena.lib.View


  className: @classNameExtend 'content-view'


  acornControls: [
    'Sources',
    'Edit',
    'Acorn',
    'Fullscreen',
  ]


  initialize: =>
    super
    # should these go here?
    # @model.shellModel.on 'change', @render
    # @model.acornModel.on 'change', @render

    # construct a shell MediaView
    shellModel = acorn.shellWithAcorn @model
    @shellView = new shellModel.module.MediaView
      model: shellModel
      eventhub: @eventhub

    # construct a ControlToolbar for the acorn controls
    @acornControlsView = new ControlToolbarView
      extraClasses: ['acorn-controls']
      buttons: @acornControls
      eventhub: @eventhub

    # grab customly defined shellView controlsView, or construct one
    @shellControlsView = @shellView.controlsView
    @shellControlsView ?= new ControlToolbarView
      extraClasses: ['shell-controls']
      buttons: @shellView.controls
      eventhub: @eventhub

    # construct main ControlToolbar
    @controlsView = new ControlToolbarView
      buttons: [@acornControlsView, @shellControlsView]
      eventhub: @eventhub

    # alignments
    @acornControlsView.$el.addClass 'right'
    @shellControlsView.$el.addClass 'left'

    # setup events
    @acornControlsView.on 'all', (name) => @eventhub.trigger name


  render: =>
    super
    @$el.empty()

    # add controlsView to DOM first so that shellView can interact with it
    @$el.append @controlsView.render().el
    @$el.prepend @shellView.render().el

    @<commit_msg>contentView: hide sources control button<commit_after>goog.provide 'acorn.player.ContentView'

goog.require 'acorn.player.controls.ControlToolbarView'
goog.require 'acorn.shells.Shell'



ControlToolbarView = acorn.player.controls.ControlToolbarView

# acorn Player:
# ------------------------------------------------------------------
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                       Shell.MediaView                          |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# |                                                                |
# ------------------------------------------------------------------
# | Shell.MediaView:controlsView         ContentView:acornControls |
# ------------------------------------------------------------------


# View to experience an acorn. Renders shells' MediaViews, and the controls.
class acorn.player.ContentView extends athena.lib.View


  className: @classNameExtend 'content-view'


  acornControls: [
    'Sources',
    'Edit',
    'Acorn',
    'Fullscreen',
  ]


  initialize: =>
    super
    # should these go here?
    # @model.shellModel.on 'change', @render
    # @model.acornModel.on 'change', @render

    # construct a shell MediaView
    shellModel = acorn.shellWithAcorn @model
    @shellView = new shellModel.module.MediaView
      model: shellModel
      eventhub: @eventhub

    # construct a ControlToolbar for the acorn controls
    @acornControlsView = new ControlToolbarView
      extraClasses: ['acorn-controls']
      buttons: @acornControls
      eventhub: @eventhub

    # grab customly defined shellView controlsView, or construct one
    @shellControlsView = @shellView.controlsView
    @shellControlsView ?= new ControlToolbarView
      extraClasses: ['shell-controls']
      buttons: @shellView.controls
      eventhub: @eventhub

    # construct main ControlToolbar
    @controlsView = new ControlToolbarView
      buttons: [@acornControlsView, @shellControlsView]
      eventhub: @eventhub

    # alignments
    @acornControlsView.$el.addClass 'right'
    @shellControlsView.$el.addClass 'left'

    # setup events
    @acornControlsView.on 'all', (name) => @eventhub.trigger name


  render: =>
    super
    @$el.empty()

    # add controlsView to DOM first so that shellView can interact with it
    @$el.append @controlsView.render().el
    @$el.prepend @shellView.render().el

    # for now, hide sources control
    @acornControlsView.$('.control-view.sources').addClass 'hidden'

    @
{'fraction_non_alphanumeric': 0.13667285095856524, 'fraction_numerical': 0.0, 'mean_word_length': 0.995988892317186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 56, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2215305', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1324, 'n_words': 289}