basic UI for reporting diary entries,diary entry comments and user profiles
authorShrey <shrey14099@iiitd.ac.in>
Thu, 28 May 2015 18:43:08 +0000 (00:13 +0530)
committerMatt Amos <zerebubuth@gmail.com>
Mon, 22 Aug 2016 15:15:12 +0000 (16:15 +0100)
app/controllers/issues_controller.rb
app/helpers/issues_helper.rb
app/views/diary_entry/_diary_comment.html.erb
app/views/issues/new.html.erb
app/views/user/view.html.erb

index a00423a..752bcd2 100644 (file)
@@ -95,7 +95,7 @@ class IssuesController < ApplicationController
     end
 
     def issue_params
-      params.permit(:reportable_id, :reportable_type,:user_id)
+      params[:issue].permit(:reportable_id, :reportable_type,:user_id)
     end
 
     def report_params
index 7e9e233..109599b 100644 (file)
@@ -11,9 +11,9 @@ module IssuesHelper
                when "User"
                        link_to reportable.display_name,        :controller => reportable.class.name.underscore,
                                                                                                                                                                :action => "view",
-                                                                                                                                                               :display_name => reportable.diary_entry.user.display_name
+                                                                                                                                                               :display_name => reportable.display_name
                when "DiaryComment"
-                       link_to "#{reportable.diary_entry.title} Comment id ##{reportable.id}", :controller => reportable.diary_entry.class.name.underscore,
+                       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
index c651c29..46aab61 100644 (file)
@@ -3,6 +3,7 @@
   <p class="deemphasize comment-heading" id="comment<%= diary_comment.id %>"><%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %></p>
   <div class="richtext"><%= diary_comment.body.to_html %></div>
   <%= if_administrator(:span) do %>
-    <%= link_to t('diary_entry.diary_comment.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('diary_entry.diary_comment.confirm') } %>
+    <%= link_to t('diary_entry.diary_comment.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('diary_entry.diary_comment.confirm') } %> |
   <% end %>
+  <%= link_to 'Report', new_issue_url(reportable_id: diary_comment.id, reportable_type: diary_comment.class.name, user_id: diary_comment.user.id) %>
 </div>
index 2a6cd66..2b26765 100644 (file)
@@ -6,9 +6,9 @@
     <%= f.error_messages %>
         <fieldset>
             <div class='form-row'>
-                <%= f.hidden_field :reportable_id, :value => params[:reportable_id] %>
-                <%= f.hidden_field :reportable_type, :value => params[:reportable_type] %>
-                <%= f.hidden_field :user_id, :value => params[:user_id] %>
+                <%= f.hidden_field :reportable_id %>
+                <%= f.hidden_field :reportable_type %>
+                <%= f.hidden_field :user_id %>
             </div>
             <div class='form-row'>
                 <label class="standard-label"><%= t 'issue.new.message' -%></label>
index f39bafe..7a42270 100644 (file)
@@ -81,7 +81,9 @@
               <%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @this_user.display_name) %>
             <% end %>
           </li>
-
+          <li>
+             <%= link_to 'Report', new_issue_url(reportable_id: @this_user.id, reportable_type: @this_user.class.name, user_id: @this_user.id) %>
+          </li>
           <% if @this_user.blocks.exists? %>
             <li>
               <%= link_to t('user.view.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @this_user.display_name %>