]> git.openstreetmap.org Git - rails.git/commitdiff
Use badges for the trace visibility labels
authorAndy Allan <git@gravitystorm.co.uk>
Thu, 19 Dec 2019 18:18:00 +0000 (19:18 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 19 Dec 2019 18:18:00 +0000 (19:18 +0100)
Our green is currently just on the side of triggering black text,
hence the override to make it look consistent with the other badges.

app/assets/stylesheets/_bootstrap-custom.scss
app/assets/stylesheets/common.scss
app/views/traces/_trace.html.erb

index 0cbec1a2740d14262e2ff2e5d937ed5adc902d17..6bbaecbe480f40a8a03473f69d3ba28ae37af1ae 100644 (file)
@@ -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";
index 5db46be6823537121cc80902eac22fdff298b268..bd0b574e5ddc0516b3475bd211141b679dcc40f9 100644 (file)
@@ -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 */
index 9b377eb8148252bc5535c94467dd762f9ee4c825..8b754a591d35803eb2312378fa8d8897cc8f1d2d 100644 (file)
       ... <%= time_ago_in_words(trace.timestamp, :scope => :'datetime.distance_in_words_ago') %></span>
       <%= 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") } %>
-      <span class="trace_<%= trace.visibility %>"><%= t("." + trace.visibility) %></span>
+
+      <% badge_class = case trace.visibility
+                       when "public", "identifiable" then "success"
+                       else "danger"
+                       end %>
+      <span class="badge badge-<%= badge_class %> text-white"><%= t("." + trace.visibility) %></span>
+
       <br />
       <%= trace.description %>
     <br />