From 48fb00b24eccbe8e1ddccfb63db879800c744e7e Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Sat, 7 Feb 2009 20:09:09 +0100 Subject: [PATCH] fix bundle_fu to handle relative roots applied pending patches from bundle_fu issues 3 and 6 reverted previous workaround in standard.css for relative roots --- public/stylesheets/standard.css | 48 +++++++++---------- vendor/plugins/bundle-fu/lib/bundle_fu.rb | 5 +- .../lib/bundle_fu/css_url_rewriter.rb | 16 +++++-- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css index ea8f0dc5..411deda2 100644 --- a/public/stylesheets/standard.css +++ b/public/stylesheets/standard.css @@ -76,31 +76,31 @@ h3 { /* Rules for the icon links */ -img.edit_item {background-image: url(../images/edit_off.png); background-repeat: no-repeat; border: none;} -a:hover img.edit_item {background-image: url(../images/edit_on.png); background-color: transparent; background-repeat: no-repeat; border: none;} +img.edit_item {background-image: url(/images/edit_off.png); background-repeat: no-repeat; border: none;} +a:hover img.edit_item {background-image: url(/images/edit_on.png); background-color: transparent; background-repeat: no-repeat; border: none;} -img.delete_item {background-image: url(../images/delete_off.png); background-repeat: no-repeat; border: none;} -a:hover img.delete_item {background-image: url(../images/delete_on.png);background-color: transparent;background-repeat: no-repeat; border: none;} +img.delete_item {background-image: url(/images/delete_off.png); background-repeat: no-repeat; border: none;} +a:hover img.delete_item {background-image: url(/images/delete_on.png);background-color: transparent;background-repeat: no-repeat; border: none;} -img.starred_todo {background-image: url(../images/staricons.png); background-repeat: no-repeat; border:none; background-position: 0px 0px;} -a:hover img.starred_todo {background-image: url(../images/staricons.png); background-repeat: no-repeat; border:none; background-position: -16px 0px;} -img.unstarred_todo {background-image: url(../images/staricons.png); background-repeat: no-repeat; border:none; background-position: -32px 0px;} -a:hover img.unstarred_todo {background-image: url(../images/staricons.png); background-repeat: no-repeat; border:none; background-position: -48px 0px;} +img.starred_todo {background-image: url(/images/staricons.png); background-repeat: no-repeat; border:none; background-position: 0px 0px;} +a:hover img.starred_todo {background-image: url(/images/staricons.png); background-repeat: no-repeat; border:none; background-position: -16px 0px;} +img.unstarred_todo {background-image: url(/images/staricons.png); background-repeat: no-repeat; border:none; background-position: -32px 0px;} +a:hover img.unstarred_todo {background-image: url(/images/staricons.png); background-repeat: no-repeat; border:none; background-position: -48px 0px;} -a.to_top {background: transparent url(../images/top_off.png) no-repeat;} -a.to_top:hover {background: transparent url(../images/top_on.png) no-repeat;} +a.to_top {background: transparent url(/images/top_off.png) no-repeat;} +a.to_top:hover {background: transparent url(/images/top_on.png) no-repeat;} -a.up {background: transparent url(../images/up_off.png) no-repeat;} -a.up:hover {background: transparent url(../images/up_on.png) no-repeat;} +a.up {background: transparent url(/images/up_off.png) no-repeat;} +a.up:hover {background: transparent url(/images/up_on.png) no-repeat;} -a.down {background: transparent url(../images/down_off.png) no-repeat;} -a.down:hover {background: transparent url(../images/down_on.png) no-repeat;} +a.down {background: transparent url(/images/down_off.png) no-repeat;} +a.down:hover {background: transparent url(/images/down_on.png) no-repeat;} -a.to_bottom {background: transparent url(../images/bottom_off.png) no-repeat;} -a.to_bottom:hover {background: transparent url(../images/bottom_on.png) no-repeat;} +a.to_bottom {background: transparent url(/images/bottom_off.png) no-repeat;} +a.to_bottom:hover {background: transparent url(/images/bottom_on.png) no-repeat;} -a.show_notes, a.link_to_notes {background-image: url(../images/notes_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;} -a.show_notes:hover, a.link_to_notes:hover {background-image: url(../images/notes_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;} +a.show_notes, a.link_to_notes {background-image: url(/images/notes_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;} +a.show_notes:hover, a.link_to_notes:hover {background-image: url(/images/notes_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;} /* Structural divs */ @@ -180,7 +180,7 @@ a.show_notes:hover, a.link_to_notes:hover {background-image: url(../images/notes height: 100%; z-index: 102; text-align: center; - background-image:url("../images/trans70.png"); + background-image:url("/images/trans70.png"); } #overlay #new-recurring-todo, #overlay #edit-recurring-todo { @@ -997,7 +997,7 @@ ul#prefs {list-style-type: disc; margin-left: 15px;} font-style:oblique; } input.open_id { - background: url(../images/open-id-login-bg.gif) no-repeat; + background: url(/images/open-id-login-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; color: #000; @@ -1146,28 +1146,28 @@ button.positive, .widgets a.positive{ color:#fff; } .tracks__waiting { - background-image:url('../images/waiting.gif'); + background-image:url('/images/waiting.gif'); background-repeat:no-repeat; background-position:center center; background-color:white; } .bigWaiting { - background-image:url('../images/bigWaiting.gif'); + background-image:url('/images/bigWaiting.gif'); background-repeat:no-repeat; background-position:center 20%; background-color:white; } .blackWaiting { - background-image:url('../images/blackWaiting.gif'); + background-image:url('/images/blackWaiting.gif'); background-repeat:no-repeat; background-position:center center; background-color:black; } .bigBlackWaiting { - background-image:url('../images/bigBlackWaiting.gif'); + background-image:url('/images/bigBlackWaiting.gif'); background-repeat:no-repeat; background-position:center center; background-color:black; diff --git a/vendor/plugins/bundle-fu/lib/bundle_fu.rb b/vendor/plugins/bundle-fu/lib/bundle_fu.rb index 5991b97a..71c3a85d 100644 --- a/vendor/plugins/bundle-fu/lib/bundle_fu.rb +++ b/vendor/plugins/bundle-fu/lib/bundle_fu.rb @@ -9,10 +9,11 @@ class BundleFu def bundle_files(filenames=[]) output = "" filenames.each{ |filename| - output << "/* --------- #{filename} --------- */ " + filename_no_root = filename.sub(/^#{ActionController::Base.relative_url_root}/, '') + output << "/* --------- #{filename} - #{filename_no_root} --- ------ */ " output << "\n" begin - content = (File.read(File.join(RAILS_ROOT, "public", filename))) + content = (File.read(File.join(RAILS_ROOT, "public", filename_no_root))) rescue output << "/* FILE READ ERROR! */" next diff --git a/vendor/plugins/bundle-fu/lib/bundle_fu/css_url_rewriter.rb b/vendor/plugins/bundle-fu/lib/bundle_fu/css_url_rewriter.rb index 8df79654..d048a738 100644 --- a/vendor/plugins/bundle-fu/lib/bundle_fu/css_url_rewriter.rb +++ b/vendor/plugins/bundle-fu/lib/bundle_fu/css_url_rewriter.rb @@ -1,12 +1,16 @@ class BundleFu::CSSUrlRewriter class << self # rewrites a relative path to an absolute path, removing excess "../" and "./" - # rewrite_relative_path("stylesheets/default/global.css", "../image.gif") => "/stylesheets/image.gif" + # rewrite_relative_path("stylesheets/default/global.css", "../image.gif") => "#{rails_relative_root}/stylesheets/image.gif" def rewrite_relative_path(source_filename, relative_url) relative_url = relative_url.to_s.strip.gsub(/["']/, "") - return relative_url if relative_url.first == "/" || relative_url.include?("://") - + return relative_url if relative_url.include?("://") + if ( relative_url.first == "/" ) + return relative_url unless ActionController::Base.relative_url_root + return "#{ActionController::Base.relative_url_root}#{relative_url}" + end + elements = File.join("/", File.dirname(source_filename)).gsub(/\/+/, '/').split("/") elements += relative_url.gsub(/\/+/, '/').split("/") @@ -24,7 +28,9 @@ class BundleFu::CSSUrlRewriter end end - elements * "/" + path = elements * "/" + return path unless ActionController::Base.relative_url_root + "#{ActionController::Base.relative_url_root}#{path}" end # rewrite the URL reference paths @@ -39,4 +45,4 @@ class BundleFu::CSSUrlRewriter end end -end \ No newline at end of file +end