]> git.openstreetmap.org Git - rails.git/blob - app/views/browse/changeset.html.erb
fcdc8f1553a0eb2a4be53d1d0df5f8475988e545
[rails.git] / app / views / browse / changeset.html.erb
1 <% set_title(t(".title", :id => @changeset.id)) %>
2
3 <%= render "sidebar_header", :title => t(".title", :id => @changeset.id) %>
4
5 <div class="browse-section">
6   <p class="fst-italic">
7     <%= linkify(@changeset.tags["comment"].to_s.presence || t("browse.no_comment")) %>
8   </p>
9   <p class="details"><%= changeset_details(@changeset) %></p>
10
11   <%= render :partial => "tag_details", :object => @changeset.tags.except("comment") %>
12
13   <div class="row">
14     <div class="col">
15       <h4><%= t(".discussion") %></h4>
16     </div>
17
18     <% if current_user %>
19       <div class="col-auto">
20         <% if @changeset.subscribers.exists?(current_user.id) %>
21           <button class="action-button btn btn-sm btn-primary" name="unsubscribe" data-method="POST" data-url="<%= changeset_unsubscribe_url(@changeset) %>"><%= t("javascripts.changesets.show.unsubscribe") %></button>
22         <% else %>
23           <button class="action-button btn btn-sm btn-primary" name="subscribe" data-method="POST" data-url="<%= changeset_subscribe_url(@changeset) %>"><%= t("javascripts.changesets.show.subscribe") %></button>
24         <% end %>
25       </div>
26     <% end %>
27   </div>
28
29   <% if @comments.length > 0 %>
30     <div class='changeset-comments'>
31       <form action="#">
32         <ul class="list-unstyled">
33           <% @comments.each do |comment| %>
34             <% if comment.visible %>
35               <li id="c<%= comment.id %>">
36                 <small class='text-muted'>
37                   <%= t(".comment_by_html",
38                         :time_ago => friendly_date_ago(comment.created_at),
39                         :user => link_to(comment.author.display_name, user_path(comment.author))) %>
40                   <% if current_user and current_user.moderator? %>
41                     — <span class="action-button" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_hide_url(comment.id) %>"><%= t("javascripts.changesets.show.hide_comment") %></span>
42                   <% end %>
43                 </small>
44                 <div class="mx-2">
45                   <%= comment.body.to_html %>
46                 </div>
47               </li>
48             <% elsif current_user and current_user.moderator? %>
49               <li id="c<%= comment.id %>">
50                 <small class='text-muted'>
51                   <%= t(".hidden_comment_by_html",
52                         :time_ago => friendly_date_ago(comment.created_at),
53                         :user => link_to(comment.author.display_name, user_path(comment.author))) %>
54                   — <span class="action-button text-muted" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_unhide_url(comment.id) %>"><%= t("javascripts.changesets.show.unhide_comment") %></span>
55                  </small>
56                 <div class="mx-2">
57                   <%= comment.body.to_html %>
58                 </div>
59               </li>
60             <% end %>
61           <% end %>
62         </ul>
63       </form>
64     </div>
65   <% end %>
66
67   <% unless current_user %>
68     <p class="notice">
69       <%= link_to(t(".join_discussion"), login_path(:referer => request.fullpath)) %>
70     </p>
71   <% end %>
72
73   <% if current_user %>
74     <% unless @changeset.open? %>
75       <form action="#" class="mb-3">
76         <div class="mb-3">
77           <textarea class="form-control" name="text" cols="40" rows="5"></textarea>
78         </div>
79         <div id="comment-error" class="alert alert-danger p-2 mb-3" hidden>
80         </div>
81         <div>
82           <input type="submit" name="comment" value="<%= t("javascripts.changesets.show.comment") %>" data-changeset-id="<%= @changeset.id %>" data-method="POST" data-url="<%= changeset_comment_url(@changeset) %>" disabled="1" class="btn btn-sm btn-primary" />
83         </div>
84       </form>
85     <% else %>
86       <p class="notice">
87         <%= t(".still_open") %>
88       </p>
89     <% end %>
90   <% end %>
91
92   <% unless @ways.empty? %>
93     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("way", @way_pages), :pages => @way_pages, :page_param => "way_page" } %>
94     <ul class="list-unstyled">
95       <% @ways.each do |way| %>
96         <li class="<%= element_class("way", way) %>">
97           <%= element_strikethrough way do %>
98             <%= link_to printable_name(way, :version => true), { :action => "way", :id => way.way_id.to_s }, { :title => link_title(way) } %>
99           <% end %>
100         </li>
101       <% end %>
102     </ul>
103   <% end %>
104
105   <% unless @relations.empty? %>
106     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("relation", @relation_pages), :pages => @relation_pages, :page_param => "relation_page" } %>
107     <ul class="list-unstyled">
108       <% @relations.each do |relation| %>
109         <li class="<%= element_class("relation", relation) %>">
110           <%= element_strikethrough relation do %>
111             <%= link_to printable_name(relation, :version => true), { :action => "relation", :id => relation.relation_id.to_s }, { :title => link_title(relation) } %>
112           <% end %>
113         </li>
114       <% end %>
115     </ul>
116   <% end %>
117
118   <% unless @nodes.empty? %>
119     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("node", @node_pages), :pages => @node_pages, :page_param => "node_page" } %>
120     <ul class="list-unstyled">
121       <% @nodes.each do |node| %>
122         <li class="<%= element_class("node", node) %>">
123           <%= element_strikethrough node do %>
124             <%= link_to printable_name(node, :version => true), { :action => "node", :id => node.node_id.to_s }, { :title => link_title(node), :rel => link_follow(node) } %>
125           <% end %>
126         </li>
127       <% end %>
128     </ul>
129   <% end %>
130 </div>
131
132 <div class='secondary-actions'>
133   <%= link_to(t(".changesetxml"), :controller => "api/changesets", :action => "show") %>
134   &middot;
135   <%= link_to(t(".osmchangexml"), :controller => "api/changesets", :action => "download") %>
136 </div>
137
138 <% if @next_by_user || @prev_by_user %>
139   <div class='secondary-actions'>
140     <% if @prev_by_user %>
141       <%= link_to({ :id => @prev_by_user.id }, :class => "icon-link") do %>
142         <%= previous_page_svg_tag :height => 11 %>
143         <%= @prev_by_user.id %>
144       <% end %>
145       &middot;
146     <% end %>
147     <%= user = (@prev_by_user || @next_by_user).user.display_name
148         link_to tag.bdi(user), :controller => "changesets", :action => "index", :display_name => user %>
149     <% if @next_by_user %>
150       &middot;
151       <%= link_to({ :id => @next_by_user.id }, :class => "icon-link") do %>
152         <%= @next_by_user.id %>
153         <%= next_page_svg_tag :height => 11 %>
154       <% end %>
155     <% end %>
156   </div>
157 <% end %>