From d6d561eed9d31e757650bd1440350dd8f892aeda Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 25 Dec 2011 04:07:49 -0800 Subject: download guides for the Kindle and Kindle apps from the home page --- railties/guides/assets/stylesheets/main.css | 8 ++++++++ railties/guides/rails_guides/generator.rb | 11 +++++++---- railties/guides/source/index.html.erb | 6 +++++- railties/guides/source/kindle/welcome.html.erb | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/railties/guides/assets/stylesheets/main.css b/railties/guides/assets/stylesheets/main.css index cf6e9e5cc8..4a775f632c 100644 --- a/railties/guides/assets/stylesheets/main.css +++ b/railties/guides/assets/stylesheets/main.css @@ -341,6 +341,14 @@ h6 { margin-top: 0.25em; } +#mainCol dd.kindle, #subCol dd.kindle { + background: #d5e9f6 url(../images/tab_info.gif) no-repeat left top; + border: none; + padding: 1.25em 1em 1.25em 48px; + margin-left: 0; + margin-top: 0.25em; +} + #mainCol div.warning, #subCol dd.warning { background: #f9d9d8 url(../images/tab_red.gif) no-repeat left top; border: none; diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index f138a58f16..71c1c49b23 100644 --- a/railties/guides/rails_guides/generator.rb +++ b/railties/guides/rails_guides/generator.rb @@ -117,15 +117,18 @@ module RailsGuides end def generate_mobi - opf = "#{output_dir}/rails_guides.opf" - mobi = "ruby_on_rails_guides_#@version%s.mobi" % (@lang.present? ? ".#@lang" : '') - out = "#{output_dir}/kindlegen.out" + opf = "#{output_dir}/rails_guides.opf" + out = "#{output_dir}/kindlegen.out" system "kindlegen #{opf} -o #{mobi} > #{out} 2>&1" puts "Guides compiled as Kindle book to #{mobi}" puts "(kindlegen log at #{out})." end + def mobi + "ruby_on_rails_guides_#@version%s.mobi" % (@lang.present? ? ".#@lang" : '') + end + def initialize_dirs(output) @guides_dir = File.join(File.dirname(__FILE__), '..') @source_dir = "#@guides_dir/source/#@lang" @@ -196,7 +199,7 @@ module RailsGuides layout = kindle? ? 'kindle/layout' : 'layout' File.open(output_path, 'w') do |f| - view = ActionView::Base.new(source_dir, :version => @version) + view = ActionView::Base.new(source_dir, :version => @version, :mobi => "kindle/#{mobi}") view.extend(Helpers) if guide =~ /\.(\w+)\.erb$/ diff --git a/railties/guides/source/index.html.erb b/railties/guides/source/index.html.erb index da1a37015b..eafe1884f2 100644 --- a/railties/guides/source/index.html.erb +++ b/railties/guides/source/index.html.erb @@ -9,6 +9,10 @@ Ruby on Rails Guides <% content_for :index_section do %>
+
Rails Guides are also available for the <%= link_to 'Kindle', 'https://kindle.amazon.com' %> +and <%= link_to 'Free Kindle Reading Apps', 'www.amazon.com/gp/kindle/kcp' %> for the iPad, +iPhone, Mac, Android, etc. Download them from <%= link_to 'here', @mobi %>. +
Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections to the author.
@@ -22,5 +26,5 @@ Ruby on Rails Guides

<%= document['description'] %>

<% end %> <% end %> - + <% end %> diff --git a/railties/guides/source/kindle/welcome.html.erb b/railties/guides/source/kindle/welcome.html.erb index e2155ee1de..e30704c4e6 100644 --- a/railties/guides/source/kindle/welcome.html.erb +++ b/railties/guides/source/kindle/welcome.html.erb @@ -2,4 +2,4 @@

Kindle Edition

-The Kindle Edition of the Rails Guides should be considered a 'work in progress'. Track changes and raise issues at https://github.com/mipearson/rails/tree/guides_for_kindle. \ No newline at end of file +The Kindle Edition of the Rails Guides should be considered a work in progress. Feedback is really welcome, please see the "Feedback" section at the end of each guide for instructions. -- cgit v1.2.3