Skip to content
Browse files

download guides for the Kindle and Kindle apps from the home page

  • Loading branch information...
1 parent 05b8faa commit 46e2db0da681775399ef8e656cd84f05a4776e40 @fxn fxn committed Dec 25, 2011
View
8 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;
View
11 railties/guides/rails_guides/generator.rb
@@ -117,15 +117,18 @@ def check_for_kindlegen
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 @@ def generate_guide(guide, output_file)
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$/
View
6 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 %>
View
2 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>.
+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.

0 comments on commit 46e2db0

Please sign in to comment.
Something went wrong with that request. Please try again.