A couple things we are doing in the future that will help. First we will be moving the default directory for templates down to the same subdirectory level so that ../.. won't be off (so it would default to being in app/masterview instead of app/views/masterview.
<br><br>We can probably improve the image_tag and stylesheet_tag to figure out the proper parameter automatically from the other src. That would probably make the most sense, so you pick it from your editor and the proper tag will be generated to use your assets from the default location.
<br><br>And just to add on to the subdirectory and location of templates, additionally we are planning to make masterview have the option of generating its erb direct to the rails cache so it won't need to have intermediate erb (.rhtml) files at all and thus we can just put the templates into the view tree with all the other files. (We chose to not put them there initially because it would be confusing with both .rhtml and .html files there).
<br><br><div><span class="gmail_quote">On 6/8/06, <b class="gmail_sendername">Ed Howland</b> <<a href="mailto:ed.howland@gmail.com">ed.howland@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi.<br><br>The recommended way to create a link_to or link_to_remote with an<br>image_tag (where the a tag surrounds the image tag,) is to add<br>image_tag() as the first parameter to either helper. The docs on<br>mv:link_to and link_to_remote say they will use the contents of the
<br><a ..> tag for the name of the link. If this is an image, it becomes<br>tricky. The child element img's src attribute is going to be something<br>like "../../../public/images/file.jpg". The link_to directive will
<br>just quote this and output :<br><%= link_to '<img src="../../../public/images/file.jpg", :action => ...<br><br>So at runtime in Rails, the link will be relative to the public folder<br>and miss it entirely. If you use my new image_tag directive it gets
<br>even messier because it tries to embed erb inside of a string of erb<br>with unclosed quotes etc.<br><br>To solve this I created a pair of reciprocal directives: link_to_image<br>and image_tag_link. The first doesn't quote its content so the
<br>image_tag('mypic.gif') will appear naturally inside the erb tags as a<br>parameter to the link_to helper. The second directive, image_tag_link,<br>sets its content to '' and then just outputs a normal image_tag with<br>
the attribute value.<br><br>The downside of this is the tags have to be used in a pair like thus:<br><br><a href="#" mv:link_to_image=":action => show"><img<br>src="../../../public/images/mylink.gif" mv:image_tag_link="
mylink.gif"<br>/></a><br><br>and can't be used outside this scenario. But then the original<br>directives will do for all other cases.<br><br>Finally, the directive mv:link_to_remote_image is the same as<br>
link_to_image, except it generates a link_to_remote helper call, with<br>the caveat from my earlier post about needing the :url=> parameter.<br><br>Ed<br><br>--<br>Ed Howland<br><a href="http://greenprogrammer.blogspot.com">
http://greenprogrammer.blogspot.com</a><br>_______________________________________________<br>Masterview-users mailing list<br><a href="mailto:Masterview-users@rubyforge.org">Masterview-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/masterview-users">
http://rubyforge.org/mailman/listinfo/masterview-users</a><br></blockquote></div><br>