<commit_before>formChannel = new (Backbone.Wreqr.EventAggregator)

currentModal = null

MediaModalView = OrchestraView.extend(
  events:
    'click .mediaModalClose': 'closeModal'
    'click .media-modal-menu-folder' : 'showFolder'
    'click .ajax-add': 'openForm'
    'click .media-modal-menu-new-folder' : 'openForm'
  initialize: (options) ->
    @options = @reduceOption(options, [
      'body'
      'input'
      'domContainer'
      'url'
    ])
    @loadTemplates [
      "OpenOrchestraMediaAdminBundle:BackOffice:Underscore/mediaModalView"
    ]
    return
  render: (options) ->
    @setElement @renderTemplate('OpenOrchestraMediaAdminBundle:BackOffice:Underscore/mediaModalView', @options)
    if currentModal != null
      $('.modal-dialog', currentModal).replaceWith $('.modal-dialog', @$el)
    else
      @options.domContainer.html @$el
      currentModal = @$el.detach().appendTo('body')
      @$el.modal "show"
  closeModal: ->
    @$el.modal "hide"
    @$el.remove()
    currentModal = null
  showFolder: (event) ->
    displayLoader $(".modal-body-content", @$el)
    GalleryLoad $(event.target), $(".modal-body-content", @$el)
  reloadFolder: ->
    displayLoader $('.modal-body-menu', @$el)
    viewContext = @
    $.ajax
      url: @options.url
      method: 'GET'
      success: (response) ->
        $('.modal-body-menu', currentModal).html response
    return
  openForm: (event) ->
    event.preventDefault()
    displayLoader $(".modal-body-content", @$el)
    folderName = $(".js-widget-title", @$el).text()
    domContainer = $(".modal-body-content", @$el)
    if $(event.target).hasClass('media-modal-menu-new-folder')
      @listenToOnce(formChannel, 'formSubmit', @reloadFolder)
    $.ajax
      url: $(event.target).attr('data-url')
      method: 'GET'
      success: (response) ->
        viewClass = appConfigurationView.getConfiguration('media', 'showMediaForm')
        new viewClass(
            html: response
            domContainer: domContainer
            title: $.trim(folderName)
          )
)<commit_msg>use coffee synthax<commit_after>formChannel = new (Backbone.Wreqr.EventAggregator)

currentModal = null

MediaModalView = OrchestraView.extend(
  events:
    'click .mediaModalClose': 'closeModal'
    'click .media-modal-menu-folder' : 'showFolder'
    'click .ajax-add': 'openForm'
    'click .media-modal-menu-new-folder' : 'openForm'
  initialize: (options) ->
    @options = @reduceOption(options, [
      'body'
      'input'
      'domContainer'
      'url'
    ])
    @loadTemplates [
      "OpenOrchestraMediaAdminBundle:BackOffice:Underscore/mediaModalView"
    ]
    return
  render: (options) ->
    @setElement @renderTemplate('OpenOrchestraMediaAdminBundle:BackOffice:Underscore/mediaModalView', @options)
    if currentModal != null
      $('.modal-dialog', currentModal).replaceWith $('.modal-dialog', @$el)
    else
      @options.domContainer.html @$el
      currentModal = @$el.detach().appendTo('body')
      @$el.modal "show"
  closeModal: ->
    @$el.modal "hide"
    @$el.remove()
    currentModal = null
  showFolder: (event) ->
    displayLoader $(".modal-body-content", @$el)
    GalleryLoad $(event.target), $(".modal-body-content", @$el)
  reloadFolder: ->
    displayLoader $('.modal-body-menu', @$el)
    viewContext = @
    $.ajax
      url: @options.url
      method: 'GET'
      success: (response) ->
        $('.modal-body-menu', currentModal).html response
    return
  openForm: (event) ->
    event.preventDefault()
    displayLoader $(".modal-body-content", @$el)
    folderName = $(".js-widget-title", @$el).text()
    domContainer = $(".modal-body-content", @$el)
    @listenToOnce(formChannel, 'formSubmit', @reloadFolder) if $(event.target).hasClass('media-modal-menu-new-folder')
    $.ajax
      url: $(event.target).attr('data-url')
      method: 'GET'
      success: (response) ->
        viewClass = appConfigurationView.getConfiguration('media', 'showMediaForm')
        new viewClass(
            html: response
            domContainer: domContainer
            title: $.trim(folderName)
          )
)
{'fraction_non_alphanumeric': 0.15793321959541798, 'fraction_numerical': 0.0, 'mean_word_length': 3.0433497536945815, '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': '2767751', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1282, 'n_words': 234}