Rework the 'issues not found' notice slightly.
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 13 Sep 2017 15:12:36 +0000 (16:12 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 13 Sep 2017 15:12:36 +0000 (16:12 +0100)
Previously it would go into a redirect loop if there were no issues
in the database.

app/controllers/issues_controller.rb
app/views/issues/index.html.erb

index 67c0d5b6ef8fe0d670a0a512c06ba95231ca67cc..534cc2fde31e0f45b4430f88d1c13f527087a09e 100644 (file)
@@ -45,8 +45,6 @@ class IssuesController < ApplicationController
       @issues = @issues.where(:updated_by => last_updated_by)
     end
 
-    notice = t("issues.index.search.issues_not_found") if @issues.first.nil?
-
     if params[:last_reported_by] && params[:last_reported_by][0].present?
       last_reported_by = params[:last_reported_by][0].to_s == "nil" ? nil : params[:last_reported_by][0].to_i
       @issues = @issues.where(:updated_by => last_reported_by)
index f9f2c28f96ef9656903d554ee477ba6ca770d31f..a490223ae472a159d2ad3e10e66fb6275aee5a37 100644 (file)
@@ -1,5 +1,3 @@
-<p id= "notice"><%= notice %></p>
-
 <% content_for :heading do %>
   <h1>List of <%= @user_role %> issues:</h1>
 <% end %>
@@ -13,6 +11,11 @@ Search for a particular issue(s):  <br/>
 <%= submit_tag "Search" %>
 <% end %>
 <br/>
+
+<% if @issues.length == 0 %>
+  <p><%= t ".search.issues_not_found" %></p>
+<% end %>
+
 <br/>
 
 <table>