<commit_before>$(document).on 'page:load ready', ->

  $('#circle_role_role_type').on 'change', (e)->
    $type = $(e.target)
    $name = $type.siblings('#circle_role_name')
    console.log(e)
    console.log($type.val())
    if $type.val() == "circle.custom"
      $name.removeClass("hidden")
    else
      $name.addClass("hidden")
      $name.val("")

  $('#add-role a').on 'click', (e)->
    $('#add-role').addClass('hidden')
    $('#add-role-fields').removeClass('hidden')

  clipboard = new Clipboard('button[type="copy"]')
  clipboard.on 'success', (e)->
      e.clearSelection()
      Lale.Flash.info I18n.t('workflow.copied')

  $('.activate_pending_user').closest('form')
    .on 'ajax:success', (event)->
      $(event.target.closest('tr')).fadeOut 'duration': 1000, complete: ->
        Lale.Flash.info I18n.t('workflow.activation_success')
    .on 'ajax:error', (event)->
      Lale.Flash.error I18n.t('workflow.activation_error') <commit_msg>pending users: JS to hide task counter after user activation<commit_after>$(document).on 'page:load ready', ->

  $('#circle_role_role_type').on 'change', (e)->
    $type = $(e.target)
    $name = $type.siblings('#circle_role_name')
    console.log(e)
    console.log($type.val())
    if $type.val() == "circle.custom"
      $name.removeClass("hidden")
    else
      $name.addClass("hidden")
      $name.val("")

  $('#add-role a').on 'click', (e)->
    $('#add-role').addClass('hidden')
    $('#add-role-fields').removeClass('hidden')

  clipboard = new Clipboard('button[type="copy"]')
  clipboard.on 'success', (e)->
      e.clearSelection()
      Lale.Flash.info I18n.t('workflow.copied')

  $('.activate_pending_user').closest('form')
    .on 'ajax:success', (event)->
      $(event.target.closest('tr')).fadeOut 'duration': 1000, complete: ->
        # FIXME add id to admin link
        # FIXME also update dot in 2nd level nav
        badge = $('#admin_link').children('span.badge')
        task_count = parseInt(badge.text())        
        if (task_count == 1)
          badge.hide()
        else
          badge.text(task_count - 1)
        Lale.Flash.info I18n.t('workflow.activation_success')
    .on 'ajax:error', (event)->
      Lale.Flash.error I18n.t('workflow.activation_error') 
{'fraction_non_alphanumeric': 0.2008869179600887, 'fraction_numerical': 0.010199556541019957, 'mean_word_length': 3.216822429906542, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2395729', 'n_tokens_mistral': 782, 'n_tokens_neox': 761, 'n_words': 132}