]> git.openstreetmap.org Git - rails.git/commitdiff
Use bootstrap badges to implement count-number badges
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 30 Aug 2023 17:11:56 +0000 (18:11 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 30 Aug 2023 17:11:56 +0000 (18:11 +0100)
This leaves bootstrap to take care of most aspects, while retaining
the current colours and font weights.

app/assets/stylesheets/common.scss
app/helpers/issues_helper.rb
app/views/layouts/_header.html.erb
app/views/layouts/_inbox.html.erb
app/views/users/show.html.erb

index aa2c95a99b12a8dbdff083dfb7d6e205fd53c410..60a4bd59c331b94abaa4d737b039bc6c1f8708a3 100644 (file)
@@ -204,18 +204,7 @@ nav.secondary {
   }
 
   #inboxanchor {
-    display: inline-block;
-    height: 25px;
-    margin: 3px 0 3px 3px;
     background-color: lighten($grey, 10%);
-    line-height: 20px;
-    border-radius: 3;
-  }
-
-  .dropdown-menu {
-    .count-number {
-      font-size: 14px;
-    }
   }
 }
 
@@ -329,12 +318,9 @@ body.small-nav {
 /* Utility for styling notification numbers */
 
 .count-number {
-  padding: 2px $lineheight/4;
-  border-radius: 2px;
   background: lighten($green, 30%);
-  margin: 0 2px;
-  font-size: 11px;
-  color: #333;
+  color: $gray-800;
+  font-weight: $font-weight-normal;
 }
 
 /* Rules for the message shown in place of the map when javascript is disabled */
index dcec4990b0df077c13dd8cc6331fc7df85f9b2eb..7bc64cb83914d71fe4aa47fdbda94515c4c5e414 100644 (file)
@@ -28,9 +28,9 @@ module IssuesHelper
   def open_issues_count
     count = Issue.visible_to(current_user).open.limit(100).size
     if count > 99
-      tag.span("99+", :class => "count-number")
+      tag.span("99+", :class => "badge count-number")
     elsif count.positive?
-      tag.span(count, :class => "count-number")
+      tag.span(count, :class => "badge count-number")
     end
   end
 end
index a66715a759a285731dfe8b23763f8f2d6501eae2..fd2ae0a4a512b93bd95d32d7d46116a595828e26 100644 (file)
@@ -97,7 +97,7 @@
           <%= link_to t("users.show.my_dashboard"), dashboard_path, :class => "dropdown-item" %>
           <%= link_to inbox_messages_path, :class => "dropdown-item" do %>
             <%= t("users.show.my messages") %>
-            <span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
+            <span class='badge count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
           <% end %>
           <%= link_to t("users.show.my profile"), user_path(current_user), :class => "dropdown-item" %>
           <%= link_to t("users.show.my settings"), edit_account_path, :class => "dropdown-item" %>
index 79a1db2da4fa56f150b45e343e548bd3f501464e..2f5a63753b0bb7e249e9786576915059aaf3813b 100644 (file)
@@ -1,3 +1,3 @@
 <% if current_user.new_messages.size > 0 %>
-<span id="inboxanchor" class="count-number"><%= current_user.new_messages.size %></span>
+<span id="inboxanchor" class="badge count-number m-1"><%= current_user.new_messages.size %></span>
 <% end %>
index 81e33dddb87877070c5192f3b3f4b8bb97ca1ca0..6335b06d9895371bb4479105f5447495528c3992 100644 (file)
           <ul class='clearfix'>
             <li>
               <%= link_to t(".my edits"), :controller => "changesets", :action => "index", :display_name => current_user.display_name %>
-              <span class='count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
+              <span class='badge count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
             </li>
             <li>
               <%= link_to t(".my notes"), user_notes_path(@user) %>
             </li>
             <li>
               <%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
-              <span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
+              <span class='badge count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
             </li>
             <li>
               <%= link_to t(".my diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %>
-              <span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
+              <span class='badge count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
             </li>
             <li>
               <%= link_to t(".my comments"), diary_comments_path(current_user) %>
             <% if current_user.blocks.exists? %>
               <li>
                 <%= link_to t(".blocks on me"), user_blocks_on_path(current_user) %>
-                <span class='count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
+                <span class='badge count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
               </li>
             <% end %>
 
             <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
               <li>
                 <%= link_to t(".blocks by me"), user_blocks_by_path(current_user) %>
-                <span class='count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
+                <span class='badge count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
               </li>
             <% end %>
 
 
             <li>
               <%= link_to t(".edits"), :controller => "changesets", :action => "index", :display_name => @user.display_name %>
-              <span class='count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
+              <span class='badge count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
             </li>
             <li>
               <%= link_to t(".notes"), user_notes_path(@user) %>
             </li>
             <li>
               <%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
-              <span class='count-number'><%= number_with_delimiter(@user.traces.size) %></span>
+              <span class='badge count-number'><%= number_with_delimiter(@user.traces.size) %></span>
             </li>
 
             <!-- Displaying another user's profile page -->
@@ -72,7 +72,7 @@
             </li>
             <li>
               <%= link_to t(".diary"), :controller => "diary_entries", :action => "index", :display_name => @user.display_name %>
-              <span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
+              <span class='badge count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
             </li>
             <li>
               <%= link_to t(".comments"), diary_comments_path(@user) %>
             <% if @user.blocks.exists? %>
               <li>
                 <%= link_to t(".block_history"), user_blocks_on_path(@user) %>
-                <span class='count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
+                <span class='badge count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
               </li>
             <% end %>
 
             <% if @user.moderator? and @user.blocks_created.exists? %>
               <li>
                 <%= link_to t(".moderator_history"), user_blocks_by_path(@user) %>
-                <span class='count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
+                <span class='badge count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
               </li>
             <% end %>