4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/helpers/api_doc/application_helper.rb', line 4
def
groups = {}
files = Dir.glob(File.join(ApiDoc::Config.view_path, "**", "*.html.erb")).sort
files.each do |file|
name = file.gsub(ApiDoc::Config.view_path, "")
name.gsub!(".html.erb", "")
name.gsub!(/^\//, "")
groups[File.dirname(name)] ||= []
groups[File.dirname(name)] << name
end
html = ""
groups.each do |group, names|
html << "<li class='nav-header'>#{group}</li>"
names.each do |name|
display_name = name.gsub(group, "")
Rails.logger.info display_name
display_name.gsub!(/^\//, "")
Rails.logger.info display_name
display_name.gsub!(/(^[^\_]+)\_/, '\1 ')
Rails.logger.info display_name
display_name.gsub!(/\_\(/, " (")
Rails.logger.info display_name
html << "<li><a href='#{api_doc_page_path(path: name)}'>#{display_name.gsub("_", " ")}</a></li>"
end
end
raw html
end
|