Show/Hide with AJAX


#1

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 } %>

Action:

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

_show.rhtml:

<% for column in Leif.content_columns %>

<%= column.human_name %>: <%=h @leif.send(column.name) %>

<% end %>

Any tips or ideas would be appreciated


#2

How about:

<%= 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 } %>

Action:

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

_show.rhtml:

<% for column in Leif.content_columns %>

<%= column.human_name %>: <%=h @leif.send(column.name) %>

<% end %>

Any tips or ideas would be appreciated