before_action :find_issue, only: [:show, :resolve, :reopen, :ignore]
def index
- @issues = Issue.all.order(:status)
+ if params[:search_by_user].present?
+ @user = User.find_by_display_name(params[:search_by_user])
+ if @user.present?
+ @issues = Issue.where(reported_user_id: @user.id).order(:status)
+ else
+ @issues = Issue.all.order(:status)
+ redirect_to issues_path, notice: t('issues.index.search.user_not_found')
+ end
+
+ if @user.present? and not @issues.present?
+ @issues = Issue.all.order(:status)
+ redirect_to issues_path, notice: t('issues.index.search.issues_not_found')
+ end
+ else
+ @issues = Issue.all.order(:status)
+ end
end
def show
<h1>List of existing Issues:</h1>
<% end %>
+<%= form_tag(issues_path, :method => :get) do %>
+ <%= text_field_tag :search_by_user, params[:search_by_user], placeholder: "Search by Reported User" %>
+ <%= submit_tag "Search" %>
+<% end %>
+<br/>
+<br/>
+
<table>
<thead>
<tr>
resolve: Resolve
ignore: Ignore
reopen: Reopen
+ index:
+ search:
+ user_not_found: User does not exist
+ issues_not_found: No Issues against the user
create:
successful_report: Your report has been registered sucessfully
provide_details: Please provide the required details
resolve: Resolve
ignore: Ignore
reopen: Reopen
+ index:
+ search:
+ user_not_found: User does not exist
+ issues_not_found: No Issues against the user
create:
successful_report: Your report has been registered sucessfully
provide_details: Please provide the required details