forum previews working

This commit is contained in:
albert
2011-03-12 16:09:11 -05:00
parent 21cc1cbafa
commit bd520f61f7
29 changed files with 1516 additions and 81 deletions

View File

@@ -0,0 +1,34 @@
<div id="form-content">
<%= error_messages_for("forum_topic") %>
<%= simple_form_for(@forum_topic) do |f| %>
<%= f.input :title %>
<%= f.simple_fields_for :original_post do |pf| %>
<% unless @forum_topic.new_record? %>
<%= hidden_field_tag "forum_topic[original_post_attributes][topic_id]", @forum_topic.id %>
<% end %>
<%= pf.input :body, :input_html => {:id => "forum_post_body"} %>
<% end %>
<% if CurrentUser.is_moderator? %>
<%= f.input :is_sticky %>
<%= f.input :is_locked %>
<% end %>
<%= f.button :submit, "Submit" %>
<%= f.button :submit, "Preview" %>
<% end %>
</div>
<div id="form-aside">
<div id="preview">
<div class="content dtext">
</div>
<p><a href="#" name="toggle-preview">Hide</a></p>
</div>
<div id="dtext-help">
<%= render "dtext/help" %>
</div>
</div>

View File

@@ -1,6 +0,0 @@
<div id="search">
<%= form_tag(forum_posts_path, :method => :get) do %>
<%= text_field_tag "title_matches" %>
<%= submit_tag "Search" %>
<% end %>
</div>

View File

@@ -2,6 +2,7 @@
<menu>
<li><%= link_to "Listing", forum_topics_path %></li>
<li><%= link_to "New", new_forum_topic_path %></li>
<li><%= link_to "Search", search_forum_posts_path %></li>
<li><%= link_to "Help", wiki_pages_path(:title => "help:forum") %></li>
<% if @forum_topic %>
<li>|</li>

View File

@@ -1,19 +1,7 @@
<div id="c-forum-topics">
<div id="a-edit">
<h1>Edit Forum Topic</h1>
<%= simple_form_for(@forum_topic) do |f| %>
<%= f.input :title %>
<%= 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.input :is_sticky %>
<%= f.input :is_locked %>
<%= f.button :submit, "Submit" %>
<% end %>
<%= render "form" %>
</div>
</div>

View File

@@ -1,8 +1,6 @@
<h1>Forum</h1>
<%= render "search" %>
<table width="100%">
<table width="100%" class="striped">
<thead>
<tr>
<th>Title</th>
@@ -14,7 +12,7 @@
<tbody>
<% @forum_topics.each do |topic| %>
<tr>
<td><%= topic.title %></td>
<td><% if topic.is_sticky? %><span class="sticky">Sticky:</span> <% end %><%= link_to topic.title, forum_topic_path(topic) %></td>
<td><%= topic.creator.name %></td>
<td><%= topic.updater.name %></td>
<td><%= compact_time topic.updated_at %></td>

View File

@@ -2,21 +2,7 @@
<div id="a-new">
<h1>New Forum Topic</h1>
<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>
<%= render "form" %>
</div>
</div>