From 2f9db2399c6fc39269f7d8c302f466195d1f7010 Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 24 Jan 2013 14:37:39 -0500 Subject: [PATCH] fix for forum topic response --- app/controllers/forum_posts_controller.rb | 1 + app/views/forum_posts/_listing.html.erb | 1 - app/views/forum_posts/new.html.erb | 7 ++++++- app/views/forum_topics/show.html.erb | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/forum_posts_controller.rb b/app/controllers/forum_posts_controller.rb index 974be319c..d9d4d8c39 100644 --- a/app/controllers/forum_posts_controller.rb +++ b/app/controllers/forum_posts_controller.rb @@ -4,6 +4,7 @@ class ForumPostsController < ApplicationController rescue_from User::PrivilegeError, :with => "static/access_denied" def new + @forum_topic = ForumTopic.find(params[:topic_id]) if params[:topic_id] @forum_post = ForumPost.new_reply(params) respond_with(@forum_post) end diff --git a/app/views/forum_posts/_listing.html.erb b/app/views/forum_posts/_listing.html.erb index 9ccfcf307..8b696ef63 100644 --- a/app/views/forum_posts/_listing.html.erb +++ b/app/views/forum_posts/_listing.html.erb @@ -3,4 +3,3 @@ <%= render "forum_posts/forum_post", :forum_post => forum_post %> <% end %> - diff --git a/app/views/forum_posts/new.html.erb b/app/views/forum_posts/new.html.erb index c6e4dc99c..cd68124d1 100644 --- a/app/views/forum_posts/new.html.erb +++ b/app/views/forum_posts/new.html.erb @@ -1,6 +1,11 @@
-

New Forum Post

+ <% if @forum_topic %> +

Reply to <%= @forum_topic.title %>

+ <% else %> +

New Forum Post

+ <% end %> + <%= render "form" %> <%= error_messages_for "forum_post" %>
diff --git a/app/views/forum_topics/show.html.erb b/app/views/forum_topics/show.html.erb index c7ccff099..b72637303 100644 --- a/app/views/forum_topics/show.html.erb +++ b/app/views/forum_topics/show.html.erb @@ -15,6 +15,8 @@ <%= render "forum_posts/listing", :forum_posts => @forum_posts %> +

<%= link_to "Reply »".html_safe, new_forum_post_path(:topic_id => @forum_topic.id) %>

+ <%= numbered_paginator(@forum_posts) %>