<commit_before>module ChaltronHelper

  def ldap_enabled?
    Devise.omniauth_providers.include? :ldap
  end

  #
  # Flash messages
  #
  def bootstrap_class_for(flash_type)
    {
      success: 'alert-success',
      error:   'alert-danger',
      alert:   'alert-warning',
      notice:  'alert-info'
    }[flash_type] || flash_type.to_s
  end

  def flash_message(message, type)
    content_tag(:div, message, class: "alert #{bootstrap_class_for(type)} alert_link") do
      content_tag(:strong, I18n.t("chaltron.flash.#{type}").capitalize + ': ') +
      message
    end
  end

  def back_link
    link_to :back, class: 'btn btn-primary' do
      icon('arrow-left') + '&nbsp;'.html_safe + t('chaltron.common.back')
    end
  end
end<commit_msg>add options to back_link helper<commit_after>module ChaltronHelper

  def ldap_enabled?
    Devise.omniauth_providers.include? :ldap
  end

  #
  # Flash messages
  #
  def bootstrap_class_for(flash_type)
    {
      success: 'alert-success',
      error:   'alert-danger',
      alert:   'alert-warning',
      notice:  'alert-info'
    }[flash_type] || flash_type.to_s
  end

  def flash_message(message, type)
    content_tag(:div, message, class: "alert #{bootstrap_class_for(type)} alert_link") do
      content_tag(:strong, I18n.t("chaltron.flash.#{type}").capitalize + ': ') +
      message
    end
  end

  def back_link(opts={})
    klass = opts[:class] || 'btn btn-primary'
    text  = opts[:text] || t('chaltron.common.back')
    ic    = opts[:icon]  || 'arrow-left'

    link_to :back, class: klass do
      icon(ic) + '&nbsp;'.html_safe + text
    end
  end
end
{'fraction_non_alphanumeric': 0.1361675908810844, 'fraction_numerical': 0.0024645717806531116, 'mean_word_length': 3.1218274111675126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4376628', 'n_tokens_mistral': 597, 'n_tokens_neox': 565, 'n_words': 114}