Created
July 23, 2013 12:12
-
-
Save kmelkon/6061906 to your computer and use it in GitHub Desktop.
index view
This file contains 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
<h1>Listing posts</h1> | |
<table> | |
<tr> | |
<th>Name</th> | |
<th>Title</th> | |
<th>Content</th> | |
<th></th> | |
<th></th> | |
<th></th> | |
</tr> | |
<div id="update-container"> | |
<% @posts.each do |post| %> | |
<tr> | |
<td><%= post.name %></td> | |
<td><%= post.title %></td> | |
<td><%= post.content %></td> | |
<td><%= link_to 'Show', post %></td> | |
<td><%= link_to 'Edit', edit_post_path(post) %></td> | |
<td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' }, :remote => true, :class => 'delete_post' %></td> | |
</tr> | |
<% end %> | |
</div> | |
</table> | |
<div class="replace"></div> | |
<br /> | |
<div></div> | |
<a href="#form-container" class="inline">test</a> | |
<a class='example5' title="My Page">Add a post</a> | |
<br /> | |
<%= link_to "Update User List", @show_path, :remote => true %> | |
<%= link_to "New post colorbox", "_form.html.erb", :data => { :colorbox => true, :colorbox_height => '300px' } %> | |
<br /> | |
<a class='inline' href="#form-container">Open form</a> | |
<div id="form-container"> | |
<%= form_for(@post, :remote => true, :class =>"target",:id => "form", :'data-update-target' => 'update-container', :method => "post") do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> | |
</div> | |
<% end %> | |
<div class="field"> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</div> | |
<div class="field"> | |
<%= f.label :title %><br /> | |
<%= f.text_field :title %> | |
</div> | |
<div class="field"> | |
<%= f.label :content %><br /> | |
<%= f.text_area :content %> | |
</div> | |
<a href="" class="close">close</a> | |
<div class="actions" id="target"> | |
<%= f.submit :disable_with => 'Please wait...', :class => 'submits'%> | |
</div> | |
<% end %> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment