From c233bec67b8e99ce5b476436181f9df6ca888814 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 15 Oct 2020 16:25:33 +0200 Subject: [PATCH] Use flexbox to position the close icon on the sidebars This ensures that the text and the close icon don't overlap, regardless of the length of the title. The title div grows to use all available space, while ensuring the text breaks if necessary to prevent it from pushing the close icon offscreen. --- app/views/application/_sidebar_header.html.erb | 10 ++++++++++ app/views/browse/changeset.html.erb | 5 +---- app/views/browse/feature.html.erb | 5 +---- app/views/browse/history.html.erb | 5 +---- app/views/browse/new_note.html.erb | 5 +---- app/views/browse/not_found.html.erb | 11 +++++++---- app/views/browse/note.html.erb | 5 +---- app/views/browse/query.html.erb | 5 +---- app/views/browse/timeout.html.erb | 7 +++++-- app/views/changesets/history.html.erb | 5 +---- app/views/geocoder/search.html.erb | 6 ++---- app/views/layouts/map.html.erb | 3 +-- app/views/site/export.html.erb | 5 +---- config/locales/en.yml | 14 ++++++++------ 14 files changed, 41 insertions(+), 50 deletions(-) create mode 100644 app/views/application/_sidebar_header.html.erb diff --git a/app/views/application/_sidebar_header.html.erb b/app/views/application/_sidebar_header.html.erb new file mode 100644 index 000000000..5413b4205 --- /dev/null +++ b/app/views/application/_sidebar_header.html.erb @@ -0,0 +1,10 @@ +
+
+

<%= title %>

+
+
+ + + +
+
diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index 1217c03be..3019fba95 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -1,9 +1,6 @@ <% set_title(t(".title", :id => @changeset.id)) %> -

- - <%= t(".title", :id => @changeset.id) %> -

+<%= render "sidebar_header", :title => t(".title", :id => @changeset.id) %>

diff --git a/app/views/browse/feature.html.erb b/app/views/browse/feature.html.erb index 75e54f0b2..c5c26330e 100644 --- a/app/views/browse/feature.html.erb +++ b/app/views/browse/feature.html.erb @@ -1,9 +1,6 @@ <% set_title(t("browse.#{@type}.title_html", :name => printable_name(@feature))) %> -

- - <%= t("browse.#{@type}.title_html", :name => printable_name(@feature)) %> -

+<%= render "sidebar_header", :title => t("browse.#{@type}.title_html", :name => printable_name(@feature)) %> <%= render :partial => @type, :object => @feature %> diff --git a/app/views/browse/history.html.erb b/app/views/browse/history.html.erb index faa88359e..ebf8bcb30 100644 --- a/app/views/browse/history.html.erb +++ b/app/views/browse/history.html.erb @@ -1,9 +1,6 @@ <% set_title(t("browse.#{@type}.history_title_html", :name => printable_name(@feature))) %> -

- - <%= t("browse.#{@type}.history_title_html", :name => printable_name(@feature)) %> -

+<%= render "sidebar_header", :title => t("browse.#{@type}.history_title_html", :name => printable_name(@feature)) %> <%= render :partial => @type, :collection => @feature.send("old_#{@type}s").reverse %> diff --git a/app/views/browse/new_note.html.erb b/app/views/browse/new_note.html.erb index 4e4f571cc..e647eab13 100644 --- a/app/views/browse/new_note.html.erb +++ b/app/views/browse/new_note.html.erb @@ -1,9 +1,6 @@ <% set_title(t("browse.note.new_note")) %> -

- - <%= t "browse.note.new_note" %> -

+<%= render "sidebar_header", :title => t("browse.note.new_note") %>

<%= t("javascripts.notes.new.intro") %>

diff --git a/app/views/browse/not_found.html.erb b/app/views/browse/not_found.html.erb index 3c4e8a4c8..084c247dc 100644 --- a/app/views/browse/not_found.html.erb +++ b/app/views/browse/not_found.html.erb @@ -1,4 +1,7 @@ -

- - <%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %> -

+<% set_title(t(".title")) %> + +<%= render "sidebar_header", :title => t(".title") %> + +
+

<%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %> +

diff --git a/app/views/browse/note.html.erb b/app/views/browse/note.html.erb index ab0344e35..f94fda12a 100644 --- a/app/views/browse/note.html.erb +++ b/app/views/browse/note.html.erb @@ -1,9 +1,6 @@ <% set_title(t(".title", :id => @note.id)) %> -

- - <%= t ".#{@note.status}_title", :note_name => @note.id %> -

+<%= render "sidebar_header", :title => t(".#{@note.status}_title", :note_name => @note.id) %>

<%= t(".description") %>

diff --git a/app/views/browse/query.html.erb b/app/views/browse/query.html.erb index ad6fdddb5..65231641c 100644 --- a/app/views/browse/query.html.erb +++ b/app/views/browse/query.html.erb @@ -1,9 +1,6 @@ <% set_title(t(".title")) %> -

- - <%= t ".title" %> -

+<%= render "sidebar_header", :title => t(".title") %>

<%= t(".introduction") %>

diff --git a/app/views/browse/timeout.html.erb b/app/views/browse/timeout.html.erb index a9f53db15..084c247dc 100644 --- a/app/views/browse/timeout.html.erb +++ b/app/views/browse/timeout.html.erb @@ -1,4 +1,7 @@ +<% set_title(t(".title")) %> + +<%= render "sidebar_header", :title => t(".title") %> +
- - <%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %> +

<%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %>

diff --git a/app/views/changesets/history.html.erb b/app/views/changesets/history.html.erb index e3df87490..f9eb01a6d 100644 --- a/app/views/changesets/history.html.erb +++ b/app/views/changesets/history.html.erb @@ -11,10 +11,7 @@ @title end %> -

- - <%= @heading %> -

+<%= render "sidebar_header", :title => @heading %>
<%= image_tag "searching.gif", :class => "loader" %> diff --git a/app/views/geocoder/search.html.erb b/app/views/geocoder/search.html.erb index 13144d568..9f19be48a 100644 --- a/app/views/geocoder/search.html.erb +++ b/app/views/geocoder/search.html.erb @@ -1,9 +1,7 @@ <% set_title(@params[:query]) %> -

- - <%= t("site.sidebar.search_results") %> -

+<%= render "sidebar_header", :title => t("site.sidebar.search_results") %> + <% @sources.each do |source| %>

<%= t(".title.#{source}_html") %>

"> diff --git a/app/views/layouts/map.html.erb b/app/views/layouts/map.html.erb index 1f8366ccb..33737ae23 100644 --- a/app/views/layouts/map.html.erb +++ b/app/views/layouts/map.html.erb @@ -40,8 +40,7 @@ <% unless current_user %>
-

<%= t "layouts.intro_header" %>

-
+ <%= render "sidebar_header", :title => t("layouts.intro_header") %>

<%= t "layouts.intro_text" %>

<%= t "layouts.hosting_partners_html", :ucl => link_to(t("layouts.partners_ucl"), "https://www.ucl.ac.uk"), diff --git a/app/views/site/export.html.erb b/app/views/site/export.html.erb index b6d91ca31..934b56a02 100644 --- a/app/views/site/export.html.erb +++ b/app/views/site/export.html.erb @@ -1,9 +1,6 @@ <% set_title(t(".title")) %> -

- - <%= t ".title" %> -

+<%= render "sidebar_header", :title => t(".title") %> <%= form_tag({ :controller => "export", :action => "finish" }, { :class => "export_form standard-form" }) do %> <%= hidden_field_tag "format", "osm" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ec08012fe..4caa13baf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -294,6 +294,7 @@ en: entry_html: "Relation %{relation_name}" entry_role_html: "Relation %{relation_name} (as %{relation_role})" not_found: + title: Not Found sorry: "Sorry, %{type} #%{id} could not be found." type: node: node @@ -302,6 +303,7 @@ en: changeset: changeset note: note timeout: + title: Timeout Error sorry: "Sorry, the data for the %{type} with the id %{id}, took too long to retrieve." type: node: node @@ -1639,7 +1641,7 @@ en: full legal code explains your rights and responsibilities. intro_3_1_html: | - Our documentation is licensed under the + Our documentation is licensed under the Creative Commons Attribution-ShareAlike 2.0 license (CC BY-SA 2.0). credit_title_html: How to credit OpenStreetMap @@ -1656,11 +1658,11 @@ en: direct your readers to openstreetmap.org (perhaps by expanding 'OpenStreetMap' to this full address) and to opendatacommons.org. credit_3_1_html: | - The map tiles in the “standard style” at www.openstreetmap.org are a - Produced Work by the OpenStreetMap Foundation using OpenStreetMap data - under the Open Database License. If you are using these tiles please use - the following attribution: - “Base map and data from OpenStreetMap and OpenStreetMap Foundation”. + The map tiles in the “standard style” at www.openstreetmap.org are a + Produced Work by the OpenStreetMap Foundation using OpenStreetMap data + under the Open Database License. If you are using these tiles please use + the following attribution: + “Base map and data from OpenStreetMap and OpenStreetMap Foundation”. credit_4_html: | For a browsable electronic map, the credit should appear in the corner of the map. For example: -- 2.43.2