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.
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.
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).
On 6/8/06, Ed Howland <ed.howland at gmail.com>
wrote:>
> Hi.
>
> The recommended way to create a link_to or link_to_remote with an
> image_tag (where the a tag surrounds the image tag,) is to add
> image_tag() as the first parameter to either helper. The docs on
> mv:link_to and link_to_remote say they will use the contents of the
> <a ..> tag for the name of the link. If this is an image, it becomes
> tricky. The child element img''s src attribute is going to be
something
> like "../../../public/images/file.jpg". The link_to directive
will
> just quote this and output :
> <%= link_to ''<img
src="../../../public/images/file.jpg", :action => ...
>
> So at runtime in Rails, the link will be relative to the public folder
> and miss it entirely. If you use my new image_tag directive it gets
> even messier because it tries to embed erb inside of a string of erb
> with unclosed quotes etc.
>
> To solve this I created a pair of reciprocal directives: link_to_image
> and image_tag_link. The first doesn''t quote its content so the
> image_tag(''mypic.gif'') will appear naturally inside the
erb tags as a
> parameter to the link_to helper. The second directive, image_tag_link,
> sets its content to '''' and then just outputs a normal
image_tag with
> the attribute value.
>
> The downside of this is the tags have to be used in a pair like thus:
>
> <a href="#" mv:link_to_image=":action =>
show"><img
> src="../../../public/images/mylink.gif"
mv:image_tag_link="mylink.gif"
> /></a>
>
> and can''t be used outside this scenario. But then the original
> directives will do for all other cases.
>
> Finally, the directive mv:link_to_remote_image is the same as
> link_to_image, except it generates a link_to_remote helper call, with
> the caveat from my earlier post about needing the :url=> parameter.
>
> Ed
>
> --
> Ed Howland
> http://greenprogrammer.blogspot.com
> _______________________________________________
> Masterview-users mailing list
> Masterview-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/masterview-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/masterview-users/attachments/20060608/3d65d4ef/attachment.htm