]> git.openstreetmap.org Git - rails.git/blob - app/views/notes/index.html.erb
Show marker for hidden notes
[rails.git] / app / views / notes / index.html.erb
1 <% content_for :heading do %>
2   <h1><%= t ".heading", :user => @user.display_name %></h1>
3   <p><%= t ".subheading_html",
4            :user => link_to(@user.display_name, @user),
5            :submitted => tag.span(t(".subheading_submitted"), :class => "px-2 py-1 bg-primary bg-opacity-25"),
6            :commented => tag.span(t(".subheading_commented"), :class => "px-2 py-1 bg-body") %></p>
7 <% end %>
8
9 <%= form_with :url => user_notes_path(@user), :method => :get, :data => { :turbo => true } do %>
10   <div class="row gx-2 align-items-end">
11     <div class="col-sm-auto mb-3">
12       <%= label_tag :status, t(".status") %>
13       <%= select_tag :status,
14                      options_for_select([[t(".all"), "all"], [t(".open"), "open"], [t(".closed"), "closed"]], params[:status] || "all"),
15                      :class => "form-select" %>
16     </div>
17     <div class="col-sm-auto mb-3">
18       <%= submit_tag t(".apply"), :name => nil, :class => "btn btn-primary" %>
19     </div>
20   </div>
21 <% end %>
22
23 <% if @notes.empty? %>
24   <h4><%= t ".no_notes" %></h4>
25
26 <% else %>
27   <%= render :partial => "notes_paging_nav" %>
28
29   <%= render :partial => "layouts/markers", :locals => { :types => %w[cross tick minus] } %>
30
31   <table class="table table-sm note_list">
32     <thead>
33       <tr>
34         <th></th>
35         <th><%= t ".id" %></th>
36         <th><%= t ".creator" %></th>
37         <th><%= t ".description" %></th>
38         <th><%= t ".created_at" %></th>
39         <th><%= t ".last_changed" %></th>
40       </tr>
41     </thead>
42   <% @notes.each do |note| -%>
43     <tr<% if note.author == @user %> class="table-primary"<% end %>>
44       <td>
45         <% if !note.visible?
46              alt_text_key = ".hidden"
47              pin_marker = tag.use :href => "#pin-minus", :color => "gray"
48            elsif note.closed?
49              alt_text_key = ".closed"
50              pin_marker = tag.use :href => "#pin-tick", :color => "var(--marker-green)"
51            else
52              alt_text_key = ".open"
53              pin_marker = tag.use :href => "#pin-cross", :color => "var(--marker-red)"
54            end %>
55         <svg width="25" height="40" alt="<%= t alt_text_key %>">
56           <%= pin_marker %>
57         </svg>
58       </td>
59       <td><%= link_to note.id, note %></td>
60       <td><%= note_author(note.author) %></td>
61       <td><%= note_description(note.author, note.description, current_user&.moderator? ? note.comments.unscope(:where => :visible).first : note.comments.first).to_html %></td>
62       <td><%= friendly_date_ago(note.created_at) %></td>
63       <td><%= friendly_date_ago(note.updated_at) %></td>
64     </tr>
65   <% end -%>
66   </table>
67
68   <%= render :partial => "notes_paging_nav" %>
69
70 <% end -%>