]> git.openstreetmap.org Git - rails.git/blob - app/views/issues/index.html.erb
da00b5fea27a8455fdd1b0951feb26070bff511d
[rails.git] / app / views / issues / index.html.erb
1 <% content_for :heading do %>
2   <h1><%= t ".title" %></h1>
3 <% end %>
4
5 <p><%= t ".search_guidance" %></p>
6
7 <%= form_tag(issues_path, :method => :get) do %>
8   <div class="row gx-1">
9     <div class="mb-3 col-md-auto">
10       <%= select_tag :status,
11                      options_for_select(Issue.aasm.states.map(&:name).map { |state| [t(".states.#{state}"), state] }, params[:status]),
12                      :include_blank => t(".select_status"),
13                      :data => { :behavior => "category_dropdown" },
14                      :class => "form-select" %>
15     </div>
16     <div class="mb-3 col-md-auto">
17       <%= select_tag :issue_type,
18                      options_for_select(@issue_types, params[:issue_type]),
19                      :include_blank => t(".select_type"),
20                      :data => { :behavior => "category_dropdown" },
21                      :class => "form-select" %>
22     </div>
23     <div class="mb-3 col-md">
24       <%= text_field_tag :search_by_user,
25                          params[:search_by_user],
26                          :placeholder => t(".reported_user"),
27                          :autocomplete => "on",
28                          :class => "form-control" %>
29     </div>
30     <div class="mb-3 col-md-auto">
31       <%= select_tag :last_updated_by,
32                      options_for_select(@users.all.collect { |f| [f.display_name, f.id] } << [t(".not_updated"), "nil"], params[:last_updated_by]),
33                      :include_blank => t(".select_last_updated_by"),
34                      :data => { :behavior => "category_dropdown" },
35                      :class => "form-select" %>
36     </div>
37     <div class="mb-3 col-md-auto">
38       <%= submit_tag t(".search"), :name => nil, :class => "btn btn-primary" %>
39     </div>
40   </div>
41 <% end %>
42
43 <% if @issues.length == 0 %>
44   <p><%= t ".issues_not_found" %></p>
45 <% else %>
46   <table class="table table-sm">
47     <thead>
48       <tr>
49         <th><%= t ".status" %></th>
50         <th><%= t ".reports" %></th>
51         <th><%= t ".reported_item" %></th>
52         <th><%= t ".reported_user" %></th>
53         <th><%= t ".last_updated" %></th>
54       </tr>
55     </thead>
56     <tbody>
57       <% @issues.each do |issue| %>
58         <tr>
59           <td><%= t ".states.#{issue.status}" %></td>
60           <td class="text-nowrap"><%= link_to t(".reports_count", :count => issue.reports_count), issue %></td>
61           <td><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %></td>
62           <td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user) if issue.reported_user %></td>
63           <td>
64             <% time_ago_tag = tag.abbr(time_ago_in_words(issue.updated_at, :scope => :"datetime.distance_in_words_ago"),
65                                        :title => l(issue.updated_at)) %>
66             <% if issue.user_updated %>
67               <%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)),
68                                                         :time_ago => time_ago_tag %>
69             <% else %>
70               <%= time_ago_tag %>
71             <% end %>
72           </td>
73         </tr>
74       <% end %>
75     </tbody>
76   </table>
77 <% end %>