<commit_before>window.ClientController =
  showFact: (fact_id) ->
    fact = new Fact id: fact_id
    fact.on 'destroy', ->
      parent.remote.hide()
      parent.remote.stopHighlightingFactlink fact_id

    fact.fetch success: ->
      newClientModal = new DiscussionModalContainer
      FactlinkApp.discussionModalRegion.show newClientModal

      view = new DiscussionView model: fact
      view.on 'render', parent.onModalReady

      newClientModal.mainRegion.show view

  showNewFact: (params={}) ->
    unless window.currentUser?
      window.location = Factlink.Global.path.sign_in_client()
      return

    clientModal = new DiscussionModalContainer
    FactlinkApp.discussionModalRegion.show clientModal

    csrf_token = $('meta[name=csrf-token]').attr('content')

    FactlinkApp.guided = params.guided == 'true'

    if params.fact
      mp_track("Modal: Open prepare")

    factsNewView = new FactsNewView
      layout: 'client'
      fact_text: params['fact']
      title: params['title']
      url: params['url']
      csrf_token: params['csrf_token']
      guided: FactlinkApp.guided

    factsNewView.on 'render', parent.onModalReady

    factsNewView.on 'factCreated', (fact) ->
      parent.highlightLastCreatedFactlink(fact.id, params['fact'])

    clientModal.mainRegion.show factsNewView
<commit_msg>use normal javascript member syntax<commit_after>window.ClientController =
  showFact: (fact_id) ->
    fact = new Fact id: fact_id
    fact.on 'destroy', ->
      parent.remote.hide()
      parent.remote.stopHighlightingFactlink fact_id

    fact.fetch success: ->
      newClientModal = new DiscussionModalContainer
      FactlinkApp.discussionModalRegion.show newClientModal

      view = new DiscussionView model: fact
      view.on 'render', parent.onModalReady

      newClientModal.mainRegion.show view

  showNewFact: (params={}) ->
    unless window.currentUser?
      window.location = Factlink.Global.path.sign_in_client()
      return

    clientModal = new DiscussionModalContainer
    FactlinkApp.discussionModalRegion.show clientModal

    csrf_token = $('meta[name=csrf-token]').attr('content')

    FactlinkApp.guided = params.guided == 'true'

    if params.fact
      mp_track("Modal: Open prepare")

    factsNewView = new FactsNewView
      layout: 'client'
      fact_text: params.fact
      title: params.title
      url: params.url
      csrf_token: params.csrf_token
      guided: FactlinkApp.guided

    factsNewView.on 'render', parent.onModalReady

    factsNewView.on 'factCreated', (fact) ->
      parent.highlightLastCreatedFactlink(fact.id, params.fact)

    clientModal.mainRegion.show factsNewView

{'fraction_non_alphanumeric': 0.09823108769288671, 'fraction_numerical': 0.0, 'mean_word_length': 3.357377049180328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '975774', 'n_tokens_mistral': 815, 'n_tokens_neox': 752, 'n_words': 158}