Initial Commit
This commit is contained in:
8
app/views/comments/_comment.html.erb
Executable file
8
app/views/comments/_comment.html.erb
Executable file
@@ -0,0 +1,8 @@
|
||||
<% div_for comment do %>
|
||||
<h3>Posted <%= comment.created_at.to_s(:long) %> by <%= comment.commenter %></h3>
|
||||
<p>
|
||||
<%= h(comment.body) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
24
app/views/comments/edit.html.erb
Executable file
24
app/views/comments/edit.html.erb
Executable file
@@ -0,0 +1,24 @@
|
||||
<h1>Editing comment</h1>
|
||||
|
||||
<% form_for(@comment) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :post_id %><br />
|
||||
<%= f.text_field :post_id %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :commenter %><br />
|
||||
<%= f.text_field :commenter %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :body %><br />
|
||||
<%= f.text_area :body %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Update' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Show', @comment %> |
|
||||
<%= link_to 'Back', comments_path %>
|
||||
24
app/views/comments/index.html.erb
Executable file
24
app/views/comments/index.html.erb
Executable file
@@ -0,0 +1,24 @@
|
||||
<h1>Listing comments</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Post</th>
|
||||
<th>Commenter</th>
|
||||
<th>Body</th>
|
||||
</tr>
|
||||
|
||||
<% @comments.each do |comment| %>
|
||||
<tr>
|
||||
<td><%=h comment.post_id %></td>
|
||||
<td><%=h comment.commenter %></td>
|
||||
<td><%=h comment.body %></td>
|
||||
<td><%= link_to 'Show', comment %></td>
|
||||
<td><%= link_to 'Edit', edit_comment_path(comment) %></td>
|
||||
<td><%= link_to 'Destroy', comment, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New comment', new_comment_path %>
|
||||
19
app/views/comments/new.html.erb
Executable file
19
app/views/comments/new.html.erb
Executable file
@@ -0,0 +1,19 @@
|
||||
<h1>New comment</h1>
|
||||
|
||||
<% form_for(@comment) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :post_id %><br />
|
||||
<%= f.text_field :post_id %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :body %><br />
|
||||
<%= f.text_area :body %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Create' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', comments_path %>
|
||||
18
app/views/comments/show.html.erb
Executable file
18
app/views/comments/show.html.erb
Executable file
@@ -0,0 +1,18 @@
|
||||
<p>
|
||||
<b>Post:</b>
|
||||
<%=h @comment.post_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Commenter:</b>
|
||||
<%=h @comment.commenter %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Body:</b>
|
||||
<%=h @comment.body %>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_comment_path(@comment) %> |
|
||||
<%= link_to 'Back', comments_path %>
|
||||
Reference in New Issue
Block a user