<commit_before>VersionSelectView = OrchestraView.extend(
  tagName: "select"

  events:
    'change': 'changeVersion'

  initialize: (options) ->
    @options = options
    @loadTemplates [
      "OpenOrchestraBackofficeBundle:BackOffice:Underscore/widgetVersionSelect"
      "OpenOrchestraBackofficeBundle:BackOffice:Underscore/widgetVersion"
    ]
    return

  render: ->
    @setElement @renderTemplate('OpenOrchestraBackofficeBundle:BackOffice:Underscore/widgetVersionSelect')
    @options.domContainer.replaceWith @$el
    for version of @options.versions
      versionElement = new VersionviewModel
      versionElement.set @options.versions[version]
      new VersionView(
        element: versionElement
        currentVersion: @options.currentVersion
        domContainer: @$el
      )
    return

  changeVersion: (event) ->
    event.preventDefault()
    displayLoader()
    redirectUrl = appRouter.generateUrl(@options.currentVersion.path, appRouter.addParametersToRoute(
      version: event.currentTarget.value
      language: @options.currentVersion.language
    ))
    Backbone.history.navigate(redirectUrl, {trigger: true})
)<commit_msg>Use reduceOptions in VersionSelectView<commit_after>VersionSelectView = OrchestraView.extend(
  tagName: "select"

  events:
    'change': 'changeVersion'

  initialize: (options) ->
    @options = @reduceOption(options, [
      'currentVersion'
      'versions'
      'domContainer'
    ])
    @loadTemplates [
      "OpenOrchestraBackofficeBundle:BackOffice:Underscore/widgetVersionSelect"
      "OpenOrchestraBackofficeBundle:BackOffice:Underscore/widgetVersion"
    ]
    return

  render: ->
    @setElement @renderTemplate('OpenOrchestraBackofficeBundle:BackOffice:Underscore/widgetVersionSelect')
    @options.domContainer.replaceWith @$el
    for version of @options.versions
      versionElement = new VersionviewModel
      versionElement.set @options.versions[version]
      new VersionView(
        element: versionElement
        currentVersion: @options.currentVersion
        domContainer: @$el
      )
    return

  changeVersion: (event) ->
    event.preventDefault()
    displayLoader()
    redirectUrl = appRouter.generateUrl(@options.currentVersion.path, appRouter.addParametersToRoute(
      version: event.currentTarget.value
      language: @options.currentVersion.language
    ))
    Backbone.history.navigate(redirectUrl, {trigger: true})
)
{'fraction_non_alphanumeric': 0.09256198347107437, 'fraction_numerical': 0.0, 'mean_word_length': 3.950920245398773, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3437915', 'n_tokens_mistral': 669, 'n_tokens_neox': 656, 'n_words': 110}