Use javascript helper method in view instead, instead of hardwired path.

Balder can be run as a sub path of another site. This require the use
of rails helper method to take care of the needed path modification.

It's also useful for using asset hosts.
This commit is contained in:
Rémi Vanicat 2010-11-21 12:16:52 +01:00
parent e40340e3f4
commit 654ce95db4
3 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,6 @@
<% content_for :javascript do %>
<script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>
<script src="/javascripts/tag/tag.js" type="text/javascript" charset="utf-8"></script>
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=true" -%>
<%= javascript_include_tag "tag/tag" -%>
<% end %>
<div id="map_canvas"></div>

View file

@ -1,5 +1,5 @@
<% content_for :javascript do %>
<script src="/javascripts/tag/tag.js" type="text/javascript" charset="utf-8"></script>
<%= javascript_include_tag "tag/tag" -%>
<% end %>
<%= hidden_field_tag :all_tags, @tags %>
<%= form.label :title %><br />

View file

@ -1,11 +1,11 @@
<% content_for :javascript do %>
<script type="text/javascript" src="/javascripts/uploadify-2.1/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript" src="/javascripts/uploadify-2.1/swfobject.js"></script>
<%= javascript_include_tag "uploadify-2.1/jquery.uploadify.v2.1.0.min.js" -%>
<%= javascript_include_tag "uploadify-2.1/swfobject.js" -%>
<script type="text/javascript">
$(document).ready(function() {
$('#photo_file').uploadify({
uploader:'/javascripts/uploadify-2.1/uploadify.swf',
uploader:'<%= javascript_path "uploadify-2.1/uploadify.swf" -%>',
script:'<%= photos_path %>',
fileDataName : 'photo[file]',
scriptData: {
@ -13,7 +13,7 @@ $(document).ready(function() {
'authenticity_token' : encodeURIComponent('<%= u form_authenticity_token if protect_against_forgery?%>'),
'photo[album_id]' : "<%= @album.id %>"
},
cancelImg:'/javascripts/jquery.uploadify-v1.6.2.mit/cancel.png',
cancelImg:'<%= javascript_path "jquery.uploadify-v1.6.2.mit/cancel.png" -%>',
multi:true,
auto:true,
onComplete : function (e,queueId,fileObj,res,data) {