From 52cd62bf1309a91813b8dfccaf5f7ce9859007f1 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 17 Nov 2021 17:33:14 +0000 Subject: [PATCH] Replace CSS-driven borders with bootstrap borders This makes future refactoring easier, since the elements will retain their borders even if the hierarchy changes. Also round some maps and the legale section since I think those now look nicer. --- app/assets/stylesheets/common.scss | 25 ++++++++++--------------- app/helpers/user_helper.rb | 6 +++--- app/views/browse/_paging_nav.html.erb | 2 +- app/views/browse/_tag_details.html.erb | 2 +- app/views/dashboards/show.html.erb | 4 ++-- app/views/diary_entries/_form.html.erb | 2 +- app/views/profiles/edit.html.erb | 2 +- app/views/site/export.html.erb | 2 +- app/views/users/terms.html.erb | 2 +- test/helpers/user_helper_test.rb | 12 ++++++------ 10 files changed, 27 insertions(+), 32 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 58642dd55..b0016a3fb 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -79,6 +79,16 @@ a { color: $blue; } +/* Rules for borders */ +/* These add additional colours to those provided by bootstrap */ +.border-grey { + border-color: $grey !important; +} + +.border-lightgrey { + border-color: $lightgrey !important; +} + /* Rules for the header */ #menu-icon { @@ -802,11 +812,6 @@ tr.turn:hover { border-bottom: none; } - .paginate { - border: 1px solid $lightgrey; - border-radius: 3px; - } - .browse-field { margin-bottom: 10px; @@ -830,8 +835,6 @@ tr.turn:hover { .browse-tag-list { background-color: $offwhite; - border: 1px solid $grey; - border-radius: 3px; table-layout: fixed; border-collapse: separate; border-spacing: 0; @@ -954,8 +957,6 @@ tr.turn:hover { .export_boxy { background: $lightgrey; - border: 1px solid $grey; - border-radius: 3px; #maxlat { margin-top: -1px; } #minlon { @@ -1063,7 +1064,6 @@ tr.turn:hover { .content_map { height: 200px; - border: 1px solid $grey; margin-bottom: $lineheight; } @@ -1132,7 +1132,6 @@ tr.turn:hover { .diary_entries { #map { height: 400px; - border: 1px solid $grey; display: none; margin-bottom: $lineheight; } @@ -1180,7 +1179,6 @@ tr.turn:hover { .users-terms { .legale { - border: 1px solid $grey; padding: $lineheight; margin-bottom: $lineheight; overflow: auto; @@ -1378,13 +1376,11 @@ tr.turn:hover { img.user_image { max-width: 100px; max-height: 100px; - border: 1px solid $grey; } img.user_thumbnail { max-width: 50px; max-height: 50px; - border: 1px solid $grey; } img.user_thumbnail_tiny { @@ -1392,7 +1388,6 @@ img.user_thumbnail_tiny { height: auto; max-width: 25px; max-height: 25px; - border: 1px solid $grey; } /* Rules for geo microformats */ diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb index eed55cd9d..a6161fa43 100644 --- a/app/helpers/user_helper.rb +++ b/app/helpers/user_helper.rb @@ -2,7 +2,7 @@ module UserHelper # User images def user_image(user, options = {}) - options[:class] ||= "user_image" + options[:class] ||= "user_image border border-grey" options[:alt] ||= "" if user.image_use_gravatar @@ -15,7 +15,7 @@ module UserHelper end def user_thumbnail(user, options = {}) - options[:class] ||= "user_thumbnail" + options[:class] ||= "user_thumbnail border border-grey" options[:alt] ||= "" if user.image_use_gravatar @@ -28,7 +28,7 @@ module UserHelper end def user_thumbnail_tiny(user, options = {}) - options[:class] ||= "user_thumbnail_tiny" + options[:class] ||= "user_thumbnail_tiny border border-grey" options[:alt] ||= "" if user.image_use_gravatar diff --git a/app/views/browse/_paging_nav.html.erb b/app/views/browse/_paging_nav.html.erb index 713a1d6d4..e13b1a9b8 100644 --- a/app/views/browse/_paging_nav.html.erb +++ b/app/views/browse/_paging_nav.html.erb @@ -5,7 +5,7 @@ <% if pages.page_count > 1 %>

- + <%= raw pagination_links_each(pages, {}) { |n| link_to(n, page_param => n) } %>

diff --git a/app/views/browse/_tag_details.html.erb b/app/views/browse/_tag_details.html.erb index 0e1a3fbef..0868bb8e5 100644 --- a/app/views/browse/_tag_details.html.erb +++ b/app/views/browse/_tag_details.html.erb @@ -1,6 +1,6 @@ <% unless tag_details.empty? %>

<%= t ".tags" %>

- +
<%= render :partial => "tag", :collection => tag_details.sort %>
<% end %> diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb index 0f04dafb9..d0344ce79 100644 --- a/app/views/dashboards/show.html.erb +++ b/app/views/dashboards/show.html.erb @@ -6,7 +6,7 @@ <% if current_user and @user.id == current_user.id %>
<% if @user.home_lat.nil? or @user.home_lon.nil? %> -
+

<%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %>

<% else %> @@ -19,7 +19,7 @@ :icon => image_path("marker-red.png"), :description => render(:partial => "popup", :object => current_user, :locals => { :type => "your location" }) } %> - <%= tag.div "", :id => "map", :class => "content_map", :data => { :user => user_data } %> + <%= tag.div "", :id => "map", :class => "content_map border border-grey rounded", :data => { :user => user_data } %> <% end %> <% friends = @user.friends %> diff --git a/app/views/diary_entries/_form.html.erb b/app/views/diary_entries/_form.html.erb index ed7164e88..f72abc19e 100644 --- a/app/views/diary_entries/_form.html.erb +++ b/app/views/diary_entries/_form.html.erb @@ -5,7 +5,7 @@
<%= t ".location" -%> - <%= tag.div "", :id => "map", :data => { :lat => @lat, :lon => @lon, :zoom => @zoom } %> + <%= tag.div "", :id => "map", :class => "border border-grey rounded", :data => { :lat => @lat, :lon => @lon, :zoom => @zoom } %>
<%= f.text_field :latitude, :wrapper_class => "col-sm-4", :id => "latitude" %> diff --git a/app/views/profiles/edit.html.erb b/app/views/profiles/edit.html.erb index 8eca6f4f7..c57f98a04 100644 --- a/app/views/profiles/edit.html.erb +++ b/app/views/profiles/edit.html.erb @@ -53,7 +53,7 @@ checked="checked" <% end %> id="updatehome" />
- <%= tag.div "", :id => "map", :class => "content_map set_location" %> + <%= tag.div "", :id => "map", :class => "content_map set_location border border-grey rounded" %>
<%= f.primary t(".save") %> diff --git a/app/views/site/export.html.erb b/app/views/site/export.html.erb index e612ff1af..b3a3bd0e9 100644 --- a/app/views/site/export.html.erb +++ b/app/views/site/export.html.erb @@ -6,7 +6,7 @@ <%= hidden_field_tag "format", "osm", :autocomplete => "off" %>
-
+
<%= text_field_tag("maxlat", nil, :size => 10, :autocomplete => "off", :class => "export_bound form-control mx-auto") %>
<%= text_field_tag("minlon", nil, :size => 10, :autocomplete => "off", :class => "export_bound form-control") %> diff --git a/app/views/users/terms.html.erb b/app/views/users/terms.html.erb index 05cf62e3e..58bddaca5 100644 --- a/app/views/users/terms.html.erb +++ b/app/views/users/terms.html.erb @@ -30,7 +30,7 @@ <% end %>
-
+
<%= render :partial => "terms" %>
diff --git a/test/helpers/user_helper_test.rb b/test/helpers/user_helper_test.rb index 8cef4d2dc..11a47a195 100644 --- a/test/helpers/user_helper_test.rb +++ b/test/helpers/user_helper_test.rb @@ -8,12 +8,12 @@ class UserHelperTest < ActionView::TestCase gravatar_user = create(:user, :image_use_gravatar => true) image = user_image(user) - assert_match %r{^$}, image + assert_match %r{^$}, image image = user_image(user, :class => "foo") assert_match %r{^$}, image image = user_image(gravatar_user) - assert_match %r{^$}, image + assert_match %r{^$}, image image = user_image(gravatar_user, :class => "foo") assert_match %r{^$}, image @@ -24,13 +24,13 @@ class UserHelperTest < ActionView::TestCase gravatar_user = create(:user, :image_use_gravatar => true) image = user_thumbnail(user) - assert_match %r{^$}, image + assert_match %r{^$}, image image = user_thumbnail(user, :class => "foo") assert_match %r{^$}, image image = user_thumbnail(gravatar_user) - assert_match %r{^$}, image + assert_match %r{^$}, image image = user_thumbnail(gravatar_user, :class => "foo") assert_match %r{^$}, image @@ -41,13 +41,13 @@ class UserHelperTest < ActionView::TestCase gravatar_user = create(:user, :image_use_gravatar => true) image = user_thumbnail_tiny(user) - assert_match %r{^$}, image + assert_match %r{^$}, image image = user_thumbnail_tiny(user, :class => "foo") assert_match %r{^$}, image image = user_thumbnail_tiny(gravatar_user) - assert_match %r{^$}, image + assert_match %r{^$}, image image = user_thumbnail_tiny(gravatar_user, :class => "foo") assert_match %r{^$}, image -- 2.43.2