Dennis Eusebio
2006-Jul-26 02:39 UTC
[Rails] adding class or id tags to tags like linkto and form
I''m trying to figure out things like this by myself so I don''t bother my developer and slow him down. How do I add class or id css attributes to tags like this: <%= form_remote_tag :url => { :action => "send_url" } %> <%= link_to_remote "My Profile URL", :url => { :action => "send_profile_url", :id => @user.id } %> any help would be great. -- Posted via http://www.ruby-forum.com/.
Ben Lisbakken
2006-Jul-26 05:11 UTC
[Rails] adding class or id tags to tags like linkto and form
Element.addClassName(''element'',''classnametoadd''); use that little jscript line right there to add the class name to an existing element. You could do it in a jscript file, or do it on a complete of a link_to_remote <%= link_to_remote "LINK NAME", {:url => {:controller => "thecontroller", :action => "theaction"}, :update => "somethingupdates", :before => %(Element.addClassName (''thisElementSucks'',''theAwesomeClass'')), :success => %(Element.show(''thisElementSucks''))} -Ben Lisbakken On Jul 25, 2006, at 7:38 PM, Dennis Eusebio wrote:> I''m trying to figure out things like this by myself so I don''t > bother my > developer and slow him down. How do I add class or id css > attributes to > tags like this: > > <%= form_remote_tag :url => { :action => "send_url" } %> > > <%= link_to_remote "My Profile URL", :url => { :action => > "send_profile_url", :id => @user.id } %> > > any help would be great. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Zack Chandler
2006-Jul-26 05:27 UTC
[Rails] adding class or id tags to tags like linkto and form
Ben, --- form_remote_tag usage --- form_remote_tag(options = {}) --- form_remote_tag example --- form_remote_tag(:url => { :action => :fast }, :html => { :id => ''your_css_id'', :class => ''your_css_class'' }) --- link_to_remote usage --- link_to_remote(name, options = {}, html_options = {}) --- link_to_remote example --- link_to_remote(''Do this'', { :url => { :action => "destroy" }}, { :id => ''your_css_id'', :class => ''your_css_class'' }) Zack On 7/25/06, Ben Lisbakken <lisbakke@gmail.com> wrote:> Element.addClassName(''element'',''classnametoadd''); > > use that little jscript line right there to add the class name to an > existing element. You could do it in a jscript file, or do it on a > complete of a link_to_remote > > <%= link_to_remote "LINK NAME", {:url => {:controller => > "thecontroller", :action => "theaction"}, :update => "somethingupdates", > :before => %(Element.addClassName > (''thisElementSucks'',''theAwesomeClass'')), > :success => %(Element.show(''thisElementSucks''))} > > > -Ben Lisbakken > On Jul 25, 2006, at 7:38 PM, Dennis Eusebio wrote: > > > I''m trying to figure out things like this by myself so I don''t > > bother my > > developer and slow him down. How do I add class or id css > > attributes to > > tags like this: > > > > <%= form_remote_tag :url => { :action => "send_url" } %> > > > > <%= link_to_remote "My Profile URL", :url => { :action => > > "send_profile_url", :id => @user.id } %> > > > > any help would be great. > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Dennis Eusebio
2006-Jul-26 16:10 UTC
[Rails] Re: adding class or id tags to tags like linkto and form
Thanks everyone, i''ll give it a try and see if it works for me. Zack Chandler wrote:> Ben, > > --- form_remote_tag usage --- > form_remote_tag(options = {}) > > --- form_remote_tag example --- > form_remote_tag(:url => { :action => :fast }, :html => { :id => > ''your_css_id'', :class => ''your_css_class'' }) > > --- link_to_remote usage --- > link_to_remote(name, options = {}, html_options = {}) > > --- link_to_remote example --- > link_to_remote(''Do this'', { :url => { :action => "destroy" }}, { :id > => ''your_css_id'', :class => ''your_css_class'' }) > > Zack-- Posted via http://www.ruby-forum.com/.