From: Andy Allan Date: Thu, 19 Dec 2019 18:18:00 +0000 (+0100) Subject: Use badges for the trace visibility labels X-Git-Tag: live~3018^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/1586e2ba802e051f122d42fd8ad30aa3e6fdbf18?hp=a3e3be007efa55dd80bd056ba0b877f692003918 Use badges for the trace visibility labels Our green is currently just on the side of triggering black text, hence the override to make it look consistent with the other badges. --- diff --git a/app/assets/stylesheets/_bootstrap-custom.scss b/app/assets/stylesheets/_bootstrap-custom.scss index 0cbec1a27..6bbaecbe4 100644 --- a/app/assets/stylesheets/_bootstrap-custom.scss +++ b/app/assets/stylesheets/_bootstrap-custom.scss @@ -27,7 +27,7 @@ @import "bootstrap/card"; // @import "bootstrap/breadcrumb"; // @import "bootstrap/pagination"; -// @import "bootstrap/badge"; +@import "bootstrap/badge"; // @import "bootstrap/jumbotron"; // @import "bootstrap/alert"; // @import "bootstrap/progress"; diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 5db46be68..bd0b574e5 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1494,22 +1494,6 @@ tr.turn:hover { font-size: 12px; color: gray; } - - .trace_public { - color: green; - } - - .trace_identifiable { - color: green; - } - - .trace_trackable { - color: red; - } - - .trace_private { - color: red; - } } /* Rules for the trace view */ diff --git a/app/views/traces/_trace.html.erb b/app/views/traces/_trace.html.erb index 9b377eb81..8b754a591 100644 --- a/app/views/traces/_trace.html.erb +++ b/app/views/traces/_trace.html.erb @@ -17,7 +17,13 @@ ... <%= time_ago_in_words(trace.timestamp, :scope => :'datetime.distance_in_words_ago') %> <%= link_to_if trace.inserted?, t(".map"), { :controller => "site", :action => "index", :mlat => trace.latitude, :mlon => trace.longitude, :anchor => "map=14/#{trace.latitude}/#{trace.longitude}" }, { :title => t(".view_map") } %> / <%= link_to t(".edit"), { :controller => "site", :action => "edit", :gpx => trace.id }, { :title => t(".edit_map") } %> - <%= t("." + trace.visibility) %> + + <% badge_class = case trace.visibility + when "public", "identifiable" then "success" + else "danger" + end %> + <%= t("." + trace.visibility) %> +
<%= trace.description %>