aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides/helpers.rb
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2011-12-31 22:55:25 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-01-01 23:04:37 +0530
commit6e9cd3846811718611543dae049c000076319587 (patch)
tree86b45a9d5fb66305319aae685170799c450f97b9 /railties/guides/rails_guides/helpers.rb
parent8be9d92c8b8a213c7830d5ba130514f9e207cbfe (diff)
downloadrails-6e9cd3846811718611543dae049c000076319587.tar.gz
rails-6e9cd3846811718611543dae049c000076319587.tar.bz2
rails-6e9cd3846811718611543dae049c000076319587.zip
DRY up guides index page
Use the list of guides available in documents.yaml to fill in the menu in the index page instead of duplicating the list again. Also, remove WIP guides from the menu.
Diffstat (limited to 'railties/guides/rails_guides/helpers.rb')
-rw-r--r--railties/guides/rails_guides/helpers.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/railties/guides/rails_guides/helpers.rb b/railties/guides/rails_guides/helpers.rb
index 45ad9b9588..e6ef656474 100644
--- a/railties/guides/rails_guides/helpers.rb
+++ b/railties/guides/rails_guides/helpers.rb
@@ -11,15 +11,23 @@ module RailsGuides
result << content_tag(:dd, capture(&block))
result
end
-
+
def documents_by_section
@documents_by_section ||= YAML.load_file(File.expand_path('../../source/documents.yaml', __FILE__))
end
-
+
def documents_flat
documents_by_section.map {|section| section['documents']}.flatten
end
+ def finished_documents(documents)
+ documents.reject { |document| document['work_in_progress'] }
+ end
+
+ def docs_for_menu(position)
+ position == 'L' ? documents_by_section.to(3) : documents_by_section.from(4)
+ end
+
def author(name, nick, image = 'credits_pic_blank.gif', &block)
image = "images/#{image}"