Flowdock
method

set_index

Importance_0
v2.3.8 - Show latest stable - 0 notes - Class: RailsGuides::Generator
set_index(body, view) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File railties/guides/rails_guides/generator.rb, line 78
    def set_index(body, view)
      index = "<div id=\"subCol\">\n<h3 class=\"chapter\"><img src=\"images/chapters_icon.gif\" alt=\"\" />Chapters</h3>\n<ol class=\"chapters\">\n"

      i = Indexer.new(body)
      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]) }

        children = value.keys.map do |k|
          l = view.content_tag(:a, :href => k[:id]) { textile(k[:title]) }
          view.content_tag(:li, l)
        end

        children_ul = view.content_tag(:ul, children)

        index << view.content_tag(:li, link + children_ul)
      end

      index << '</ol>'
      index << '</div>'

      view.content_for(:index_section) { index }

      i.result
    end
Register or log in to add new notes.