More whitespace fixes. Attempting to get tests to pass.

This commit is contained in:
Matt Amos 2016-08-22 18:38:03 +01:00
parent 757a1aaa85
commit c3ad6aa292
13 changed files with 419 additions and 387 deletions

View file

@ -69,7 +69,6 @@ class IssuesController < ApplicationController
@issue = Issue.find_or_initialize_by(create_new_issue_params)
path = "issues.report_strings." + @issue.reportable.class.name.to_s
@report_strings_yaml = t(path)
flash[:referer] = params[:referer]
end
end
@ -106,7 +105,7 @@ class IssuesController < ApplicationController
Notifier.new_issue_notification(@issue.id, User.find(user.user_id)).deliver_now
end
redirect_to flash[:referer], :notice => t("issues.create.successful_report")
redirect_back "/", :notice => t("issues.create.successful_report")
end
else
redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id, :reported_user_id => @issue.reported_user_id), :notice => t("issues.create.provide_details")
@ -140,7 +139,7 @@ class IssuesController < ApplicationController
if @report.save!
@issue.report_count = @issue.reports.count
@issue.save!
redirect_to flash[:referer], :notice => notice
redirect_back "/", :notice => notice
end
else
redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id, :reported_user_id => @issue.reported_user_id), :notice => t("issues.update.provide_details")
@ -272,4 +271,13 @@ class IssuesController < ApplicationController
def sort_direction
%w(asc desc).include?(params[:direction]) ? params[:direction] : "asc"
end
# back-port of ActionController#redirect_back from rails 5
def redirect_back(fallback_location, **args)
if referer = request.headers["Referer"]
redirect_to referer, **args
else
redirect_to fallback_location, **args
end
end
end

View file

@ -3,7 +3,7 @@
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
<% if @user and @user.id!=@note.author.id %>
<% if @user && @note.author && @user.id != @note.author.id %>
<%= link_to new_issue_url(reportable_id: @note.id, reportable_type: @note.class.name, reported_user_id: @note.author.id,referer: request.fullpath), :title => t('browse.note.report') do %>
&nbsp;&#9872;
<% end %>

View file

@ -2,12 +2,12 @@
<%= user_thumbnail diary_comment.user %>
<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}"))) %>
<% if @user and diary_comment.user.id != @user.id %>
<%= link_to new_issue_url(reportable_id: diary_comment.id, reportable_type: diary_comment.class.name, reported_user_id: diary_comment.user.id, referer: request.fullpath), :title => t('diary_entry.diary_comment.report') do %>
<%= link_to new_issue_url(reportable_id: diary_comment.id, reportable_type: diary_comment.class.name, reported_user_id: diary_comment.user.id, referer: request.fullpath), :title => t('diary_entry.diary_comment.report') do %>
&nbsp;&#9872;
<% end %>
<% end %>
<% end %>
</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') } %>

View file

@ -1,29 +1,30 @@
<div class="issue-comments">
<% comments.each do |comment| %>
<div class="comment">
<div style="float:left">
<%= link_to user_thumbnail(comment.user), :controller => :user,:action =>:view, :display_name => comment.user.display_name %>
</div>
<b> <%= link_to comment.user.display_name, :controller => :user,:action =>:view, :display_name => comment.user.display_name %> </b> <br/>
<%= comment.body %>
<% comments.each do |comment| %>
<div class="comment">
<div style="float:left">
<%= link_to user_thumbnail(comment.user), :controller => :user,:action =>:view, :display_name => comment.user.display_name %>
</div>
<b> <%= link_to comment.user.display_name, :controller => :user,:action =>:view, :display_name => comment.user.display_name %> </b> <br/>
<%= comment.body %>
<% if comment.reassign %>
<br/>
<i><%= t('issues.show.comments.reassign') %></i>
<% end %>
</div>
<span class="deemphasize">
On <%= l comment.created_at.to_datetime, :format => :friendly %> </span>
<hr>
<% end %>
<% if comment.reassign %>
<br/>
<i><%= t('issues.show.comments.reassign') %></i>
<% end %>
</div>
<span class="deemphasize">
On <%= l comment.created_at.to_datetime, :format => :friendly %>
</span>
<hr>
<% end %>
</div>
<br/>
<div class="comment">
<%= form_for :issue_comment, :url => { :action => 'comment', :id => @issue.id, :user_id => @user.id } do |f| %>
<%= richtext_area :issue_comment, :body, :cols => 10, :rows => 8, :required => true %>
<%= label_tag t('issues.show.comments.reassign_param') %> <%= check_box_tag :reassign, true %>
<br/>
<br/>
<%= submit_tag 'Submit' %>
<% end %>
</div>
<%= form_for :issue_comment, :url => { :action => 'comment', :id => @issue.id, :user_id => @user.id } do |f| %>
<%= richtext_area :issue_comment, :body, :cols => 10, :rows => 8, :required => true %>
<%= label_tag t('issues.show.comments.reassign_param') %> <%= check_box_tag :reassign, true %>
<br/>
<br/>
<%= submit_tag 'Submit' %>
<% end %>
</div>

View file

@ -1,16 +1,16 @@
<% reports.each do |report| %>
<% details = report.details.split("--||--") %>
<div class="reports">
<div style="float:left">
<%= link_to user_thumbnail(report.user), :controller => :user,:action =>:view, :display_name => report.user.display_name %>
</div>
Reported as <b><%= details[1].delete('[').delete(']').downcase %></b> by <b><%= link_to report.user.display_name, :controller => :user,:action =>:view, :display_name => report.user.display_name %></b> <br/>
<span class="deemphasize">
On <%= l report.updated_at.to_datetime, :format => :friendly %>
</span>
<br/>
<%= details[0] %>
<br/>
</div>
<hr>
<% details = report.details.split("--||--") %>
<div class="reports">
<div style="float:left">
<%= link_to user_thumbnail(report.user), :controller => :user,:action =>:view, :display_name => report.user.display_name %>
</div>
Reported as <b><%= details[1].delete('[').delete(']').downcase %></b> by <b><%= link_to report.user.display_name, :controller => :user,:action =>:view, :display_name => report.user.display_name %></b> <br/>
<span class="deemphasize">
On <%= l report.updated_at.to_datetime, :format => :friendly %>
</span>
<br/>
<%= details[0] %>
<br/>
</div>
<hr>
<% end %>

View file

@ -1,47 +1,43 @@
<p id= "notice"><%= notice %></p>
<% content_for :heading do %>
<h1>List of <%= @user_role %> issues:</h1>
<h1>List of <%= @user_role %> issues:</h1>
<% end %>
<%= form_tag(issues_path, :method => :get) do %>
Search for a particular issue(s): <br/>
<%= select :status, nil, [['open', 0],['resolved',2],['ignored',1]],{:include_blank => "Select status"},data: { behavior: 'category_dropdown' } %>
<%= select :issue_type, nil, @issue_types,{:include_blank => "Select type"}, data: { behavior: 'category_dropdown' } %>
<%= text_field_tag :search_by_user, params[:search_by_user], placeholder: "Reported User" %>
<%= select :last_reported_by, nil, @users.all.collect {|f| [f.display_name, f.id]} << ['Not updated',"nil"], {:include_blank => "Select last updated by"}, data: { behavior: 'category_dropdown' } %>
<%= submit_tag "Search" %>
Search for a particular issue(s): <br/>
<%= select :status, nil, [['open', 0],['resolved',2],['ignored',1]],{:include_blank => "Select status"},data: { behavior: 'category_dropdown' } %>
<%= select :issue_type, nil, @issue_types,{:include_blank => "Select type"}, data: { behavior: 'category_dropdown' } %>
<%= text_field_tag :search_by_user, params[:search_by_user], placeholder: "Reported User" %>
<%= select :last_reported_by, nil, @users.all.collect {|f| [f.display_name, f.id]} << ['Not updated',"nil"], {:include_blank => "Select last updated by"}, data: { behavior: 'category_dropdown' } %>
<%= submit_tag "Search" %>
<% end %>
<br/>
<br/>
<table>
<thead>
<tr>
<tr>
<td style="width:40px;"><b> <%= sortable("status") %></b></td>
<td style="width:160px;"><b> <%= sortable("report_count", "Number of Reports") %></b></td>
<td style="width:141px;"><b> <%= sortable("updated_at","Last updated at") %></b></td>
<td style="width:140px;"><b> <%= sortable("updated_by","Last updated by") %></b></td>
<td style="width:203px;"><b> Link to reports </b></td>
<td style="width:128px;"><b> <%= sortable("reported_user_id","Reported User") %> </b></td>
<td style="width:67px;"><b> Link to reported instance</b></td>
</tr>
</tr>
</thead>
<tbody>
<% @issues.each do |issue| %>
<tr>
<td><%= issue.status.humanize %></td>
<td style="text-align:center;"><%= issue.report_count %></td>
<td><%= l(issue.updated_at.to_datetime, :format => :friendly) %></td>
<td><% if issue.user_updated %> <%= issue.user_updated.display_name %> <% else %> - <% end %></td>
<td> <%= reports_url(issue) %></td>
<td><%= link_to issue.user.display_name , :controller => :user, :action => :view,:display_name => issue.user.display_name %></td>
<td><%= instance_url(issue.reportable) %></td>
</tr>
<% end %>
</tbody>
<thead>
<tr>
<td style="width:40px;"><b> <%= sortable("status") %></b></td>
<td style="width:160px;"><b> <%= sortable("report_count", "Number of Reports") %></b></td>
<td style="width:141px;"><b> <%= sortable("updated_at","Last updated at") %></b></td>
<td style="width:140px;"><b> <%= sortable("updated_by","Last updated by") %></b></td>
<td style="width:203px;"><b> Link to reports </b></td>
<td style="width:128px;"><b> <%= sortable("reported_user_id","Reported User") %> </b></td>
<td style="width:67px;"><b> Link to reported instance</b></td>
</tr>
</thead>
<tbody>
<% @issues.each do |issue| %>
<tr>
<td><%= issue.status.humanize %></td>
<td style="text-align:center;"><%= issue.report_count %></td>
<td><%= l(issue.updated_at.to_datetime, :format => :friendly) %></td>
<td><% if issue.user_updated %> <%= issue.user_updated.display_name %> <% else %> - <% end %></td>
<td><%= reports_url(issue) %></td>
<td><%= link_to issue.user.display_name , :controller => :user, :action => :view,:display_name => issue.user.display_name %></td>
<td><%= instance_url(issue.reportable) %></td>
</tr>
<% end %>
</tbody>
</table>

View file

@ -1,44 +1,43 @@
<% content_for :heading do %>
<h1>Report <%= reportable_url(@issue.reportable) %></h1>
<h1>Report <%= reportable_url(@issue.reportable) %></h1>
<% end %>
<div class="disclaimer">
<ul>
<ul>
<%= t('issues.new.disclaimer.intro') %>:
<li> <%= t('issues.new.disclaimer.not_just_mistake') %> </li>
<li> <%= t('issues.new.disclaimer.unable_to_fix') %> </li>
<li> <%= t('issues.new.disclaimer.resolve_with_user') %> </li>
<li> <%= t('issues.new.disclaimer.not_just_mistake') %> </li>
<li> <%= t('issues.new.disclaimer.unable_to_fix') %> </li>
<li> <%= t('issues.new.disclaimer.resolve_with_user') %> </li>
</ul>
</div>
<%= form_for(@issue) do |f| %>
<%= f.error_messages %>
<fieldset>
<div class='form-row'>
<%= f.hidden_field :reportable_id %>
<%= f.hidden_field :reportable_type %>
<%= f.hidden_field :reported_user_id %>
</div>
<%= f.error_messages %>
<fieldset>
<div class='form-row'>
<%= f.hidden_field :reportable_id %>
<%= f.hidden_field :reportable_type %>
<%= f.hidden_field :reported_user_id %>
</div>
<div class='form-row' style='width:600px'>
<p><%= t('issues.new.select') %>:</p>
<div class='form-row' style='width:600px'>
<p><%= t('issues.new.select') %>:</p>
<div class="new-report-form">
<% @report_strings_yaml.each do |k,v| %>
<div style="padding-left:5px">
<%= radio_button_tag :report_type, v[:type].to_s %>
<%= label_tag v[:details].to_s %> <br/>
</div>
<% end %>
</div>
<br/>
<%= text_area :report, :details, :cols => 20, :rows => 3, placeholder: t('issues.new.details'), required: true %>
</div>
<div class="new-report-form">
<% @report_strings_yaml.each do |k,v| %>
<div style="padding-left:5px">
<%= radio_button_tag :report_type, v[:type].to_s %>
<%= label_tag v[:details].to_s %> <br/>
</div>
<% end %>
</div>
<div class='buttons'>
<%= submit_tag %>
</div>
</fieldset>
<br/>
<%= text_area :report, :details, :cols => 20, :rows => 3, placeholder: t('issues.new.details'), required: true %>
</div>
<div class='buttons'>
<%= submit_tag %>
</div>
</fieldset>
<% end %>

View file

@ -1,62 +1,60 @@
<% content_for :heading do %>
<h2> <%= @issue.status.humanize %> Issue #<%= @issue.id %> <br/></h2>
<p><%= report_type(@issue.reportable_type) %> : <%= reportable_url(@issue.reportable) %></p>
<p class="deemphasize">
<small>
<%= @issue.reports.count %> reports | First reported: <%= l @issue.created_at.to_datetime, :format => :friendly %> <%= "| Last resolved at #{l(@issue.resolved_at.to_datetime, :format =>:friendly)}" if @issue.resolved_at? %> <%= "| Last updated at #{l(@issue.updated_at.to_datetime, :format => :friendly)} by #{@updated_by_admin.display_name}" if @updated_by_admin %>
</small>
</p>
<p>
<%= link_to t('issues.resolve'), resolve_issue_url(@issue), :method => :post if @issue.may_resolve? %>
<% if @issue.may_ignore? %>
| <%= link_to t('issues.ignore'), ignore_issue_url(@issue), :method => :post %>
<% end %>
</p>
<p><%= link_to t('issues.reopen'), reopen_issue_url(@issue), :method => :post if @issue.may_reopen? %></p>
<h2> <%= @issue.status.humanize %> Issue #<%= @issue.id %> <br/></h2>
<p><%= report_type(@issue.reportable_type) %> : <%= reportable_url(@issue.reportable) %></p>
<p class="deemphasize">
<small>
<%= @issue.reports.count %> reports | First reported: <%= l @issue.created_at.to_datetime, :format => :friendly %> <%= "| Last resolved at #{l(@issue.resolved_at.to_datetime, :format =>:friendly)}" if @issue.resolved_at? %> <%= "| Last updated at #{l(@issue.updated_at.to_datetime, :format => :friendly)} by #{@updated_by_admin.display_name}" if @updated_by_admin %>
</small>
</p>
<p>
<%= link_to t('issues.resolve'), resolve_issue_url(@issue), :method => :post if @issue.may_resolve? %>
<% if @issue.may_ignore? %>
| <%= link_to t('issues.ignore'), ignore_issue_url(@issue), :method => :post %>
<% end %>
</p>
<p><%= link_to t('issues.reopen'), reopen_issue_url(@issue), :method => :post if @issue.may_reopen? %></p>
<% end %>
<div class="report-related-block">
<div class="report-block">
<h3>Reports under this issue:</h3>
<div class="report-block">
<h3>Reports under this issue:</h3>
<% if @read_reports.present? %>
<div class="read-reports">
<h4>Read Reports:</h4>
<br/>
<%= render 'reports',reports: @read_reports %>
</div>
<% end %>
<% if @read_reports.present? %>
<div class="read-reports">
<h4>Read Reports:</h4>
<br/>
<%= render 'reports',reports: @read_reports %>
</div>
<% end %>
<% if @unread_reports.any? %>
<div class="unread-reports">
<h4>New Reports:</h4>
<br/>
<%= render 'reports',reports: @unread_reports %>
</div>
<% end %>
<br/>
</div>
<div class="related-block">
<h3> Other issues against this user: </h3>
<div class="unread-reports">
<% if @related_issues.count > 1 %>
<% @related_issues.each do |issue| %>
<% if issue.id != @issue.id %>
<%= reports_url(issue) %> <br/>
<% end %>
<% end %>
<% else %>
<p>No other reports against this user!</p>
<% end %>
</div>
</div>
<% if @unread_reports.any? %>
<div class="unread-reports">
<h4>New Reports:</h4>
<br/>
<%= render 'reports',reports: @unread_reports %>
</div>
<% end %>
<br/>
</div>
<div class="related-block">
<h3> Other issues against this user: </h3>
<div class="unread-reports">
<% if @related_issues.count > 1 %>
<% @related_issues.each do |issue| %>
<% if issue.id != @issue.id %>
<%= reports_url(issue) %> <br/>
<% end %>
<% end %>
<% else %>
<p>No other reports against this user!</p>
<% end %>
</div>
</div>
</div>
<h3>Comments on this issue:</h3>
<div class="unread-reports">
<%= render 'comments', comments: @comments %>
</div>
<div class="unread-reports">
<%= render 'comments', comments: @comments %>
</div>