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