<commit_before>class window.FactVoteView extends Backbone.Marionette.Layout
  template:
    text: """
      <div class="discussion-evidenceish discussion-evidenceish-box">
        <div class="discussion-evidenceish-content">
          <div>Agrees: <div class="js-avatars-believes-region"></div></div>
          <div>Unsure: <div class="js-avatars-doubts-region"></div></div>
          <div>Disagrees: <div class="js-avatars-disbelieves-region"></div></div>
        </div>
      </div>
    """

  regions:
    avatarsBelievesRegion: '.js-avatars-believes-region'
    avatarsDoubtsRegion: '.js-avatars-doubts-region'
    avatarsDisbelievesRegion: '.js-avatars-disbelieves-region'

  onRender: ->
    opinionatersCollection = new OpinionatersCollection [
      new OpinionatersEvidence(type: 'believes')
      new OpinionatersEvidence(type: 'disbelieves')
      new OpinionatersEvidence(type: 'doubts')
    ], fact: @model
    opinionatersCollection.fetch()

    @avatarsBelievesRegion.show new InteractingUsersAvatarsView
      collection: opinionatersCollection.get('believes').opinionaters()
    @avatarsDisbelievesRegion.show new InteractingUsersAvatarsView
      collection: opinionatersCollection.get('disbelieves').opinionaters()
    @avatarsDoubtsRegion.show new InteractingUsersAvatarsView
      collection: opinionatersCollection.get('doubts').opinionaters()<commit_msg>Made buttons update and clickable<commit_after>class window.FactVoteView extends Backbone.Marionette.Layout
  template:
    text: """
      <div class="discussion-evidenceish discussion-evidenceish-box">
        <div class="discussion-evidenceish-content">
          <div><button class="button js-button-believes">Agree <span class="opinion_indicator agreeing"> </button> <div class="js-avatars-believes-region"></div></div>
          <div><button class="button js-button-doubts">Unsure <span class="opinion_indicator unsure"> </button> <div class="js-avatars-doubts-region"></div></div>
          <div><button class="button js-button-disbelieves">Disagree <span class="opinion_indicator disagreeing"> </button> <div class="js-avatars-disbelieves-region"></div></div>
        </div>
      </div>
    """

  regions:
    avatarsBelievesRegion: '.js-avatars-believes-region'
    avatarsDoubtsRegion: '.js-avatars-doubts-region'
    avatarsDisbelievesRegion: '.js-avatars-disbelieves-region'

  events:
    'click .js-button-believes': -> @_votes.saveCurrentUserOpinion 'believes'
    'click .js-button-doubts': -> @_votes.saveCurrentUserOpinion 'doubts'
    'click .js-button-disbelieves': -> @_votes.saveCurrentUserOpinion 'disbelieves'

  onRender: ->
    opinionatersCollection = new OpinionatersCollection [
      new OpinionatersEvidence(type: 'believes')
      new OpinionatersEvidence(type: 'disbelieves')
      new OpinionatersEvidence(type: 'doubts')
    ], fact: @model
    opinionatersCollection.fetch()

    @avatarsBelievesRegion.show new InteractingUsersAvatarsView
      collection: opinionatersCollection.get('believes').opinionaters()
    @avatarsDisbelievesRegion.show new InteractingUsersAvatarsView
      collection: opinionatersCollection.get('disbelieves').opinionaters()
    @avatarsDoubtsRegion.show new InteractingUsersAvatarsView
      collection: opinionatersCollection.get('doubts').opinionaters()

    @_votes = @model.getFactVotes()
    @listenTo @_votes, 'change:current_user_opinion', @_updateActiveButton
    @_updateActiveButton()

  _updateActiveButton: ->
    @$('button').removeClass 'button-success button-confirm button-danger'

    switch @_votes.get('current_user_opinion')
      when 'believes'
        @$('.js-button-believes').addClass 'button-success'
      when 'doubts'
        @$('.js-button-doubts').addClass 'button-confirm'
      when 'disbelieves'
        @$('.js-button-disbelieves').addClass 'button-danger'
{'fraction_non_alphanumeric': 0.12982273201251304, 'fraction_numerical': 0.0, 'mean_word_length': 4.3664335664335665, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 50, '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': '5319737', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1141, 'n_words': 180}