method
set_index

v3.0.9 -
Show latest stable
-
0 notes -
Class: RailsGuides::Generator
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (0)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
set_index(body, view)
private
Hide source
# File railties/guides/rails_guides/generator.rb, line 163 def set_index(body, view) index = <div id="subCol"> <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3> <ol class="chapters"> i = Indexer.new(body, warnings) i.index # Set index for 2 levels i.level_hash.each do |key, value| link = view.content_tag(:a, :href => key[:id]) { textile(key[:title], true).html_safe } children = value.keys.map do |k| view.content_tag(:li, view.content_tag(:a, :href => k[:id]) { textile(k[:title], true).html_safe }) end children_ul = children.empty? ? "" : view.content_tag(:ul, children.join(" ").html_safe) index << view.content_tag(:li, link.html_safe + children_ul.html_safe) end index << '</ol>' index << '</div>' view.content_for(:index_section) { index.html_safe } i.result end