work on forum

This commit is contained in:
albert
2011-03-11 19:24:19 -05:00
parent 7dd345ca75
commit 21cc1cbafa
24 changed files with 343 additions and 1306 deletions

View File

@@ -0,0 +1,3 @@
<div class="paginator">
<%= @forum_topic.presenter(@forum_posts).pagination_html(self) %>
</div>

View File

@@ -1,7 +1,6 @@
<div>
<%= simple_form_for @search do |f| %>
<%= f.input :title_matches %>
<%= f.input :creator_name_equals %>
<%= f.button :submit %>
<div id="search">
<%= form_tag(forum_posts_path, :method => :get) do %>
<%= text_field_tag "title_matches" %>
<%= submit_tag "Search" %>
<% end %>
</div>

View File

@@ -0,0 +1,17 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Listing", forum_topics_path %></li>
<li><%= link_to "New", new_forum_topic_path %></li>
<li><%= link_to "Help", wiki_pages_path(:title => "help:forum") %></li>
<% if @forum_topic %>
<li>|</li>
<li><%= link_to "Reply", new_forum_post_path(:topic_id => @forum_topic.id) %></li>
<% unless @forum_topic.new_record? %>
<li><%= link_to "Edit", edit_forum_topic_path(@forum_topic) %></li>
<% if CurrentUser.is_moderator? %>
<li><%= link_to "Delete", forum_topic_path(@forum_topic), :remote => true, :method => :delete, :confirm => "Do you want to delete this forum topic?" %></li>
<% end %>
<% end %>
<% end %>
</menu>
<% end %>

View File

@@ -1,12 +1,19 @@
<h1>Edit Topic</h1>
<div id="c-forum-topics">
<div id="a-edit">
<h1>Edit Forum Topic</h1>
<%= simple_form_for(@forum_topic) do |f| %>
<%= f.input :title %>
<%= 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.simple_fields_for :original_post do |pf| %>
<%= hidden_field_tag "forum_topic[original_post_attributes][topic_id]", @forum_topic.id %>
<%= pf.input :body %>
<% end %>
<%= f.button :submit %>
<% end %>
<%= f.input :is_sticky %>
<%= f.input :is_locked %>
<%= f.button :submit, "Submit" %>
<% end %>
</div>
</div>

View File

@@ -2,11 +2,11 @@
<%= render "search" %>
<table>
<table width="100%">
<thead>
<tr>
<th>Creator</th>
<th>Title</th>
<th>Creator</th>
<th>Updated by</th>
<th>Updated at</th>
</tr>
@@ -14,11 +14,13 @@
<tbody>
<% @forum_topics.each do |topic| %>
<tr>
<td><%= topic.creator.name %></td>
<td><%= topic.title %></td>
<td><%= topic.creator.name %></td>
<td><%= topic.updater.name %></td>
<td><%= compact_time topic.updated_at %></td>
</tr>
<% end %>
</tbody>
</table>
<%= render "secondary_links" %>

View File

@@ -1,11 +1,23 @@
<h1>New Topic</h1>
<div id="c-forum-topics">
<div id="a-new">
<h1>New Forum 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 %>
<div id="form-content">
<%= 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, "Submit" %>
<% end %>
</div>
<div id="dtext-help">
<%= render "dtext/help" %>
</div>
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -0,0 +1,18 @@
<div id="c-forum-topics">
<div id="a-show">
<h1 id="forum-topic-title">
<%= @forum_topic.title %>
<% if @forum_topic.is_locked? %>
<span class="info">(locked)</span>
<% end %>
<% if @forum_topic.is_sticky? %>
<span class="info">(sticky)</span>
<% end %>
</h1>
<%= render :partial => "forum_posts/listing", :locals => {:forum_posts => @forum_posts} %>
<%= render "paginator" %>
</div>
</div>
<%= render "secondary_links" %>