]> git.openstreetmap.org Git - rails.git/blob - app/views/browse/changeset.html.erb
ef30f8214f9e39bd1c55b5f4ea1092c852bbbda6
[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="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="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     <form action="#">
31       <ul class="list-unstyled">
32         <% @comments.each do |comment| %>
33           <% if comment.visible %>
34             <li id="c<%= comment.id %>">
35               <small class='text-muted'>
36                 <%= t(".comment_by_html",
37                       :time_ago => friendly_date_ago(comment.created_at),
38                       :user => link_to(comment.author.display_name, user_path(comment.author))) %>
39                 <% if current_user and current_user.moderator? %>
40                   — <button class="btn btn-sm small btn-link link-secondary p-0 align-baseline" data-method="POST" data-url="<%= changeset_comment_hide_url(comment.id) %>"><%= t("javascripts.changesets.show.hide_comment") %></button>
41                 <% end %>
42               </small>
43               <div class="mx-2">
44                 <%= comment.body.to_html %>
45               </div>
46             </li>
47           <% elsif current_user and current_user.moderator? %>
48             <li id="c<%= comment.id %>">
49               <small class='text-muted'>
50                 <%= t(".hidden_comment_by_html",
51                       :time_ago => friendly_date_ago(comment.created_at),
52                       :user => link_to(comment.author.display_name, user_path(comment.author))) %>
53                 — <button class="btn btn-sm small btn-link link-secondary p-0 align-baseline" data-method="POST" data-url="<%= changeset_comment_unhide_url(comment.id) %>"><%= t("javascripts.changesets.show.unhide_comment") %></button>
54                 </small>
55               <div class="mx-2">
56                 <%= comment.body.to_html %>
57               </div>
58             </li>
59           <% end %>
60         <% end %>
61       </ul>
62     </form>
63   <% end %>
64
65   <% unless current_user %>
66     <p>
67       <%= link_to(t(".join_discussion"), login_path(:referer => request.fullpath)) %>
68     </p>
69   <% end %>
70
71   <% if current_user %>
72     <% unless @changeset.open? %>
73       <form action="#" class="mb-3">
74         <div class="mb-3">
75           <textarea class="form-control" name="text" cols="40" rows="5"></textarea>
76         </div>
77         <div id="comment-error" class="alert alert-danger p-2 mb-3" hidden>
78         </div>
79         <div>
80           <button name="comment" data-method="POST" data-url="<%= changeset_comment_url(@changeset) %>" disabled class="btn btn-sm btn-primary"><%= t("javascripts.changesets.show.comment") %></button>
81         </div>
82       </form>
83     <% else %>
84       <p>
85         <%= t(".still_open") %>
86       </p>
87     <% end %>
88   <% end %>
89
90   <% unless @ways.empty? %>
91     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("way", @way_pages), :pages => @way_pages, :page_param => "way_page" } %>
92     <ul class="list-unstyled">
93       <% @ways.each do |way| %>
94         <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>
95       <% end %>
96     </ul>
97   <% end %>
98
99   <% unless @relations.empty? %>
100     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("relation", @relation_pages), :pages => @relation_pages, :page_param => "relation_page" } %>
101     <ul class="list-unstyled">
102       <% @relations.each do |relation| %>
103         <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>
104       <% end %>
105     </ul>
106   <% end %>
107
108   <% unless @nodes.empty? %>
109     <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("node", @node_pages), :pages => @node_pages, :page_param => "node_page" } %>
110     <ul class="list-unstyled">
111       <% @nodes.each do |node| %>
112         <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>
113       <% end %>
114     </ul>
115   <% end %>
116 </div>
117
118 <% if @next_by_user || @prev_by_user %>
119   <div class='secondary-actions'>
120     <% if @prev_by_user %>
121       <%= link_to({ :id => @prev_by_user.id }, :class => "icon-link") do %>
122         <%= previous_page_svg_tag :height => 11 %>
123         <%= @prev_by_user.id %>
124       <% end %>
125       &middot;
126     <% end %>
127     <%= user = (@prev_by_user || @next_by_user).user.display_name
128         link_to tag.bdi(user), :controller => "changesets", :action => "index", :display_name => user %>
129     <% if @next_by_user %>
130       &middot;
131       <%= link_to({ :id => @next_by_user.id }, :class => "icon-link") do %>
132         <%= @next_by_user.id %>
133         <%= next_page_svg_tag :height => 11 %>
134       <% end %>
135     <% end %>
136   </div>
137 <% end %>
138
139 <div class='secondary-actions'>
140   <%= link_to(t(".changesetxml"), :controller => "api/changesets", :action => "show") %>
141   &middot;
142   <%= link_to(t(".osmchangexml"), :controller => "api/changesets", :action => "download") %>
143 </div>