Forum: Ruby on Rails Show/Hide with AJAX

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.
627e2ddff2a657a4dd5e4080e16a55b0?d=identicon&s=25 BB (Guest)
on 2006-05-02 00:01
I'm trying to implement a show/hide details function.

I have the show part done, but I'm not sure how to get it to hide.

My app looks like this so far:

View:

<%= link_to_remote "Show/Hide", :update => "details", :url => { :action
=> "show", :id => leif } %>
<p id="details"></p>

Action:

def show
  @leif = Leif.find(params[:id])
  render_partial 'show'
end

_show.rhtml:

<% for column in Leif.content_columns %>
<p>
  <b><%= column.human_name %>:</b> <%=h @leif.send(column.name) %>
</p>
<% end %>

Any tips or ideas would be appreciated
612a5333e356c4f765230d9ac06e5c8c?d=identicon&s=25 Pradeep Sethi (psethi2000)
on 2006-05-02 00:24
How about:

<div id="browser_bar">
</div>

<%= link_to( "Show/Hide" , ...... ,
:onclick => "Effect.toggle('browser_bar', 'blind')
%>

Hope that helps,


Pradeep



BB wrote:
> I'm trying to implement a show/hide details function.
>
> I have the show part done, but I'm not sure how to get it to hide.
>
> My app looks like this so far:
>
> View:
>
> <%= link_to_remote "Show/Hide", :update => "details", :url => { :action
> => "show", :id => leif } %>
> <p id="details"></p>
>
> Action:
>
> def show
>   @leif = Leif.find(params[:id])
>   render_partial 'show'
> end
>
> _show.rhtml:
>
> <% for column in Leif.content_columns %>
> <p>
>   <b><%= column.human_name %>:</b> <%=h @leif.send(column.name) %>
> </p>
> <% end %>
>
> Any tips or ideas would be appreciated
This topic is locked and can not be replied to.