]> git.openstreetmap.org Git - rails.git/blob - app/views/changesets/show.html.erb
Localisation updates from https://translatewiki.net.
[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="mb-3 border-bottom border-secondary-subtle pb-3">
6   <p class="fs-6 overflow-x-auto" dir="auto">
7     <%= linkify(@changeset.tags["comment"].to_s.presence || t("browse.no_comment")) %>
8   </p>
9   <%= tag.p :class => "details", :data => { :changeset => changeset_data(@changeset) } do %>
10     <%= changeset_details(@changeset) %>
11   <% end %>
12
13   <%= render :partial => "browse/tag_details", :object => @changeset.tags.except("comment") %>
14
15   <div class="row">
16     <div class="col">
17       <h4><%= t(".discussion") %></h4>
18     </div>
19
20     <% if current_user %>
21       <div class="col-auto">
22         <% if @changeset.subscribers.exists?(current_user.id) %>
23           <%= tag.button t(".unsubscribe"),
24                          :class => "btn btn-sm btn-primary",
25                          :name => "unsubscribe",
26                          :data => { :method => "DELETE",
27                                     :url => api_changeset_subscription_path(@changeset) } %>
28         <% else %>
29           <%= tag.button t(".subscribe"),
30                          :class => "btn btn-sm btn-primary",
31                          :name => "subscribe",
32                          :data => { :method => "POST",
33                                     :url => api_changeset_subscription_path(@changeset) } %>
34         <% end %>
35       </div>
36     <% end %>
37   </div>
38
39   <% @comments.each do |comment| %>
40     <% next unless comment.visible || current_user&.moderator? %>
41     <article id="c<%= comment.id %>">
42       <small class='text-body-secondary'>
43         <%= comment_by_options = { :time_ago => friendly_date_ago(comment.created_at),
44                                    :user => link_to(comment.author.display_name, comment.author) }
45             comment.visible ? t(".comment_by_html", **comment_by_options) : t(".hidden_comment_by_html", **comment_by_options) %>
46         <% if current_user&.moderator? %>
47           —
48           <%= tag.button t(".#{comment.visible ? 'hide' : 'unhide'}_comment"),
49                          :class => "btn btn-sm small btn-link link-secondary p-0 align-baseline",
50                          :data => { :method => comment.visible ? "DELETE" : "POST",
51                                     :url => api_changeset_comment_visibility_path(comment) } %>
52         <% end %>
53         <%= link_to inline_svg_tag("icons/link.svg"), "#c#{comment.id}" %>
54       </small>
55       <div class="mx-2">
56         <%= comment.body.to_html %>
57       </div>
58     </article>
59   <% end %>
60
61   <% unless current_user %>
62     <p>
63       <%= link_to(t(".join_discussion"), login_path(:referer => request.fullpath)) %>
64     </p>
65   <% end %>
66
67   <% if current_user %>
68     <% unless @changeset.open? %>
69       <form action="#" class="mb-3">
70         <div class="mb-3">
71           <textarea class="form-control" name="text" cols="40" rows="5"></textarea>
72         </div>
73         <div id="comment-error" class="alert alert-danger p-2 mb-3" hidden>
74         </div>
75         <div>
76           <%= tag.button t(".comment"),
77                          :class => "btn btn-primary",
78                          :name => "comment",
79                          :disabled => true,
80                          :data => { :method => "POST",
81                                     :url => api_changeset_changeset_comments_path(@changeset) } %>
82         </div>
83       </form>
84     <% else %>
85       <p>
86         <%= t(".still_open") %>
87       </p>
88     <% end %>
89   <% end %>
90
91   <% unless @ways.empty? %>
92     <%= render :partial => "elements", :locals => { :type => "way", :elements => @ways, :pages => @way_pages } %>
93   <% end %>
94
95   <% unless @relations.empty? %>
96     <%= render :partial => "elements", :locals => { :type => "relation", :elements => @relations, :pages => @relation_pages } %>
97   <% end %>
98
99   <% unless @nodes.empty? %>
100     <%= render :partial => "elements", :locals => { :type => "node", :elements => @nodes, :pages => @node_pages } %>
101   <% end %>
102 </div>
103
104 <div class='secondary-actions'>
105   <%= link_to t(".changesetxml"), api_changeset_path(@changeset) %>
106   &middot;
107   <%= link_to t(".osmchangexml"), api_changeset_download_path(@changeset) %>
108 </div>
109
110 <% if @next_by_user || @prev_by_user %>
111   <div class='secondary-actions'>
112     <% if @prev_by_user %>
113       <%= link_to @prev_by_user, :class => "icon-link" do %>
114         <%= previous_page_svg_tag :height => 11 %>
115         <%= @prev_by_user.id %>
116       <% end %>
117       &middot;
118     <% end %>
119     <%= user = (@prev_by_user || @next_by_user).user.display_name
120         link_to tag.bdi(user), :controller => "changesets", :action => "index", :display_name => user %>
121     <% if @next_by_user %>
122       &middot;
123       <%= link_to @next_by_user, :class => "icon-link" do %>
124         <%= @next_by_user.id %>
125         <%= next_page_svg_tag :height => 11 %>
126       <% end %>
127     <% end %>
128   </div>
129 <% end %>