<commit_before>$(document).on 'show.bs.popover', '.notifications', (e) ->
  $notifications = $(e.target).closest('.notifications').addClass 'active'
  $('.notifications').not($notifications).removeClass('active').find('a').popover 'hide'

$(document).on 'hide.bs.popover', '.notifications', (e) ->
  $(e.target).closest('.notifications').removeClass 'active'

$(document).on 'shown.bs.popover', '.notifications', (e) ->
  $target = $(e.target)
  $popover = $target.closest('.notifications').find('.popover')
  if $target.data('remote')
    $.ajax
      url: $target.data('remote')
      beforeSend: ->
        $('.popover-body').html $('.popover-body-loading').html()
      success: (messages) ->
        $target.data('unread', messages.length).find('span.unread-count').text(if messages.length > 0 then messages.length else '')
        if messages.length > 0
          $('.popover-body').html HandlebarsTemplates['notifications/messages']({ messages: messages })
        else
          $popover.find('.popover-body').text I18n.t("javascript.notifications.#{$target.data('notificationsType')}.no_new")

$(document).on window.initializeOnEvent, ->
  $('.notifications').each ->
    $target = $(this).find('> a')
    unread = $target.data('unread')
    $target.find('.unread-count').text(unread).show() if unread > 0

    notificationsType = $target.data('notificationsType')
    popoverData =
      footer_url: $target.attr('href')
      no_notifications_text: I18n.t("javascript.notifications.#{notificationsType}.no_new")
      footer_link_text: I18n.t("javascript.notifications.#{notificationsType}.see_all")

    $target.on('click', (e) ->
      e.preventDefault()
      false
    ).popover
      placement: 'bottom'
      html: true
      container: $(this)
      template: HandlebarsTemplates['notifications/base'](popoverData)
      title: I18n.t("javascript.notifications.#{notificationsType}.title")
      trigger: 'focus'
<commit_msg>Trigger popover on click event<commit_after>$(document).on 'show.bs.popover', '.notifications', (e) ->
  $notifications = $(e.target).closest('.notifications').addClass 'active'
  $('.notifications').not($notifications).removeClass('active').find('a').popover 'hide'

$(document).on 'hide.bs.popover', '.notifications', (e) ->
  $(e.target).closest('.notifications').removeClass 'active'

$(document).on 'shown.bs.popover', '.notifications', (e) ->
  $target = $(e.target)
  $popover = $target.closest('.notifications').find('.popover')
  if $target.data('remote')
    $.ajax
      url: $target.data('remote')
      beforeSend: ->
        $('.popover-body').html $('.popover-body-loading').html()
      success: (messages) ->
        $target.data('unread', messages.length).find('span.unread-count').text(if messages.length > 0 then messages.length else '')
        if messages.length > 0
          $('.popover-body').html HandlebarsTemplates['notifications/messages']({ messages: messages })
        else
          $popover.find('.popover-body').text I18n.t("javascript.notifications.#{$target.data('notificationsType')}.no_new")

$(document).on window.initializeOnEvent, ->
  $('.notifications').each ->
    $target = $(this).find('> a')
    unread = $target.data('unread')
    $target.find('.unread-count').text(unread).show() if unread > 0

    notificationsType = $target.data('notificationsType')
    popoverData =
      footer_url: $target.attr('href')
      no_notifications_text: I18n.t("javascript.notifications.#{notificationsType}.no_new")
      footer_link_text: I18n.t("javascript.notifications.#{notificationsType}.see_all")

    $target.on('click', (e) ->
      e.preventDefault()
      false
    ).popover
      placement: 'bottom'
      html: true
      container: $(this)
      template: HandlebarsTemplates['notifications/base'](popoverData)
      title: I18n.t("javascript.notifications.#{notificationsType}.title")

{'fraction_non_alphanumeric': 0.19097938144329896, 'fraction_numerical': 0.005670103092783505, 'mean_word_length': 3.9439490445859873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '5268934', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1202, 'n_words': 178}