aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-12-25 04:07:49 -0800
committerXavier Noria <fxn@hashref.com>2011-12-25 04:10:21 -0800
commitd6d561eed9d31e757650bd1440350dd8f892aeda (patch)
treeca74ce44ce395e1ef9dbd5360635a743b9cd1d89
parent4ae1cdd36be6ad2998da2bb58aebba2ed77e853d (diff)
downloadrails-d6d561eed9d31e757650bd1440350dd8f892aeda.tar.gz
rails-d6d561eed9d31e757650bd1440350dd8f892aeda.tar.bz2
rails-d6d561eed9d31e757650bd1440350dd8f892aeda.zip
download guides for the Kindle and Kindle apps from the home page
-rw-r--r--railties/guides/assets/stylesheets/main.css8
-rw-r--r--railties/guides/rails_guides/generator.rb11
-rw-r--r--railties/guides/source/index.html.erb6
-rw-r--r--railties/guides/source/kindle/welcome.html.erb2
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 %>
<div id="subCol">
<dl>
+ <dd class="kindle">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 %>.
+ </dd>
<dd class="work-in-progress">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.</dd>
</dl>
</div>
@@ -22,5 +26,5 @@ Ruby on Rails Guides
<p><%= document['description'] %></p>
<% end %>
<% end %>
- </dl>
+ </dl>
<% 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 @@
<h3>Kindle Edition</h3>
-The Kindle Edition of the Rails Guides should be considered a 'work in progress'. Track changes and raise issues at <a href="https://github.com/mipearson/rails/tree/guides_for_kindle">https://github.com/mipearson/rails/tree/guides_for_kindle</a>. \ 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.