Skip to content

Instantly share code, notes, and snippets.

@funglaub
Created April 24, 2011 14:34
Show Gist options
  • Save funglaub/939580 to your computer and use it in GitHub Desktop.
Save funglaub/939580 to your computer and use it in GitHub Desktop.
<% content_for :head do %>
<script>
$('editable_link').click(function() {
$('#editable_form').html( "<%= escape_javascript( raw render :partial => 'users/info_form') %>" );
});
</script>
<% end %>
<ul>
<li>Login: <%= @user.login %></li>
<li>Name: <%= @user.name %></li>
</ul>
<% if @user.info.blank? %>
<%= link_to "Click to edit your user information", '#', :class=> 'editable_link' %>
<div id="editable_form">
</div>
<% else %>
<%= @user.info %>
<% end %>
<%= link_to "Edit user", edit_user_path(@user), :remote => true %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment