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>2011-12-31 22:59:16 +0530
commitb5927b82376ba0982b29d634bd8d4834fcbf740b (patch)
tree5bfe4ccb436d30ab03f0918e9c4af0fa61bbcb6d /railties/guides/rails_guides/helpers.rb
parentd3a2c0e183e52364103c3f60afe0db46417de430 (diff)
downloadrails-b5927b82376ba0982b29d634bd8d4834fcbf740b.tar.gz
rails-b5927b82376ba0982b29d634bd8d4834fcbf740b.tar.bz2
rails-b5927b82376ba0982b29d634bd8d4834fcbf740b.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}"