<commit_before>class window.AddEvidenceFormView extends Backbone.Marionette.Layout
  className: 'add-evidence-form'
  template: 'evidence/add_evidence_form'

  regions:
    inputRegion:
      selector: '.input-region'
      regionType: Factlink.DetachableViewsRegion

  events:
    'change input[name=argumentType]': '_updateArgumentType'
    'click .js-switch-to-factlink': '_switchToAddFactRelationView'
    'click .js-switch-to-comment': '_switchToAddCommentView'
    'click .js-change-type': '_showTypeSelector'

  ui:
    switchToFactlink: '.js-switch-to-factlink'
    switchToComment: '.js-switch-to-comment'
    question: '.js-question'
    questionContainer: '.js-question-container'
    typeSelector: '.js-type-selector'

  initialize: ->
    @_argumentTypeModel = new Backbone.Model
    @_factTally = @collection.fact.getFactTally()
    @listenTo @_factTally, 'change:current_user_opinion', @_setArgumentTypeToOpinion

    @_searchView = new AutoCompleteFactRelationsView
      collection: @_filtered_facts()
      addToCollection: @collection
      fact_id: @collection.fact.id
      argumentTypeModel: @_argumentTypeModel

    @_addCommentView = new AddCommentView
      addToCollection: @collection
      argumentTypeModel: @_argumentTypeModel

    @inputRegion.defineViews
      search_view: => @_searchView
      add_comment_view: => @_addCommentView

  onRender: ->
    @_setArgumentTypeToOpinion()
    @_switchToAddCommentView()

  focus: ->
    @_switchToAddCommentView()

  _showQuestion: ->
    @ui.questionContainer.show()
    @ui.typeSelector.hide()

  _showTypeSelector: ->
    @ui.typeSelector.show()
    @ui.questionContainer.hide()

  _updateArgumentType: -><commit_msg>Do not load recently facts immediately<commit_after>class window.AddEvidenceFormView extends Backbone.Marionette.Layout
  className: 'add-evidence-form'
  template: 'evidence/add_evidence_form'

  regions:
    inputRegion:
      selector: '.input-region'
      regionType: Factlink.DetachableViewsRegion

  events:
    'change input[name=argumentType]': '_updateArgumentType'
    'click .js-switch-to-factlink': '_switchToAddFactRelationView'
    'click .js-switch-to-comment': '_switchToAddCommentView'
    'click .js-change-type': '_showTypeSelector'

  ui:
    switchToFactlink: '.js-switch-to-factlink'
    switchToComment: '.js-switch-to-comment'
    question: '.js-question'
    questionContainer: '.js-question-container'
    typeSelector: '.js-type-selector'

  initialize: ->
    @_argumentTypeModel = new Backbone.Model
    @_factTally = @collection.fact.getFactTally()
    @listenTo @_factTally, 'change:current_user_opinion', @_setArgumentTypeToOpinion

    @inputRegion.defineViews
      search_view: => new AutoCompleteFactRelationsView
        collection: @_filtered_facts()
        addToCollection: @collection
        fact_id: @collection.fact.id
        argumentTypeModel: @_argumentTypeModel
      add_comment_view: => new AddCommentView
        addToCollection: @collection
        argumentTypeModel: @_argumentTypeModel


  onRender: ->
    @_setArgumentTypeToOpinion()
    @_switchToAddCommentView()

  focus: ->
    @_switchToAddCommentView()

  _showQuestion: ->
    @ui.questionContainer.show()
    @ui.typeSelector.hide()

  _showTypeSelector: ->
    @ui.typeSelector.show()
    @ui.questionContainer.hide()

  _updateArgumentType: ->
{'fraction_non_alphanumeric': 0.10905840286054827, 'fraction_numerical': 0.0, 'mean_word_length': 3.973333333333333, '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': '2767830', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1011, 'n_words': 167}