From 7ffec2eb389a446b583f6768934b273d665ec2a3 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 13 Sep 2017 16:12:36 +0100 Subject: [PATCH] Rework the 'issues not found' notice slightly. Previously it would go into a redirect loop if there were no issues in the database. --- app/controllers/issues_controller.rb | 2 -- app/views/issues/index.html.erb | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 67c0d5b6e..534cc2fde 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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) diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index f9f2c28f9..a490223ae 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1,5 +1,3 @@ -

<%= notice %>

- <% content_for :heading do %>

List of <%= @user_role %> issues:

<% end %> @@ -13,6 +11,11 @@ Search for a particular issue(s):
<%= submit_tag "Search" %> <% end %>
+ +<% if @issues.length == 0 %> +

<%= t ".search.issues_not_found" %>

+<% end %> +
-- 2.43.2