Forum: Ruby on Rails Changing the font around a link_to

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Scott (Guest)
on 2007-04-13 02:15
(Received via mailing list)
Hi,

Before I migrated over to the link_to tag, I had the following:

<a href="myreports.html"><font color="#8C9BC9">view all reports</
font></a>

I tried to do this:

<font color="#8C9BC9"><%= link_to 'my reports', :action =>
'my_reports', :id => session[:user_id]%>

which doesn't work, unfortunately.

I already have CSS governing how links are display and I only wanted
to change this particular one. Is there an easy way to accomplish
this?

Thanks,

Scott
Ball, Donald A Jr (Library) (Guest)
on 2007-04-13 02:29
(Received via mailing list)
> which doesn't work, unfortunately.
>
> I already have CSS governing how links are display and I only
> wanted to change this particular one. Is there an easy way to
> accomplish this?

inline css would do ya:

<%= link_to 'my reports', {:action=>'my_reports',
:id=>session[:user_id]}, {:style=>'text=#8c9bc9'} %>

note you're encoding an id parameter in your URL that's already present
in the user's session. That would seem to be redundant and possibly a
security problem if you don't check in the controller that the id in the
URL matches the authenticated user's id.

- donald
cammo (Guest)
on 2007-04-13 03:11
(Received via mailing list)
or better than that,

<%= link_to 'link here", :action =>'whateverrrr', :id
=>session[:user_id], :class=>'whateverrr-link' %>

now in your css(at the top) you might have a generic class for all
anchors like

a { text-decoration: none; color: black; }

but you can also later in your css document you can also go

a.whateverrr-link{ color: #ccc; }

and this will only over ride the color of that anchor, the nice thing
is that if you need to add more styles later you can just add them to
that class in the css or  if you need to add another link with the
same style you can just give it the same class name.

Cam

On Apr 13, 8:28 am, "Ball, Donald A Jr \(Library\)"
Scott (Guest)
on 2007-04-14 04:36
(Received via mailing list)
Sorry but that didn't work.

Thanks for pointing out the id passing that didn't need to be.

Cheers,

Scott

On Apr 12, 3:28 pm, "Ball, Donald A Jr \(Library\)"
Scott (Guest)
on 2007-04-14 04:37
(Received via mailing list)
Nope, that didn't work, either. I added in just as you did to the end
of my css file and altered the class and it didn't help.

Any ideas?

Thanks,

Scott
Scott (Guest)
on 2007-04-15 18:50
(Received via mailing list)
Turned out there was some other CSS overriding an inner div that was
causing the problem.

Thanks to all of you for pointing me in the right direction.
This topic is locked and can not be replied to.