Created
July 4, 2012 13:34
-
-
Save noahc/3047356 to your computer and use it in GitHub Desktop.
Jquery Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########index.html.erb######## | |
<div class="row"> | |
<div class="span6"> | |
<% if @holders.empty?%> | |
<h3>Time to Create your First Set</h3> | |
<p>A set is a container for questions you'd like to group together. They might "American Presidents of the 20th century" or "Fun Facts About Mammals". | |
Don't worry too much about getting this part right. You can always edit it later.</p> | |
<% else %> | |
<div id="holders"> | |
<% @holders.each do |holder| %> | |
<b><%= holder.name %></b> | |
<li class="dropdown" id="<%= holder.id%>" class="editmenu"> | |
<a class="dropdown-toggle" data-toggle="dropdown" href="<%= holder.id%>"> | |
<small>Edit</small> | |
</a> | |
<ul class="dropdown-menu"> | |
<li> | |
<%= form_for(holder) do |f| %> | |
<%= f.text_field :name %> | |
<br /> | |
<%= f.text_field :description %> | |
<br /> | |
<%= f.submit "Save Edit", class: "btn-danger", remote: true%> | |
<% end %> | |
</li> | |
</ul> | |
</li> | |
<li class="dropdown">| <%= link_to "View", holder_path(holder) %></li> | |
<li class="dropdown">| <%= link_to "Delete", holder_path(holder), method: "delete"%></li> | |
<p><%= holder.description %></p> | |
<hr> | |
<% end %> | |
</div> | |
<% end %> | |
</div> | |
<div class="span"> | |
<%= render 'create_set' %> | |
</div> | |
</div> | |
####_index.js.erb##### | |
$('#holders').html("<%=j render @holder %>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment