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