Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #136 from jcoglan/master

Make ShowOff compatible with Rack::URLMap
  • Loading branch information...
commit 7116e022564931fd236ce26ec9bf77648bc63730 2 parents d8e5f0f + 950fc57
Gonçalo Silva goncalossilva authored
5 lib/showoff.rb
@@ -186,7 +186,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
186 186 path = paths.join('/')
187 187 replacement_prefix = static ?
188 188 ( pdf ? %(img src="file://#{options.pres_dir}/#{path}) : %(img src="./file/#{path}) ) :
189   - %(img src="/image/#{path})
  189 + %(img src="#{@asset_path}image/#{path})
190 190 slide.gsub(/img src=\"([^\/].*?)\"/) do |s|
191 191 img_path = File.join(path, $1)
192 192 w, h = get_image_size(img_path)
@@ -201,7 +201,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
201 201 if defined?(Magick)
202 202 def get_image_size(path)
203 203 if !cached_image_size.key?(path)
204   - img = Magick::Image.ping(path).first
  204 + img = Magick::Image.ping(File.join(@asset_path, path)).first
205 205 # don't set a size for svgs so they can expand to fit their container
206 206 if img.mime_type == 'image/svg+xml'
207 207 cached_image_size[path] = [nil, nil]
@@ -481,6 +481,7 @@ def eval_ruby code
481 481 @title = ShowOffUtils.showoff_title
482 482 what = params[:captures].first
483 483 what = 'index' if "" == what
  484 + @asset_path = (env['SCRIPT_NAME'] || '').gsub(/\/?$/, '/').gsub(/^\//, '')
484 485 if (what != "favicon.ico")
485 486 data = send(what)
486 487 if data.is_a?(File)
2  public/js/showoff.js
@@ -50,7 +50,7 @@ function setupPreso(load_slides, prefix) {
50 50 function loadSlides(load_slides, prefix) {
51 51 //load slides offscreen, wait for images and then initialize
52 52 if (load_slides) {
53   - $("#slides").load("slides", false, function(){
  53 + $("#slides").load(loadSlidesPrefix + "slides", false, function(){
54 54 $("#slides img").batchImageLoad({
55 55 loadingCompleteCallback: initializePresentation(prefix)
56 56 })
4 views/header.erb
@@ -26,11 +26,11 @@
26 26 <link type="text/css" href="<%= @asset_path %>css/sh_style.css" rel="stylesheet" >
27 27
28 28 <% css_files.each do |css_file| %>
29   - <link rel="stylesheet" href="file/<%= css_file %>" type="text/css"/>
  29 + <link rel="stylesheet" href="<%= @asset_path %>file/<%= css_file %>" type="text/css"/>
30 30 <% end %>
31 31
32 32 <% js_files.each do |js_file| %>
33   - <script type="text/javascript" src="file/<%= js_file %>"></script>
  33 + <script type="text/javascript" src="<%= @asset_path %>file/<%= js_file %>"></script>
34 34 <% end %>
35 35
36 36 <script type="text/javascript">

0 comments on commit 7116e02

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