]> git.openstreetmap.org Git - rails.git/blob - app/views/browse/changeset.html.erb
Merge remote-tracking branch 'upstream/pull/3649'
[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         <div class="subscribe-buttons">
21           <form action="#">
22             <% if @changeset.subscribers.exists?(current_user.id) %>
23               <input class="action-button btn btn-sm btn-primary" type="submit" name="unsubscribe" value="<%= t("javascripts.changesets.show.unsubscribe") %>" data-method="POST" data-url="<%= changeset_unsubscribe_url(@changeset) %>" />
24             <% else %>
25               <input class="action-button btn btn-sm btn-primary" type="submit" name="subscribe" value="<%= t("javascripts.changesets.show.subscribe") %>" data-method="POST" data-url="<%= changeset_subscribe_url(@changeset) %>" />
26             <% end %>
27           </form>
28         </div>
29       </div>
30     <% end %>
31   </div>
32
33   <% if @comments.length > 0 %>
34     <div class='changeset-comments'>
35       <form action="#">
36         <ul class="list-unstyled">
37           <% @comments.each do |comment| %>
38             <% if comment.visible %>
39               <li id="c<%= comment.id %>">
40                 <small class='text-muted'>
41                   <%= t(".commented_by_html",
42                         :when => friendly_date_ago(comment.created_at),
43                         :exact_time => l(comment.created_at),
44                         :user => link_to(comment.author.display_name, user_path(comment.author))) %>
45                   <% if current_user and current_user.moderator? %>
46                     — <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>
47                   <% end %>
48                 </small>
49                 <%= comment.body.to_html %>
50               </li>
51             <% elsif current_user and current_user.moderator? %>
52               <li id="c<%= comment.id %>">
53                 <small class='text-muted'>
54                   <%= t(".hidden_commented_by_html",
55                         :when => friendly_date_ago(comment.created_at),
56                         :exact_time => l(comment.created_at),
57                         :user => link_to(comment.author.display_name, user_path(comment.author))) %>
58                   — <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>
59                  </small>
60                 <%= comment.body.to_html %>
61               </li>
62             <% end %>
63           <% end %>
64         </ul>
65       </form>
66     </div>
67   <% end %>
68
69   <% unless current_user %>
70     <p class="notice">
71       <%= link_to(t(".join_discussion"), login_path(:referer => request.fullpath)) %>
72     </p>
73   <% end %>
74
75   <% if current_user %>
76     <% unless @changeset.open? %>
77       <form action="#" class="mb-3">
78         <div class="mb-3">
79           <textarea class="form-control" name="text" cols="40" rows="5"></textarea>
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><%= link_to printable_name(way, :version => true), { :action => "way", :id => way.way_id.to_s }, { :class => link_class("way", way), :title => link_title(way) } %></li>
97       <% end %>
98     </ul>
99   <% end %>
100
101   <% unless @relations.empty? %>
102     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("relation", @relation_pages), :pages => @relation_pages, :page_param => "relation_page" } %>
103     <ul class="list-unstyled">
104       <% @relations.each do |relation| %>
105         <li><%= link_to printable_name(relation, :version => true), { :action => "relation", :id => relation.relation_id.to_s }, { :class => link_class("relation", relation), :title => link_title(relation) } %></li>
106       <% end %>
107     </ul>
108   <% end %>
109
110   <% unless @nodes.empty? %>
111     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("node", @node_pages), :pages => @node_pages, :page_param => "node_page" } %>
112     <ul class="list-unstyled">
113       <% @nodes.each do |node| %>
114         <li><%= link_to printable_name(node, :version => true), { :action => "node", :id => node.node_id.to_s }, { :class => link_class("node", node), :title => link_title(node), :rel => link_follow(node) } %></li>
115       <% end %>
116     </ul>
117   <% end %>
118 </div>
119
120 <% if @next_by_user || @prev_by_user %>
121   <div class='secondary-actions'>
122     <% if @prev_by_user %>
123       <%= link_to "<< #{@prev_by_user.id}", :id => @prev_by_user.id %>
124       &middot;
125     <% end %>
126     <%= user = (@prev_by_user || @next_by_user).user.display_name
127         link_to tag.bdi(user), :controller => "changesets", :action => "index", :display_name => user %>
128     <% if @next_by_user %>
129       &middot;
130       <%= link_to "#{@next_by_user.id} >>", :id => @next_by_user.id %>
131     <% end %>
132   </div>
133 <% end %>
134
135 <div class='secondary-actions'>
136   <%= link_to(t(".changesetxml"), :controller => "api/changesets", :action => "show") %>
137   &middot;
138   <%= link_to(t(".osmchangexml"), :controller => "api/changesets", :action => "download") %>
139 </div>