implemented forum post controller
This commit is contained in:
7
app/views/comments/index_by_comment.html.erb
Normal file
7
app/views/comments/index_by_comment.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="comments">
|
||||
<div class="index">
|
||||
<% @comments.each do |comment| %>
|
||||
<%= render :partial => "comments/partials/index/list", :locals => {:post => comment.post, :comments => [comment], :show_header => false} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
7
app/views/forum_posts/_search.html.erb
Normal file
7
app/views/forum_posts/_search.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<%= simple_form_for @search do |f| %>
|
||||
<%= f.input :body_matches %>
|
||||
<%= f.input :creator_name_equals %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
</div>
|
||||
6
app/views/forum_posts/edit.html.erb
Normal file
6
app/views/forum_posts/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Edit Post</h1>
|
||||
|
||||
<%= simple_form_for(@forum_post) do |f| %>
|
||||
<%= f.input :body %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
26
app/views/forum_posts/index.html.erb
Normal file
26
app/views/forum_posts/index.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<%= render "search" %>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Topic</th>
|
||||
<th>Excerpt</th>
|
||||
<th>Creator</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @forum_posts.each do |forum_post| %>
|
||||
<tr>
|
||||
<td><%= forum_post.topic.title %></td>
|
||||
<td><%= truncate forum_post.body, :length => 50 %></td>
|
||||
<td><%= forum_post.creator.name %></td>
|
||||
<td><%= forum_post.created_at %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="paginator">
|
||||
<%= will_paginate @forum_posts %>
|
||||
</div>
|
||||
7
app/views/forum_posts/new.html.erb
Normal file
7
app/views/forum_posts/new.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<h1>New Post</h1>
|
||||
|
||||
<%= simple_form_for(@forum_post) do |f| %>
|
||||
<%= f.input :topic_id, :as => :hidden %>
|
||||
<%= f.input :body %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user