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,23 @@
<article data-forum-post-id="<%= forum_post.id %>">
<div class="author">
<h1><%= link_to forum_post.creator.name, user_path(forum_post.creator_id) %></h1>
<p>
<time datetime="<%= forum_post.created_at %>">
<%= time_ago_in_words(forum_post.created_at) %> ago
</time>
</p>
</div>
<div class="content">
<div>
<%= format_text(forum_post.body) %>
</div>
<menu>
<li><%= link_to "Reply", new_forum_post_path(:post_id => forum_post.id) %></li>
<% if CurrentUser.user.is_janitor? || CurrentUser.user.id == forum_post.creator_id %>
<li><%= link_to "Delete", forum_post_path(forum_post.id), :confirm => "Do you really want to delete this post?", :method => :delete, :remote => true %></li>
<li><%= link_to "Edit", edit_forum_post_path(forum_post.id) %></li>
<% end %>
</menu>
</div>
<div class="clearfix"></div>
</article>

View File

@@ -0,0 +1,6 @@
<div class="list-of-forum-posts">
<% forum_posts.each do |forum_post| %>
<%= render :partial => "forum_posts/forum_post", :locals => {:forum_post => forum_post} %>
<% end %>
</div>

View File

@@ -0,0 +1 @@
$("article[data-forum-post-id=<%= @forum_post.id %>]").remove();

View File

@@ -1,6 +1,10 @@
<h1>Edit Post</h1>
<div id="c-forum-topics">
<div id="a-edit">
<h1>Edit Forum Post</h1>
<%= simple_form_for(@forum_post) do |f| %>
<%= f.input :body %>
<%= f.button :submit %>
<% end %>
<%= simple_form_for(@forum_post) do |f| %>
<%= f.input :body %>
<%= f.button :submit, "Submit" %>
<% end %>
</div>
</div>

View File

@@ -1,7 +1,11 @@
<h1>New Post</h1>
<div id="c-forum-topics">
<div id="a-new">
<h1>New Forum Post</h1>
<%= simple_form_for(@forum_post) do |f| %>
<%= f.input :topic_id, :as => :hidden %>
<%= f.input :body %>
<%= f.button :submit %>
<% end %>
<%= simple_form_for(@forum_post) do |f| %>
<%= f.input :topic_id, :as => :hidden %>
<%= f.input :body %>
<%= f.button :submit, "Submit" %>
<% end %>
</div>
</div>