<commit_before>module AdminHelper

  def typus_block(*args)

    options = args.extract_options!

    partials_path = "admin/#{options[:location]}"
    resources_partials_path = 'admin/models'

    partials = ActionController::Base.view_paths.map do |view_path|
      Dir["#{view_path}/#{partials_path}/*"].map { |f| File.basename(f, '.html.erb') }
    end.flatten
    resources_partials = Dir[Rails.root.join("app/views/#{resources_partials_path}/*")].map { |f| File.basename(f, '.html.erb') }

    partial = "_#{options[:partial]}"

    path = if partials.include?(partial) then partials_path
           elsif resources_partials.include?(partial) then resources_partials_path
           end

    render "#{path}/#{options[:partial]}" if path

  end

  def page_title
    (Typus.admin_title + " - " + @page_title.join(" &rsaquo; ")).html_safe
  end

  def header

    links = [ (link_to_unless_current _("Dashboard"), admin_dashboard_path) ]

    Typus.models_on_header.each do |model|
      links << (link_to_unless_current model.constantize.model_name.human.pluralize, :controller => "/admin/#{model.tableize}")
    end

    if Rails.application.routes.routes.map(&:name).include?(:root)
      links << (link_to _("View site"), root_path, :target => 'blank')
    end

    render "admin/helpers/header", 
           :links => links

  end

  def login_info(user = @current_user)

    return if user.kind_of?(AdminUserFake)

    admin_edit_typus_user_path = { :controller => "/admin/#{Typus.user_class.to_resource}", 
                                   :action => 'edit', 
                                   :id => user.id }

    message = _("Are you sure you want to sign out and end your session?")

    user_details = if user.can?('edit', Typus.user_class_name)
                     link_to user.name, admin_edit_typus_user_path
                   else
                     user.name
                   end

    render "admin/helpers/login_info", 
           :message => message, 
           :user_details => user_details

  end

  def display_flash_message(message = flash)

    return if message.empty?
    flash_type = message.keys.first

    render "admin/helpers/flash_message", 
           :flash_type => flash_type, 
           :message => message

  end

end
<commit_msg>Do not show dashboard link when we are on the dashboard<commit_after>module AdminHelper

  def typus_block(*args)

    options = args.extract_options!

    partials_path = "admin/#{options[:location]}"
    resources_partials_path = 'admin/models'

    partials = ActionController::Base.view_paths.map do |view_path|
      Dir["#{view_path}/#{partials_path}/*"].map { |f| File.basename(f, '.html.erb') }
    end.flatten
    resources_partials = Dir[Rails.root.join("app/views/#{resources_partials_path}/*")].map { |f| File.basename(f, '.html.erb') }

    partial = "_#{options[:partial]}"

    path = if partials.include?(partial) then partials_path
           elsif resources_partials.include?(partial) then resources_partials_path
           end

    render "#{path}/#{options[:partial]}" if path

  end

  def page_title
    (Typus.admin_title + " - " + @page_title.join(" &rsaquo; ")).html_safe
  end

  def header

    links = []

    unless params[:controller] == 'admin/dashboard'
      links << (link_to_unless_current _("Dashboard"), admin_dashboard_path)
    end

    Typus.models_on_header.each do |model|
      links << (link_to_unless_current model.constantize.model_name.human.pluralize, :controller => "/admin/#{model.tableize}")
    end

    if Rails.application.routes.routes.map(&:name).include?(:root)
      links << (link_to _("View site"), root_path, :target => 'blank')
    end

    render "admin/helpers/header", 
           :links => links

  end

  def login_info(user = @current_user)

    return if user.kind_of?(AdminUserFake)

    admin_edit_typus_user_path = { :controller => "/admin/#{Typus.user_class.to_resource}", 
                                   :action => 'edit', 
                                   :id => user.id }

    message = _("Are you sure you want to sign out and end your session?")

    user_details = if user.can?('edit', Typus.user_class_name)
                     link_to user.name, admin_edit_typus_user_path
                   else
                     user.name
                   end

    render "admin/helpers/login_info", 
           :message => message, 
           :user_details => user_details

  end

  def display_flash_message(message = flash)

    return if message.empty?
    flash_type = message.keys.first

    render "admin/helpers/flash_message", 
           :flash_type => flash_type, 
           :message => message

  end

end

{'fraction_non_alphanumeric': 0.1247063847960709, 'fraction_numerical': 0.0, 'mean_word_length': 2.6114109483423285, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '91918', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1436, 'n_words': 289}