* Updated gemfile
* Added forum post/topic unit tests * Added forum post/topic controller tests
This commit is contained in:
7
app/views/forum_topics/_search.html.erb
Normal file
7
app/views/forum_topics/_search.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<%= simple_form_for @search do |f| %>
|
||||
<%= f.input :title_matches %>
|
||||
<%= f.input :creator_name_equals %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
</div>
|
||||
12
app/views/forum_topics/edit.html.erb
Normal file
12
app/views/forum_topics/edit.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<h1>Edit Topic</h1>
|
||||
|
||||
<%= simple_form_for(@forum_topic) do |f| %>
|
||||
<%= f.input :title %>
|
||||
|
||||
<%= f.simple_fields_for :original_post do |pf| %>
|
||||
<%= text_field_tag "forum_topic[original_post_attributes][topic_id]", @forum_topic.id %>
|
||||
<%= pf.input :body %>
|
||||
<% end %>
|
||||
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
24
app/views/forum_topics/index.html.erb
Normal file
24
app/views/forum_topics/index.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Forum</h1>
|
||||
|
||||
<%= render "search" %>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Creator</th>
|
||||
<th>Title</th>
|
||||
<th>Updated by</th>
|
||||
<th>Updated at</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @forum_topics.each do |topic| %>
|
||||
<tr>
|
||||
<td><%= topic.creator.name %></td>
|
||||
<td><%= topic.title %></td>
|
||||
<td><%= topic.updater.name %></td>
|
||||
<td><%= compact_time topic.updated_at %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
11
app/views/forum_topics/new.html.erb
Normal file
11
app/views/forum_topics/new.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<h1>New Topic</h1>
|
||||
|
||||
<%= simple_form_for(@forum_topic) do |f| %>
|
||||
<%= f.input :title %>
|
||||
|
||||
<%= f.simple_fields_for :original_post do |pf| %>
|
||||
<%= pf.input :body %>
|
||||
<% end %>
|
||||
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user