Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ShowOff compatible with Rack::URLMap #136

Merged
merged 1 commit into from Nov 17, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/showoff.rb
Expand Up @@ -188,7 +188,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
path = paths.join('/')
replacement_prefix = static ?
( pdf ? %(img src="file://#{options.pres_dir}/#{path}) : %(img src="./file/#{path}) ) :
%(img src="/image/#{path})
%(img src="#{@asset_path}image/#{path})
slide.gsub(/img src=\"([^\/].*?)\"/) do |s|
img_path = File.join(path, $1)
w, h = get_image_size(img_path)
Expand All @@ -203,7 +203,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
if defined?(Magick)
def get_image_size(path)
if !cached_image_size.key?(path)
img = Magick::Image.ping(path).first
img = Magick::Image.ping(File.join(@asset_path, path)).first
# don't set a size for svgs so they can expand to fit their container
if img.mime_type == 'image/svg+xml'
cached_image_size[path] = [nil, nil]
Expand Down Expand Up @@ -483,6 +483,7 @@ def eval_ruby code
@title = ShowOffUtils.showoff_title
what = params[:captures].first
what = 'index' if "" == what
@asset_path = (env['SCRIPT_NAME'] || '').gsub(/\/?$/, '/').gsub(/^\//, '')
if (what != "favicon.ico")
data = send(what)
if data.is_a?(File)
Expand Down
2 changes: 1 addition & 1 deletion public/js/showoff.js
Expand Up @@ -50,7 +50,7 @@ function setupPreso(load_slides, prefix) {
function loadSlides(load_slides, prefix) {
//load slides offscreen, wait for images and then initialize
if (load_slides) {
$("#slides").load("slides", false, function(){
$("#slides").load(loadSlidesPrefix + "slides", false, function(){
$("#slides img").batchImageLoad({
loadingCompleteCallback: initializePresentation(prefix)
})
Expand Down
4 changes: 2 additions & 2 deletions views/header.erb
Expand Up @@ -26,11 +26,11 @@
<link type="text/css" href="<%= @asset_path %>css/sh_style.css" rel="stylesheet" >

<% css_files.each do |css_file| %>
<link rel="stylesheet" href="file/<%= css_file %>" type="text/css"/>
<link rel="stylesheet" href="<%= @asset_path %>file/<%= css_file %>" type="text/css"/>
<% end %>

<% js_files.each do |js_file| %>
<script type="text/javascript" src="file/<%= js_file %>"></script>
<script type="text/javascript" src="<%= @asset_path %>file/<%= js_file %>"></script>
<% end %>

<script type="text/javascript">
Expand Down