Pluralize changesets controller
This commit is contained in:
parent
4deffa5e40
commit
252b9ef08a
21 changed files with 80 additions and 81 deletions
30
app/views/changesets/_changeset.html.erb
Normal file
30
app/views/changesets/_changeset.html.erb
Normal file
|
@ -0,0 +1,30 @@
|
|||
<%
|
||||
changeset_data = {:id => changeset.id}
|
||||
|
||||
if changeset.has_valid_bbox?
|
||||
bbox = changeset.bbox.to_unscaled
|
||||
changeset_data[:bbox] = {
|
||||
:minlon => bbox.min_lon,
|
||||
:minlat => bbox.min_lat,
|
||||
:maxlon => bbox.max_lon,
|
||||
:maxlat => bbox.max_lat
|
||||
}
|
||||
end
|
||||
%>
|
||||
|
||||
<%= content_tag "li", :id => "changeset_#{changeset.id}", :data => {:changeset => changeset_data} do %>
|
||||
<h4>
|
||||
<a class="changeset_id" href="<%= changeset_path(changeset) %>">
|
||||
<%= changeset.tags['comment'].to_s.presence || t('browse.no_comment') %>
|
||||
</a>
|
||||
</h4>
|
||||
<div class="comments comments-<%= changeset.comments.length %>">
|
||||
<%= changeset.comments.length %>
|
||||
<span class="icon note grey"></span>
|
||||
</div>
|
||||
<div class="details">
|
||||
<%= changeset_details(changeset) %>
|
||||
·
|
||||
#<%= changeset.id %>
|
||||
</div>
|
||||
<% end %>
|
1
app/views/changesets/_user.atom.builder
Normal file
1
app/views/changesets/_user.atom.builder
Normal file
|
@ -0,0 +1 @@
|
|||
xml.a(user.display_name, :href => url_for(:controller => "users", :action => "view", :display_name => user.display_name))
|
23
app/views/changesets/history.html.erb
Normal file
23
app/views/changesets/history.html.erb
Normal file
|
@ -0,0 +1,23 @@
|
|||
<% content_for :auto_discovery_link_tag do -%>
|
||||
<% unless params[:friends] or params[:nearby] -%>
|
||||
<%= auto_discovery_link_tag :atom, @params.merge(:max_id => nil, :xhr => nil, :action => :feed) %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
<%
|
||||
set_title(changeset_index_title(params, current_user))
|
||||
if params[:display_name]
|
||||
@heading = t('changesets.index.title_user', :user => link_to(params[:display_name], user_path(:display_name => params[:display_name]))).html_safe
|
||||
else
|
||||
@heading = @title
|
||||
end
|
||||
%>
|
||||
|
||||
<h2>
|
||||
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
|
||||
<%= @heading %>
|
||||
</h2>
|
||||
|
||||
<div class="changesets">
|
||||
<%= image_tag "searching.gif", :class => "loader" %>
|
||||
</div>
|
86
app/views/changesets/index.atom.builder
Normal file
86
app/views/changesets/index.atom.builder
Normal file
|
@ -0,0 +1,86 @@
|
|||
atom_feed(:language => I18n.locale, :schema_date => 2009,
|
||||
:id => url_for(@params.merge(:only_path => false)),
|
||||
:root_url => url_for(@params.merge(:action => :index, :format => nil, :only_path => false)),
|
||||
"xmlns:georss" => "http://www.georss.org/georss") do |feed|
|
||||
feed.title changeset_index_title(params, current_user)
|
||||
|
||||
feed.updated @edits.map { |e| [e.created_at, e.closed_at].max }.max
|
||||
feed.icon image_url("favicon.ico")
|
||||
feed.logo image_url("mag_map-rss2.0.png")
|
||||
|
||||
feed.rights :type => "xhtml" do |xhtml|
|
||||
xhtml.a :href => "https://creativecommons.org/licenses/by-sa/2.0/" do |a|
|
||||
a.img :src => image_url("cc_button.png"), :alt => "CC by-sa 2.0"
|
||||
end
|
||||
end
|
||||
|
||||
@edits.each do |changeset|
|
||||
feed.entry(changeset, :updated => changeset.closed_at, :id => changeset_url(changeset.id, :only_path => false)) do |entry|
|
||||
entry.link :rel => "alternate",
|
||||
:href => changeset_read_url(changeset, :only_path => false),
|
||||
:type => "application/osm+xml"
|
||||
entry.link :rel => "alternate",
|
||||
:href => changeset_download_url(changeset, :only_path => false),
|
||||
:type => "application/osmChange+xml"
|
||||
|
||||
if !changeset.tags.empty? && changeset.tags.key?("comment")
|
||||
entry.title t("browse.changeset.feed.title_comment", :id => h(changeset.id), :comment => h(changeset.tags["comment"])), :type => "html"
|
||||
else
|
||||
entry.title t("browse.changeset.feed.title", :id => h(changeset.id))
|
||||
end
|
||||
|
||||
if changeset.user.data_public?
|
||||
entry.author do |author|
|
||||
author.name changeset.user.display_name
|
||||
author.uri user_url(changeset.user, :only_path => false)
|
||||
end
|
||||
end
|
||||
|
||||
feed.content :type => "xhtml" do |xhtml|
|
||||
xhtml.style "th { text-align: left } tr { vertical-align: top }"
|
||||
xhtml.table do |table|
|
||||
table.tr do |tr|
|
||||
tr.th t("browse.created")
|
||||
tr.td l(changeset.created_at)
|
||||
end
|
||||
table.tr do |tr|
|
||||
tr.th t("browse.closed")
|
||||
tr.td l(changeset.closed_at)
|
||||
end
|
||||
if changeset.user.data_public?
|
||||
table.tr do |tr|
|
||||
tr.th t("browse.changeset.belongs_to")
|
||||
tr.td do |td|
|
||||
td.a h(changeset.user.display_name), :href => user_url(changeset.user, :only_path => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
unless changeset.tags.empty?
|
||||
table.tr do |tr|
|
||||
tr.th t("browse.tag_details.tags")
|
||||
tr.td do |td|
|
||||
td.table :cellpadding => "0" do |tag_table|
|
||||
changeset.tags.sort.each do |tag|
|
||||
tag_table.tr do |tag_tr|
|
||||
tag_tr.td << "#{h(tag[0])} = #{linkify(h(tag[1]))}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if changeset.has_valid_bbox?
|
||||
bbox = changeset.bbox.to_unscaled
|
||||
|
||||
# See http://georss.org/Encodings#Geometry
|
||||
lower_corner = "#{bbox.min_lat} #{bbox.min_lon}"
|
||||
upper_corner = "#{bbox.max_lat} #{bbox.max_lon}"
|
||||
|
||||
feed.georss :box, lower_corner + " " + upper_corner
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
17
app/views/changesets/index.html.erb
Normal file
17
app/views/changesets/index.html.erb
Normal file
|
@ -0,0 +1,17 @@
|
|||
<% if @edits.present? %>
|
||||
<ol class="changesets">
|
||||
<%= render :partial => 'changeset', :collection => @edits %>
|
||||
</ol>
|
||||
<% if @edits.size == 20 -%>
|
||||
<div class="changeset_more">
|
||||
<%= link_to t('.load_more'), url_for(@params.merge(:max_id => @edits.last.id - 1)), :class => "button load_more" %>
|
||||
<div class="loader"><%= image_tag "searching.gif" %></div>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% elsif params[:bbox] %>
|
||||
<div class="inner22"><%= t(params[:max_id] ? '.no_more_area' : '.empty_area') %></div>
|
||||
<% elsif params[:display_name] %>
|
||||
<div class="inner22"><%= t(params[:max_id] ? '.no_more_user' : '.empty_user') %></div>
|
||||
<% else %>
|
||||
<div class="inner22"><%= t(params[:max_id] ? '.no_more' : '.empty') %></div>
|
||||
<% end %>
|
12
app/views/changesets/timeout.atom.builder
Normal file
12
app/views/changesets/timeout.atom.builder
Normal file
|
@ -0,0 +1,12 @@
|
|||
atom_feed(:language => I18n.locale, :schema_date => 2009,
|
||||
:id => url_for(params.merge(:only_path => false)),
|
||||
:root_url => url_for(params.merge(:only_path => false, :format => nil)),
|
||||
"xmlns:georss" => "http://www.georss.org/georss") do |feed|
|
||||
feed.title @title
|
||||
|
||||
feed.subtitle :type => "xhtml" do |xhtml|
|
||||
xhtml.p do |p|
|
||||
p << t(".sorry")
|
||||
end
|
||||
end
|
||||
end
|
1
app/views/changesets/timeout.html.erb
Normal file
1
app/views/changesets/timeout.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<p><%= t '.sorry' %></p>
|
Loading…
Add table
Add a link
Reference in a new issue