<commit_before>class ShareButtonView extends Backbone.Marionette.ItemView
  tagName: 'span'
  className: 'share-button'
  template: 'generic/empty'

  events:
    'click': 'toggleChecked'

  modelEvents:
    'change': 'render'

  onRender: ->
    @$el.addClass "factlink-icon-#{@options.name}"
    @$el.toggleClass 'share-button-checked', @model.get(@options.name)

  toggleChecked: ->
    @model.set @options.name, !@model.get(@options.name)


class window.ShareNewFactView extends Backbone.Marionette.Layout
  className: 'share-new-fact'
  template: 'share/new_fact'

  regions:
    twitterRegion:  '.js-twitter-region'
    facebookRegion: '.js-facebook-region'

  onRender: ->
    @$el.toggle Factlink.Global.can_haz.share_new_factlink_buttons || false

    @twitterRegion.show  new ShareButtonView(model: @model, name: 'twitter')
    @facebookRegion.show new ShareButtonView(model: @model, name: 'facebook')<commit_msg>Added || false for if the option is undefined<commit_after>class ShareButtonView extends Backbone.Marionette.ItemView
  tagName: 'span'
  className: 'share-button'
  template: 'generic/empty'

  events:
    'click': 'toggleChecked'

  modelEvents:
    'change': 'render'

  onRender: ->
    @$el.addClass "factlink-icon-#{@options.name}"
    @$el.toggleClass 'share-button-checked', @model.get(@options.name) || false

  toggleChecked: ->
    @model.set @options.name, !@model.get(@options.name)


class window.ShareNewFactView extends Backbone.Marionette.Layout
  className: 'share-new-fact'
  template: 'share/new_fact'

  regions:
    twitterRegion:  '.js-twitter-region'
    facebookRegion: '.js-facebook-region'

  onRender: ->
    @$el.toggle Factlink.Global.can_haz.share_new_factlink_buttons || false

    @twitterRegion.show  new ShareButtonView(model: @model, name: 'twitter')
    @facebookRegion.show new ShareButtonView(model: @model, name: 'facebook')
{'fraction_non_alphanumeric': 0.13778484366719662, 'fraction_numerical': 0.0, 'mean_word_length': 4.409742120343839, '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': '1689449', 'n_tokens_mistral': 627, 'n_tokens_neox': 606, 'n_words': 117}