[Rails] Re: how to style currently active link

2009-02-09 Thread Juan José Vidal
In this video you'll see the behaviour you're looking for... (min 33) http://s3.amazonaws.com/lr_screencasts/learningrails-17.mov Adam Akhtar escribió: > Thank you both for your responses. > > Ive gone with Juans as it does what i need is shorter code. The only one > problem is that it results

[Rails] Re: how to style currently active link

2009-02-09 Thread Adam Akhtar
Thank you both for your responses. Ive gone with Juans as it does what i need is shorter code. The only one problem is that it results in the selected link still being selectABLE ie. it can still be clicked on even though its the current page in view. I can style it so that it looks like it is

[Rails] Re: how to style currently active link

2009-02-09 Thread jammanbo
On Feb 9, 10:04 am, Adam Akhtar wrote: > I have four links on a page generated with link_to . I want to style the > currently active link differently than the other 3. I tried passing > :class => "selected" to link_to but it adds this tag to all 4 links, not > just the currently active one. > >

[Rails] Re: how to style currently active link

2009-02-09 Thread Juan José Vidal
I think that you're looking for something like that <%= link_to_unless_current('Add contact', new_contact_url, :class => 'adduser') { link_to('Add contact', new_contact_url, :class => 'selected') } %> http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to_unless_current Adam Akht

[Rails] Re: how to style currently active link

2009-02-09 Thread Adam Akhtar
MaD wrote: > i don't see your code, but generally it works like this: > <%= link_to "Link name", { :controller => 'controller_name', :action > => 'action_name' }, :class => 'someclass' %> > > then you style your "someclass" via css. Thanks for the reply, but doesnt the above add the class "som

[Rails] Re: how to style currently active link

2009-02-09 Thread MaD
i don't see your code, but generally it works like this: <%= link_to "Link name", { :controller => 'controller_name', :action => 'action_name' }, :class => 'someclass' %> then you style your "someclass" via css. --~--~-~--~~~---~--~~ You received this message bec