Svg image link


#1

the link_to command is really nice, especially with confirm built in -
wondering if there is a way to use it with SVG images since SVG doesn’t
seem to work with image_tag

I can display svg images (in Firefox) with the following code:

“normal” link_to code:

<%= link_to(image_tag(“quit.png”),:controller=>“project”,
:action=>“quit”, :confirm=>“Existing Project Changes Might Get Lost -
Are You Sure?”) %>

I can use straight html code with href calling …/project/quit but then
miss the nice confirm method


#2

jack <ngalaxy34@…> writes:

the link_to command is really nice, especially with confirm built in -
wondering if there is a way to use it with SVG images since SVG doesn’t
seem to work with image_tag

I can display svg images (in Firefox) with the following code:

Try this:

<%=link_to “<embed width=‘32’ height=‘32’ src=’<%=url_for
‘quit.svg’%>’>”, :controller => ‘project’, :action => ‘quit’,
:confirm
=> “Existing Project Changes Might Get Lost – Are You Sure?”%>

I haven’t test this, but it should work. With that many nested quotes
you might
be better off escaping some of them.

– Pazu


#3

thks for suggestion, I couldn’t use the url_for , it gave me an
interminate string error but replacing it with the call to the /image
directory, the svg image shows up but no hyperlink:

<%= link_to "
",
:controller=>‘program’, :action=>‘quit’, :confirm=>‘Existing Project
Changes
Might Get Lost Are You Sure?’ %>

even if I wrap the link_to with parentheses like a regular link_to, it
still doesn’t give the hyperlink hmmm, I don’t understand, any ideas?
jack

Pazu wrote:

jack <ngalaxy34@…> writes:

the link_to command is really nice, especially with confirm built in -
wondering if there is a way to use it with SVG images since SVG doesn’t
seem to work with image_tag

I can display svg images (in Firefox) with the following code:

Try this:

<%=link_to “<embed width=‘32’ height=‘32’ src=’<%=url_for
‘quit.svg’%>’>”, :controller => ‘project’, :action => ‘quit’,
:confirm
=> “Existing Project Changes Might Get Lost – Are You Sure?”%>

I haven’t test this, but it should work. With that many nested quotes
you might
be better off escaping some of them.

– Pazu