From 732e1ab03a3b0f003dd8dc10e505d8d952fa18b9 Mon Sep 17 00:00:00 2001 From: Shrey Date: Thu, 16 Jul 2015 23:30:55 +0530 Subject: [PATCH] Fixed link to DiaryComments --- app/controllers/diary_entry_controller.rb | 3 +++ app/helpers/issues_helper.rb | 3 ++- app/views/diary_entry/view.html.erb | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index c0b6ece38..ed5a64057 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -152,6 +152,9 @@ class DiaryEntryController < ApplicationController @entry = @this_user.diary_entries.visible.where(:id => params[:id]).first if @entry @title = t "diary_entry.view.title", :user => params[:display_name], :title => @entry.title + if params[:comment_id] + @reported_comment = DiaryComment.where(id: params[:comment_id]) + end else @title = t "diary_entry.no_such_entry.title", :id => params[:id] render :action => "no_such_entry", :status => :not_found diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index ef9ae20de..9ecb70e35 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -16,7 +16,8 @@ module IssuesHelper link_to "#{reportable.diary_entry.title}, Comment id ##{reportable.id}", :controller => reportable.diary_entry.class.name.underscore, :action => :view, :display_name => reportable.diary_entry.user.display_name, - :id => reportable.id + :id => reportable.diary_entry.id, + :comment_id => reportable.id when "Changeset" link_to "Changeset ##{reportable.id}, Closed at: #{l(reportable.closed_at.to_datetime, :format => :long)}", :controller => :browse, :action => :changeset, diff --git a/app/views/diary_entry/view.html.erb b/app/views/diary_entry/view.html.erb index d12942a7b..8bc2b6469 100644 --- a/app/views/diary_entry/view.html.erb +++ b/app/views/diary_entry/view.html.erb @@ -10,7 +10,11 @@
-<%= render :partial => 'diary_comment', :collection => @entry.visible_comments %> + <% if @reported_comment %> + <%= render :partial => 'diary_comment', :collection => @reported_comment %> + <% else %> + <%= render :partial => 'diary_comment', :collection => @entry.visible_comments %> + <% end %>
<%= if_logged_in(:div) do %>

<%= t 'diary_entry.view.leave_a_comment' %>

-- 2.39.5