<commit_before>class @BlockChartView extends BaseChartView
  initialize: ->
    @initialize_defaults()

  render: =>
    unless @drawn
      @clear_container()
      @container_node().html(@html())
      @drawn = true
      @setup_checkboxes()
      @setup_callbacks()
      @hide_format_toggler()
    @update_block_charts()

  already_on_screen: =>
    @container_node().find("#blockchart").length == 1

  html: => @model.get 'html'

  results: =>
    @model.series.map (serie) -> serie.result()

  can_be_shown_as_table: -> false

  # for some reason the standard backbone views events don't work
  # as expected
  setup_callbacks: =>
    $('#block_list li').mouseenter -> $(this).find("ul").show(1)
    $('#block_list li').mouseleave -> $(this).find("ul").hide(1)
    $('.show_hide_block').click (e) =>
      block_id = $(e.target).attr('data-block_id')
      @toggle_block(block_id)
      @align_checkbox(block_id)
      false
    $('.block_list_checkbox').click (e) =>
      if $(e.target).is(':checked')
        for item in $(e.target).parent().find('.show_hide_block')
          block_id = $(item).attr('data-block_id')
          @show_block(block_id)
      else
        for item in $(e.target).parent().find('.show_hide_block')
          block_id = $(item).attr('data-block_id')
          @hide_block(block_id)
    $(".block").qtip
      content:
        title: ->
          $(this).attr('data-title')
        text: ->
          item = $(this)
          cost =   Metric.autoscale_value item.parent().data('cost'), 'Eur/MWhe'
          invest = Metric.autoscale_value item.parent().data('invest'), 'Eur/MWe'
          url = "/descriptions/#{item.attr('data-description_id')}"
          "#{item.attr('data-description')}
          <br/><br/>
          #{I18n.t 'output_elements.block_chart.costs'}: #{cost}<br/>
          #{I18n.t 'output_elements.block_chart.investment_costs'}: #{invest}
          <br/><br>
          <a href='#{url}' class='fancybox'>#{I18n.t 'output_elements.common.read_more'}</a>"
      hide:
        fixed: true
        delay: 300
      position:
        my: 'bottom center'
        at: 'top center'
      style:
        tip:
          corner: false

  setup_checkboxes: ->
    for item in $(".block_list_checkbox")
      if $(item).parent().find('.visible').length > 0<commit_msg>Block Charts: fixed tooltip text update. Closes #1234<commit_after>class @BlockChartView extends BaseChartView
  initialize: ->
    @initialize_defaults()

  render: =>
    unless @drawn
      @clear_container()
      @container_node().html(@html())
      @drawn = true
      @setup_checkboxes()
      @setup_callbacks()
      @hide_format_toggler()
    @update_block_charts()

  already_on_screen: =>
    @container_node().find("#blockchart").length == 1

  html: => @model.get 'html'

  results: =>
    @model.series.map (serie) -> serie.result()

  can_be_shown_as_table: -> false

  # for some reason the standard backbone views events don't work
  # as expected
  setup_callbacks: =>
    $('#block_list li').mouseenter -> $(this).find("ul").show(1)
    $('#block_list li').mouseleave -> $(this).find("ul").hide(1)
    $('.show_hide_block').click (e) =>
      block_id = $(e.target).attr('data-block_id')
      @toggle_block(block_id)
      @align_checkbox(block_id)
      false
    $('.block_list_checkbox').click (e) =>
      if $(e.target).is(':checked')
        for item in $(e.target).parent().find('.show_hide_block')
          block_id = $(item).attr('data-block_id')
          @show_block(block_id)
      else
        for item in $(e.target).parent().find('.show_hide_block')
          block_id = $(item).attr('data-block_id')
          @hide_block(block_id)
    $(".block").qtip
      content:
        title: ->
          $(this).attr('data-title')
        text: ->
          item = $(this)
          cost =   Metric.autoscale_value +item.parent().attr('data-cost'), 'Eur/MWhe'
          invest = Metric.autoscale_value +item.parent().attr('data-invest'), 'Eur/MWe'
          url = "/descriptions/#{item.attr('data-description_id')}"
          "#{item.attr('data-description')}
          <br/><br/>
          #{I18n.t 'output_elements.block_chart.costs'}: #{cost}<br/>
          #{I18n.t 'output_elements.block_chart.investment_costs'}: #{invest}
          <br/><br>
          <a href='#{url}' class='fancybox'>#{I18n.t 'output_elements.common.read_more'}</a>"
      hide:
        fixed: true
        delay: 300
      position:
        my: 'bottom center'
        at: 'top center'
      style:
        tip:
          corner: false

  setup_checkboxes: ->
    for item in $(".block_list_checkbox")
      if $(item).parent().find('.visible').length > 0
{'fraction_non_alphanumeric': 0.1730851519041506, 'fraction_numerical': 0.006418485237483954, 'mean_word_length': 2.621223857474826, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 49, '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': '673991', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1521, 'n_words': 262}