<commit_before>class App.TicketZoomArticleView extends App.Controller
  constructor: ->
    super
    @articleController = {}
    @run()

  execute: (params) =>
    @ticket_article_ids = params.ticket_article_ids
    @run()

  run: =>
    all = []
    for ticket_article_id in @ticket_article_ids
      controllerKey = ticket_article_id.toString()
      if !@articleController[controllerKey]
        el = $('<div></div>')
        @articleController[controllerKey] = new ArticleViewItem(
          ticket:     @ticket
          object_id:  ticket_article_id
          el:         el
          ui:         @ui
          highligher: @highligher
        )
        all.push el
    @el.append(all)

    # check elements to remove
    for article_id, controller of @articleController
      exists = false
      for localArticleId in @ticket_article_ids
        if localArticleId.toString() is article_id.toString()
          exists = true
      if !exists
        controller.remove()
        delete @articleController[article_id.toString()]

class ArticleViewItem extends App.ObserverController
  model: 'TicketArticle'
  observe:
    from: true
    to: true
    cc: true
    subject: true
    body: true
    internal: true
    preferences: true

  elements:
    '.textBubble-content':           'textBubbleContent'
    '.textBubble-overflowContainer': 'textBubbleOverflowContainer'

  events:
    'click .textBubble':   'toggleMetaWithDelay'
    'click .textBubble a': 'stopPropagation'
    'click .js-unfold':    'unfold'

  constructor: ->
    @seeMore = false

    # set expand of text area only once
    @bind('ui::ticket::shown', (data) =>
      return if data.ticket_id.toString() isnt @ticket.id.toString()

      # set highlighter
      @setHighlighter()

      # set see more
      @setSeeMore()
    )

    super

  setHighlighter: =>
    return if @el.is(':hidden')<commit_msg>Fixed overflow of event binding (because super was to late).<commit_after>class App.TicketZoomArticleView extends App.Controller
  constructor: ->
    super
    @articleController = {}
    @run()

  execute: (params) =>
    @ticket_article_ids = params.ticket_article_ids
    @run()

  run: =>
    all = []
    for ticket_article_id in @ticket_article_ids
      controllerKey = ticket_article_id.toString()
      if !@articleController[controllerKey]
        el = $('<div></div>')
        @articleController[controllerKey] = new ArticleViewItem(
          ticket:     @ticket
          object_id:  ticket_article_id
          el:         el
          ui:         @ui
          highligher: @highligher
        )
        all.push el
    @el.append(all)

    # check elements to remove
    for article_id, controller of @articleController
      exists = false
      for localArticleId in @ticket_article_ids
        if localArticleId.toString() is article_id.toString()
          exists = true
      if !exists
        controller.remove()
        delete @articleController[article_id.toString()]

class ArticleViewItem extends App.ObserverController
  model: 'TicketArticle'
  observe:
    from: true
    to: true
    cc: true
    subject: true
    body: true
    internal: true
    preferences: true

  elements:
    '.textBubble-content':           'textBubbleContent'
    '.textBubble-overflowContainer': 'textBubbleOverflowContainer'

  events:
    'click .textBubble':   'toggleMetaWithDelay'
    'click .textBubble a': 'stopPropagation'
    'click .js-unfold':    'unfold'

  constructor: ->
    super
    @seeMore = false

    # set expand of text area only once
    @bind('ui::ticket::shown', (data) =>
      return if data.ticket_id.toString() isnt @ticket.id.toString()

      # set highlighter
      @setHighlighter()

      # set see more
      @setSeeMore()
    )

  setHighlighter: =>
    return if @el.is(':hidden')
{'fraction_non_alphanumeric': 0.09900210084033613, 'fraction_numerical': 0.0, 'mean_word_length': 2.520332717190388, 'pattern_counts': {'":': 0, '<': 7, '<?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': '830379', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1107, 'n_words': 274}