Hi All, I am new to both Ruby and Rails, so please be patient with me. I am currently working on a view for a controller and I have used the following excerpt: <td><%= link_to_image "b_edit", :action => ''edit'', :id => part_prefix %></td> The image is being displayed and the link is working. However, the formatting of image rendered produces and thick (1 or 2px) black box around the image. Is there a method of controlling this border aroung the image, I would prefer that it be transparent? Thanks in advance -- Posted via http://www.ruby-forum.com/.
On 1/12/06, Richard Back <rback@aegeuselec.com> wrote:> > Hi All, > > I am new to both Ruby and Rails, so please be patient with me. I am > currently working on a view for a controller and I have used the > following excerpt: > > <td><%= link_to_image "b_edit", :action => ''edit'', :id => part_prefix > %></td> > > The image is being displayed and the link is working. However, the > formatting of image rendered produces and thick (1 or 2px) black box > around the image. Is there a method of controlling this border aroung > the image, I would prefer that it be transparent? >you can specify it in the img tag itself, or modify it with CSS (border: 0px) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060112/72521d88/attachment.html
That''s not a Ruby on Rails issue, but a CSS styling problem. Use: img { border: 0; } in your CSS stylesheet. Am 12.01.2006 um 13:35 schrieb Richard Back:> Hi All, > > I am new to both Ruby and Rails, so please be patient with me. I am > currently working on a view for a controller and I have used the > following excerpt: > > <td><%= link_to_image "b_edit", :action => ''edit'', :id => part_prefix > %></td> > > The image is being displayed and the link is working. However, the > formatting of image rendered produces and thick (1 or 2px) black box > around the image. Is there a method of controlling this border aroung > the image, I would prefer that it be transparent? > > Thanks in advance > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, Richard, further than the other comments that you might (and probably should out of elegancy reasons) control this behaviour with CSS. You should have a look at: http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000334 There you''ll find an example of specifying :border => 0 and will realise that link_to_image which is an alias to link_image_to is deprecated. Please use the notation that is exampled on the link page. Best regards Jan Prill Richard Back wrote:>Hi All, > >I am new to both Ruby and Rails, so please be patient with me. I am >currently working on a view for a controller and I have used the >following excerpt: > ><td><%= link_to_image "b_edit", :action => ''edit'', :id => part_prefix >%></td> > >The image is being displayed and the link is working. However, the >formatting of image rendered produces and thick (1 or 2px) black box >around the image. Is there a method of controlling this border aroung >the image, I would prefer that it be transparent? > >Thanks in advance > > >
On 12.1.2006, at 14.35, Richard Back wrote:> Hi All, > > I am new to both Ruby and Rails, so please be patient with me. I am > currently working on a view for a controller and I have used the > following excerpt: > > <td><%= link_to_image "b_edit", :action => ''edit'', :id => part_prefix > %></td> > > The image is being displayed and the link is working. However, the > formatting of image rendered produces and thick (1 or 2px) black box > around the image. Is there a method of controlling this border aroung > the image, I would prefer that it be transparent?Richard, First of all, link_to_image is deprecated. According to the api docs: "This tag is deprecated. Combine the link_to and AssetTagHelper::image_tag yourself instead, like: link_to(image_tag("rss", :size => "30x45", :border => 0), "http:// www.example.com")" That said, you can get rid of the border by just using css: a img { border: 0; } If you only want this to apply to certain linked images, give them a class like this: link_to(image_tag("rss", :size => "30x45", :border => 0, :class => "yourclass"), "http://www.example.com") ...and then img.yourclass { border: 0; } hth, //jarkko> > Thanks in advance > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060112/06b6e6c2/smime-0001.bin
Jarkko Laine wrote:> On 12.1.2006, at 14.35, Richard Back wrote: > >> formatting of image rendered produces and thick (1 or 2px) black box >> around the image. Is there a method of controlling this border aroung >> the image, I would prefer that it be transparent? > > Richard, > > First of all, link_to_image is deprecated. According to the api docs: > > "This tag is deprecated. Combine the link_to and > AssetTagHelper::image_tag yourself instead, like: > link_to(image_tag("rss", :size => "30x45", :border => 0), "http:// > www.example.com")" > > That said, you can get rid of the border by just using css: > > a img { > border: 0; > } > > If you only want this to apply to certain linked images, give them a > class like this: > link_to(image_tag("rss", :size => "30x45", :border => 0, :class => > "yourclass"), "http://www.example.com") > > ...and then > > img.yourclass { > border: 0; > } > > hth, > //jarkkoThanks for the quick responce: I did see that the form that I was using was deprecated. However in the example provided they are linking to a page, will this still work with an action and controller? If so do you replace the hard link with the action and controller id strings? I still need to review the link that Jan suggested! Regards Richard -- Posted via http://www.ruby-forum.com/.
Hi, Richard, yes you are combining link_to and image_tag. Therefore you''ll get the possibilities of link_to which include linking to actions: http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000332 Regards Jan>Thanks for the quick responce: > >I did see that the form that I was using was deprecated. However in the >example provided they are linking to a page, will this still work with >an action and controller? If so do you replace the hard link with the >action and controller id strings? > >I still need to review the link that Jan suggested! > >Regards > >Richard > > >