I have this in_place_editor_field that I have the text showing up as red if it contains a certain string such as ''Click to Edit'' <%= in_place_editor_field ''user'',''w_cell'',{ :style => @user.w_cell =''Click to Edit'' ? ''color:red'' : ''''}, :cols=>20%> But that text could also be ''Check Format'' which I would also like to be in red. I tried this and it didn''t work: <%= in_place_editor_field ''user'',''w_phone'',{ :style => @user.w_phone =''Click to Edit'' ? ''color:red;'' : @user.w_phone == "Check Format " ? ''color:red;'' : ''''}, :cols=>20%> It doesn''t complain but it doesn''t do what I want it to do and that is to color the text red if it matches any of the two aboved strings else just have it black or normal. Any ideas of how I can get this to work? Thanks all, -S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Mar-18 14:30 UTC
Re: styles using the if-less if statement if it worked
On 18 Mar 2008, at 14:19, Shandy Nantz wrote:> > I have this in_place_editor_field that I have the text showing up as > red > if it contains a certain string such as ''Click to Edit'' > > <%= in_place_editor_field ''user'',''w_cell'',{ :style => @user.w_cell => ''Click to > Edit'' ? ''color:red'' : ''''}, :cols=>20%>I think you''d be a lot better off just sticking that in a helper function. Fred> > > But that text could also be ''Check Format'' which I would also like > to be > in red. I tried this and it didn''t work: > > <%= in_place_editor_field ''user'',''w_phone'',{ :style => @user.w_phone > => ''Click > to Edit'' ? ''color:red;'' : @user.w_phone == "Check Format " ? > ''color:red;'' : > ''''}, :cols=>20%> > > It doesn''t complain but it doesn''t do what I want it to do and that is > to color the text red if it matches any of the two aboved strings else > just have it black or normal. Any ideas of how I can get this to work? > Thanks all, > > -S > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---