]> git.openstreetmap.org Git - rails.git/blob - app/views/browse/changeset.html.erb
Merge remote-tracking branch 'upstream/pull/2838'
[rails.git] / app / views / browse / changeset.html.erb
1 <% set_title(t(".title", :id => @changeset.id)) %>
2
3 <h2>
4   <a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
5   <%= t(".title", :id => @changeset.id) %>
6 </h2>
7
8 <div class="browse-section">
9   <p class="font-italic">
10     <%= linkify(@changeset.tags["comment"].to_s.presence || t("browse.no_comment")) %>
11   </p>
12   <div class="details"><%= changeset_details(@changeset) %></div>
13
14   <%= render :partial => "tag_details", :object => @changeset.tags.except("comment") %>
15
16   <h4 class="comments-header"><%= t(".discussion") %></h4>
17
18   <% if current_user %>
19     <div class="buttons clearfix subscribe-buttons">
20       <form action="#" class="standard-form">
21         <% if @changeset.subscribers.exists?(current_user.id) %>
22           <input class="action-button" type="submit" name="unsubscribe" value="<%= t("javascripts.changesets.show.unsubscribe") %>" data-method="POST" data-url="<%= changeset_unsubscribe_url(@changeset) %>" />
23         <% else %>
24           <input class="action-button" type="submit" name="subscribe" value="<%= t("javascripts.changesets.show.subscribe") %>" data-method="POST" data-url="<%= changeset_subscribe_url(@changeset) %>" />
25         <% end %>
26       </form>
27     </div>
28   <% end %>
29
30   <div class="clearfix"></div>
31
32   <% if @comments.length > 0 %>
33     <div class='changeset-comments'>
34       <form action="#" class="standard-form">
35         <ul class="list-unstyled">
36           <% @comments.each do |comment| %>
37             <% if comment.visible %>
38               <li id="c<%= comment.id %>">
39                 <small class='text-muted'>
40                   <%= t(".commented_by",
41                         :when => friendly_date_ago(comment.created_at),
42                         :exact_time => l(comment.created_at),
43                         :user => link_to(comment.author.display_name, user_path(comment.author))).html_safe %>
44                   <% if current_user and current_user.moderator? %>
45                     — <span class="action-button deemphasize" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_hide_url(comment.id) %>"><%= t("javascripts.changesets.show.hide_comment") %></span>
46                   <% end %>
47                 </small>
48                 <%= comment.body.to_html %>
49               </li>
50             <% elsif current_user and current_user.moderator? %>
51               <li id="c<%= comment.id %>">
52                 <small class='text-muted'>
53                   <%= t(".hidden_commented_by",
54                         :when => friendly_date_ago(comment.created_at),
55                         :exact_time => l(comment.created_at),
56                         :user => link_to(comment.author.display_name, user_path(comment.author))).html_safe %>
57                   — <span class="action-button deemphasize" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_unhide_url(comment.id) %>"><%= t("javascripts.changesets.show.unhide_comment") %></span>
58                  </small>
59                 <%= comment.body.to_html %>
60               </li>
61             <% end %>
62           <% end %>
63         </ul>
64       </form>
65     </div>
66   <% end %>
67
68   <% unless current_user %>
69     <div class="notice">
70       <%= link_to(t(".join_discussion"), :controller => "users", :action => "login", :referer => request.fullpath) %>
71     </div>
72   <% end %>
73
74   <% if current_user %>
75     <% unless @changeset.is_open? %>
76       <form action="#" class="standard-form">
77         <textarea class="comment" name="text" cols="40" rows="5"></textarea>
78         <div class="buttons clearfix">
79           <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" />
80         </div>
81       </form>
82     <% else %>
83       <div class="notice">
84       <%= t(".still_open") %>
85       </div>
86     <% end %>
87   <% end %>
88
89   <% unless @ways.empty? %>
90     <h4>
91       <%= type_and_paginated_count("way", @way_pages) %>
92       <%= render :partial => "paging_nav", :locals => { :pages => @way_pages, :page_param => "way_page" } %>
93     </h4>
94     <ul class="list-unstyled">
95       <% @ways.each do |way| %>
96         <li><%= link_to printable_name(way, 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     <h4>
103       <%= type_and_paginated_count("relation", @relation_pages) %>
104       <%= render :partial => "paging_nav", :locals => { :pages => @relation_pages, :page_param => "relation_page" } %>
105     </h4>
106     <ul class="list-unstyled">
107       <% @relations.each do |relation| %>
108         <li><%= link_to printable_name(relation, true), { :action => "relation", :id => relation.relation_id.to_s }, { :class => link_class("relation", relation), :title => link_title(relation) } %></li>
109       <% end %>
110     </ul>
111   <% end %>
112
113   <% unless @nodes.empty? %>
114     <h4>
115       <%= type_and_paginated_count("node", @node_pages) %>
116       <%= render :partial => "paging_nav", :locals => { :pages => @node_pages, :page_param => "node_page" } %>
117     </h4>
118     <ul class="list-unstyled">
119       <% @nodes.each do |node| %>
120         <li><%= link_to printable_name(node, true), { :action => "node", :id => node.node_id.to_s }, { :class => link_class("node", node), :title => link_title(node), :rel => link_follow(node) } %></li>
121       <% end %>
122     </ul>
123   <% end %>
124 </div>
125
126 <% if @next_by_user || @prev_by_user %>
127   <div class='secondary-actions'>
128     <% if @prev_by_user %>
129       <%= link_to "<< #{@prev_by_user.id}", :id => @prev_by_user.id %>
130       &middot;
131     <% end %>
132     <%= user = (@prev_by_user || @next_by_user).user.display_name
133         link_to tag.bdi(user), :controller => "changesets", :action => "index", :display_name => user %>
134     <% if @next_by_user %>
135       &middot;
136       <%= link_to "#{@next_by_user.id} >>", :id => @next_by_user.id %>
137     <% end %>
138   </div>
139 <% end %>
140
141 <div class='secondary-actions'>
142   <%= link_to(t(".changesetxml"), :controller => "api/changesets", :action => "show") %>
143   &middot;
144   <%= link_to(t(".osmchangexml"), :controller => "api/changesets", :action => "download") %>
145 </div>