From d430cfb627fb8f329d29d2a12a20b5258e6ae57f Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 10 Feb 2024 18:33:08 +0300 Subject: [PATCH] Use svg icons in previous/next element version links --- app/helpers/svg_helper.rb | 2 +- app/views/old_nodes/show.html.erb | 10 ++++++++-- app/views/old_relations/show.html.erb | 10 ++++++++-- app/views/old_ways/show.html.erb | 10 ++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/helpers/svg_helper.rb b/app/helpers/svg_helper.rb index bc12ff223..ab9f890fe 100644 --- a/app/helpers/svg_helper.rb +++ b/app/helpers/svg_helper.rb @@ -41,7 +41,7 @@ module SvgHelper # returns "<" shape if side == -1; ">" if side == 1 def adjacent_page_svg_tag(side, **options) - height = 15 + height = options[:height] || 15 pad = 2 segment = (0.5 * height) - pad width = (segment + (2 * pad)).ceil diff --git a/app/views/old_nodes/show.html.erb b/app/views/old_nodes/show.html.erb index b69c29723..9220b2cc2 100644 --- a/app/views/old_nodes/show.html.erb +++ b/app/views/old_nodes/show.html.erb @@ -14,12 +14,18 @@
<% if @feature.version > 1 %> - <%= link_to "<< #{t('browse.version')} ##{@feature.version - 1}", old_node_path(@feature.node_id, @feature.version - 1) %> + <%= link_to old_node_path(@feature.node_id, @feature.version - 1), :class => "icon-link" do %> + <%= previous_page_svg_tag :height => 11 %> + <%= "#{t('browse.version')} ##{@feature.version - 1}" %> + <% end %> · <% end %> <%= link_to t("browse.view_history"), node_history_path(@feature.node_id) %> <% if @feature.version < @feature.current_node.version %> · - <%= link_to "#{t('browse.version')} ##{@feature.version + 1} >>", old_node_path(@feature.node_id, @feature.version + 1) %> + <%= link_to old_node_path(@feature.node_id, @feature.version + 1), :class => "icon-link" do %> + <%= "#{t('browse.version')} ##{@feature.version + 1}" %> + <%= next_page_svg_tag :height => 11 %> + <% end %> <% end %>
diff --git a/app/views/old_relations/show.html.erb b/app/views/old_relations/show.html.erb index 29d0b0079..b049a4cf0 100644 --- a/app/views/old_relations/show.html.erb +++ b/app/views/old_relations/show.html.erb @@ -14,12 +14,18 @@
<% if @feature.version > 1 %> - <%= link_to "<< #{t('browse.version')} ##{@feature.version - 1}", old_relation_path(@feature.relation_id, @feature.version - 1) %> + <%= link_to old_relation_path(@feature.relation_id, @feature.version - 1), :class => "icon-link" do %> + <%= previous_page_svg_tag :height => 11 %> + <%= "#{t('browse.version')} ##{@feature.version - 1}" %> + <% end %> · <% end %> <%= link_to t("browse.view_history"), relation_history_path(@feature.relation_id) %> <% if @feature.version < @feature.current_relation.version %> · - <%= link_to "#{t('browse.version')} ##{@feature.version + 1} >>", old_relation_path(@feature.relation_id, @feature.version + 1) %> + <%= link_to old_relation_path(@feature.relation_id, @feature.version + 1), :class => "icon-link" do %> + <%= "#{t('browse.version')} ##{@feature.version + 1}" %> + <%= next_page_svg_tag :height => 11 %> + <% end %> <% end %>
diff --git a/app/views/old_ways/show.html.erb b/app/views/old_ways/show.html.erb index e9976dd78..d128cd2ad 100644 --- a/app/views/old_ways/show.html.erb +++ b/app/views/old_ways/show.html.erb @@ -14,12 +14,18 @@
<% if @feature.version > 1 %> - <%= link_to "<< #{t('browse.version')} ##{@feature.version - 1}", old_way_path(@feature.way_id, @feature.version - 1) %> + <%= link_to old_way_path(@feature.way_id, @feature.version - 1), :class => "icon-link" do %> + <%= previous_page_svg_tag :height => 11 %> + <%= "#{t('browse.version')} ##{@feature.version - 1}" %> + <% end %> · <% end %> <%= link_to t("browse.view_history"), way_history_path(@feature.way_id) %> <% if @feature.version < @feature.current_way.version %> · - <%= link_to "#{t('browse.version')} ##{@feature.version + 1} >>", old_way_path(@feature.way_id, @feature.version + 1) %> + <%= link_to old_way_path(@feature.way_id, @feature.version + 1), :class => "icon-link" do %> + <%= "#{t('browse.version')} ##{@feature.version + 1}" %> + <%= next_page_svg_tag :height => 11 %> + <% end %> <% end %>
-- 2.39.5