From: Tom Hughes Date: Tue, 7 May 2013 13:43:45 +0000 (+0100) Subject: Merge remote-tracking branch 'osmlab/id-editor-embed' X-Git-Tag: live~5137 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/1779347849622ade2abf4926a2db867d69f72033?hp=3ff23409d7cada988aa3ceb1f622047070ac2ae8 Merge remote-tracking branch 'osmlab/id-editor-embed' --- diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 284ec77e6..4c2b79403 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -18,6 +18,7 @@ //= require sidebar //= require richtext //= require resize +//= require geocoder function zoomPrecision(zoom) { var decimals = Math.pow(10, Math.floor(zoom/3)); diff --git a/app/assets/javascripts/geocoder.js b/app/assets/javascripts/geocoder.js new file mode 100644 index 000000000..0809bef78 --- /dev/null +++ b/app/assets/javascripts/geocoder.js @@ -0,0 +1,14 @@ +$(document).ready(function () { + $("body").on("click", ".search_more a", function (e) { + e.preventDefault(); + + var div = $(this).parents(".search_more"); + + div.find(".search_results_entry").hide(); + div.find(".search_searching").show(); + + $.get($(this).attr("href"), function(data) { + div.replaceWith(data); + }); + }); +}); diff --git a/app/assets/stylesheets/browse.css.scss b/app/assets/stylesheets/browse.css.scss index dd1bf30c2..14ea3b289 100644 --- a/app/assets/stylesheets/browse.css.scss +++ b/app/assets/stylesheets/browse.css.scss @@ -1,6 +1,14 @@ -.node { padding-left: 25px; } -.way { padding-left: 25px; } -.relation { padding-left: 25px; } +/* Make space for icons */ + +.node, .way, .relation { + padding-left: 25px; + + &:first-child { + margin-left: -25px; + } +} + +/* Deleted objects */ .deleted { text-decoration: line-through; } diff --git a/app/assets/stylesheets/common.css.scss b/app/assets/stylesheets/common.css.scss index d94f51114..49a784704 100644 --- a/app/assets/stylesheets/common.css.scss +++ b/app/assets/stylesheets/common.css.scss @@ -692,7 +692,12 @@ table { } .search_results_entry { - margin-bottom: 0 ; + margin-bottom: 0; + + .search_details { + display: block; + text-align: right; + } } .search_results_entry .search_searching { @@ -947,14 +952,13 @@ ul.results-list li { border-bottom: 1px solid #ccc; } margin: 0px; padding: 4px 6px; } - div { - clear: left; - } h4, p { margin-bottom: 5px; } - p, ul, .bbox { - margin-left: 33.3333%; + p, ul, .bbox, .geo { + display: inline-block; + vertical-align: top; + max-width: 65%; } ul p { margin-left: 0; @@ -962,7 +966,8 @@ ul.results-list li { border-bottom: 1px solid #ccc; } } h4 { width: 33.3333%; - float: left; + display: inline-block; + vertical-align: top; } } diff --git a/app/helpers/geocoder_helper.rb b/app/helpers/geocoder_helper.rb index 8f662bde7..c74cba28e 100644 --- a/app/helpers/geocoder_helper.rb +++ b/app/helpers/geocoder_helper.rb @@ -18,6 +18,12 @@ module GeocoderHelper html << link_to(result[:name], url, html_options) if result[:name] html << result[:suffix] if result[:suffix] + if result[:type] and result[:id] + html << content_tag(:small, :class => ["deemphasize", "search_details"]) do + link_to(t("browse.#{result[:type]}_history.view_details"), :controller => :browse, :action => result[:type], :id => result[:id]) + end + end + return raw(html) end diff --git a/app/views/browse/node_history.html.erb b/app/views/browse/node_history.html.erb index 61fc83492..e37f0e037 100644 --- a/app/views/browse/node_history.html.erb +++ b/app/views/browse/node_history.html.erb @@ -2,6 +2,10 @@ @name = printable_name @node @title = t('browse.node_history.node_history') + ' | ' + @name %> +<% content_for :head do %> +<%= stylesheet_link_tag 'browse' %> +<% end %> + <% content_for :heading do %>

<%= raw t'browse.node_history.node_history_title', :node_name => link_to(h(@name), :action => "node", :id => @node.id) %>

<% if @more_params %> -
+
- <%= link_to t('geocoder.results.more_results'), "#", :class => "button" %> + <%= link_to t('geocoder.results.more_results'), url_for(@more_params), :class => "button" %>
- <%= image_tag "searching.gif", :class => "search_searching" %> + <%= image_tag "searching.gif", :class => ["search_searching", "hidden"] %>
- <% end %> <% end %> diff --git a/app/views/notes/_comment.html.erb b/app/views/notes/_comment.html.erb index 4fe7b59d5..c0d6e17d3 100644 --- a/app/views/notes/_comment.html.erb +++ b/app/views/notes/_comment.html.erb @@ -1,8 +1,8 @@
<% if comment.author.nil? -%> -
<%= t "note.description.#{comment.event}_at", :when => friendly_date(comment.created_at) %>
+
<%= t "note.description.#{comment.event}_at_html", :when => friendly_date(comment.created_at) %>
<% else -%> -
<%= t "note.description.#{comment.event}_at_by", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %>
+
<%= t "note.description.#{comment.event}_at_by_html", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %>
<% end -%>
<%= comment.body %>
diff --git a/app/views/notes/feed.rss.builder b/app/views/notes/feed.rss.builder index f17be09cb..df35b70d3 100644 --- a/app/views/notes/feed.rss.builder +++ b/app/views/notes/feed.rss.builder @@ -25,7 +25,9 @@ xml.rss("version" => "2.0", xml.link url_for(:controller => "browse", :action => "note", :id => comment.note.id, :only_path => false) xml.guid url_for(:controller => "browse", :action => "note", :id => comment.note.id, :only_path => false) - xml.description render(:partial => "entry", :object => comment, :formats => [ :html ]) + xml.description do + xml.cdata! render(:partial => "entry", :object => comment, :formats => [ :html ]) + end if comment.author xml.author comment.author.display_name diff --git a/config/locales/en.yml b/config/locales/en.yml index 0186d446d..315cc4aa6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1996,14 +1996,14 @@ en: needs_view: "The user needs to log in before this block will be cleared." note: description: - opened_at: "Created %{when} ago" - opened_at_by: "Created %{when} ago by %{user}" - commented_at: "Updated %{when} ago" - commented_at_by: "Updated %{when} ago by %{user}" - closed_at: "Resolved %{when} ago" - closed_at_by: "Resolved %{when} ago by %{user}" - reopened_at: "Reactivated %{when} ago" - reopened_at_by: "Reactivated %{when} ago by %{user}" + opened_at_html: "Created %{when} ago" + opened_at_by_html: "Created %{when} ago by %{user}" + commented_at_html: "Updated %{when} ago" + commented_at_by_html: "Updated %{when} ago by %{user}" + closed_at_html: "Resolved %{when} ago" + closed_at_by_html: "Resolved %{when} ago by %{user}" + reopened_at_html: "Reactivated %{when} ago" + reopened_at_by_html: "Reactivated %{when} ago by %{user}" rss: title: "OpenStreetMap Notes" description_area: "A list of notes, reported, commented on or closed in your area [(%{min_lat}|%{min_lon}) -- (%{max_lat}|%{max_lon})]"