Use the normal rails asset tagging mechanisms for the SWF files
authorTom Hughes <tom@compton.nu>
Fri, 14 Jan 2011 22:51:02 +0000 (22:51 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 14 Jan 2011 22:51:02 +0000 (22:51 +0000)
app/views/site/_potlatch.html.erb
app/views/site/_potlatch2.html.erb
config/initializers/asset_tag_helper.rb [new file with mode: 0644]

index 68205b6..18e1c4c 100644 (file)
@@ -8,7 +8,7 @@
 
 <script type="text/javascript" defer="defer">
   var brokenContentSize = $("content").offsetWidth == 0;
-  var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
+  var fo = new SWFObject("<%= asset_path("/potlatch/potlatch.swf") %>", "potlatch", "100%", "100%", "6", "#FFFFFF");
   // 700,600 for fixed size, 100%,100% for resizable
   var changesaved=true;
   var winie=false; if (document.all && window.print) { winie=true; }
index 4305e07..b2eda87 100644 (file)
@@ -8,7 +8,7 @@
 
 <script type="text/javascript" defer="defer">
   var brokenContentSize = $("content").offsetWidth == 0;
-  var fo = new SWFObject("/potlatch2/potlatch2.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "9", "#FFFFFF");
+  var fo = new SWFObject("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "9", "#FFFFFF");
   // 700,600 for fixed size, 100%,100% for resizable
   var changesaved=true;
   
diff --git a/config/initializers/asset_tag_helper.rb b/config/initializers/asset_tag_helper.rb
new file mode 100644 (file)
index 0000000..c1c2c94
--- /dev/null
@@ -0,0 +1,9 @@
+module ActionView
+  module Helpers
+    module AssetTagHelper
+      def asset_path(source)
+        compute_public_path(source, nil)
+      end
+    end
+  end
+end