<commit_before># Admin Helper
#
# Created on April 30, 2009 15:41 by <NAME> as part
# of the "authentication" project.
#
#--
# Copyright (c) 2006-2009 Rubaidh Ltd.  All rights reserved.
# See LICENSE in the top level source code folder for permissions.
#++

module AdminHelper

  def generate_admin_navigation
    # Dig into the routes and pull out all the admin ones
    routes = ActionController::Routing::Routes.routes.collect do |route|
      route.segments.to_s if route.segments.to_s.match(/^\/admin/)
    end.compact.flatten

    # get the unqiue controller names
    controllers = routes.map { |route| route.gsub(/^\/admin\/([^(\/]+).*$/, "\\1")}.uniq

    output_string = "<ul>"
    controllers.each do |name|
      output_string << content_tag("li#{" class=\"active\"" if controller_name == name.pluralize}", link_to("#{name.humanize}", "/admin/#{name}"))
    end
    output_string << "</ul>"
    output_string
  end

end<commit_msg>Update the helper that generates the admin navigation to ignore cases where admin.root has been setup<commit_after># Admin Helper
#
# Created on April 30, 2009 15:41 by <NAME> as part
# of the "authentication" project.
#
#--
# Copyright (c) 2006-2009 Rubaidh Ltd.  All rights reserved.
# See LICENSE in the top level source code folder for permissions.
#++

module AdminHelper

  def generate_admin_navigation
    # Dig into the routes and pull out all the admin ones
    routes = ActionController::Routing::Routes.routes.collect do |route|
      route.segments.to_s if route.segments.to_s.match(/^\/admin/)
    end.compact.flatten

    # get the unqiue controller names
    controllers = routes.map { |route| route.gsub(/^\/admin\/([^(\/]+).*$/, "\\1")}.uniq - ['/admin/']

    output_string = "<ul>"
    controllers.each do |name|
      output_string << content_tag("li#{" class=\"active\"" if controller_name == name.pluralize}", link_to("#{name.humanize}", "/admin/#{name}"))
    end
    output_string << "</ul>"
    output_string
  end

end
{'fraction_non_alphanumeric': 0.14386317907444668, 'fraction_numerical': 0.019114688128772636, 'mean_word_length': 3.541095890410959, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 9, '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': '6583085', 'n_tokens_mistral': 660, 'n_tokens_neox': 621, 'n_words': 191}