]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4644'
authorTom Hughes <tom@compton.nu>
Sun, 7 Apr 2024 11:24:44 +0000 (12:24 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 7 Apr 2024 11:24:44 +0000 (12:24 +0100)
app/views/user_blocks/_navigation.html.erb [new file with mode: 0644]
app/views/user_blocks/blocks_by.html.erb
app/views/user_blocks/blocks_on.html.erb
app/views/user_blocks/index.html.erb
app/views/user_blocks/show.html.erb
config/locales/en.yml

diff --git a/app/views/user_blocks/_navigation.html.erb b/app/views/user_blocks/_navigation.html.erb
new file mode 100644 (file)
index 0000000..a84ba13
--- /dev/null
@@ -0,0 +1,37 @@
+<ul class="nav nav-tabs">
+  <li class="nav-item">
+    <%= link_to t(".all_blocks"),
+                user_blocks_path,
+                :class => ["nav-link", { :active => action_name == "index" }] %>
+  </li>
+  <% if current_user&.blocks&.exists? %>
+    <li class="nav-item">
+      <%= link_to t(".blocks_on_me"),
+                  user_blocks_on_path(current_user),
+                  :class => ["nav-link", { :active => action_name == "blocks_on" && current_user == @user }] %>
+    </li>
+  <% end %>
+  <% on_user = @user || @user_block&.user %>
+  <% if on_user != current_user && on_user&.blocks&.exists? %>
+    <li class="nav-item">
+      <%= link_to t(".blocks_on_user", :user => on_user.display_name),
+                  user_blocks_on_path(on_user),
+                  :class => ["nav-link", { :active => action_name == "blocks_on" }] %>
+    </li>
+  <% end %>
+  <% if current_user&.blocks_created&.exists? %>
+    <li class="nav-item">
+      <%= link_to t(".blocks_by_me"),
+                  user_blocks_by_path(current_user),
+                  :class => ["nav-link", { :active => action_name == "blocks_by" && current_user == @user }] %>
+    </li>
+  <% end %>
+  <% by_user = @user || @user_block&.creator %>
+  <% if by_user != current_user && by_user&.blocks_created&.exists? %>
+    <li class="nav-item">
+      <%= link_to t(".blocks_by_user", :user => by_user.display_name),
+                  user_blocks_by_path(by_user),
+                  :class => ["nav-link", { :active => action_name == "blocks_by" }] %>
+    </li>
+  <% end %>
+</ul>
index 87ff7f5b23a73a5c294aa587b907180783ea84a0..7fa0a4fbbae9f62b3ae69118eb479eb951fb3a59 100644 (file)
@@ -1,6 +1,9 @@
 <% @title = t(".title", :name => @user.display_name) %>
+
+<% content_for :heading_class, "pb-0" %>
 <% content_for :heading do %>
   <h1><%= t(".heading_html", :name => link_to(@user.display_name, @user)) %></h1>
+  <%= render :partial => "navigation" %>
 <% end %>
 
 <% unless @user_blocks.empty? %>
index ed03342dc73deed0014fc4516dd0df4baf28721f..0c15b8866d73d70e2e133153e4cbc2bb7416fd3e 100644 (file)
@@ -1,6 +1,9 @@
 <% @title = t(".title", :name => @user.display_name) %>
+
+<% content_for :heading_class, "pb-0" %>
 <% content_for :heading do %>
   <h1><%= t(".heading_html", :name => link_to(@user.display_name, @user)) %></h1>
+  <%= render :partial => "navigation" %>
 <% end %>
 
 <% unless @user_blocks.empty? %>
index 57cef6055992722523a71dc475feb718b6c1423a..4d200b516cd574b7f469ce4e17b2854a13d6b68e 100644 (file)
@@ -1,6 +1,9 @@
 <% @title = t(".title") %>
+
+<% content_for :heading_class, "pb-0" %>
 <% content_for :heading do %>
   <h1><%= t(".heading") %></h1>
+  <%= render :partial => "navigation" %>
 <% end %>
 
 <% unless @user_blocks.empty? %>
index 7e6566365f4794741c4acb3baf5abfca64671659..7b30d19202ee56c34b76868969af639de6045390 100644 (file)
@@ -2,15 +2,12 @@
               :block_on => @user_block.user.display_name,
               :block_by => @user_block.creator.display_name) %>
 
+<% content_for :heading_class, "pb-0" %>
 <% content_for :heading do %>
   <h1><%= t(".heading_html",
             :block_on => link_to(@user_block.user.display_name, @user_block.user),
             :block_by => link_to(@user_block.creator.display_name, @user_block.creator)) %></h1>
-  <nav class='secondary-actions'>
-    <ul class='clearfix'>
-      <li><%= link_to t(".back"), user_blocks_path %></li>
-    </ul>
-  </nav>
+  <%= render :partial => "navigation" %>
 <% end %>
 
 <dl class="row">
index 95edb8bb5e1227af782f115f6e8c370c54ca9ce4..0634fc2a0d1f52b1000462318c6bf42b0620d422 100644 (file)
@@ -2970,7 +2970,6 @@ en:
       revoke: "Revoke!"
       confirm: "Are you sure?"
       reason: "Reason for block:"
-      back: "View all blocks"
       revoker: "Revoker:"
       needs_view: "The user needs to log in before this block will be cleared."
     block:
@@ -2986,6 +2985,12 @@ en:
       revoker_name: "Revoked by"
       older: "Older Blocks"
       newer: "Newer Blocks"
+    navigation:
+      all_blocks: "All Blocks"
+      blocks_on_me: "Blocks on Me"
+      blocks_on_user: "Blocks on %{user}"
+      blocks_by_me: "Blocks by Me"
+      blocks_by_user: "Blocks by %{user}"
   user_mutes:
     index:
       title: "Muted Users"