From 9479d56262ca5ab4e85e9c98ad1234bdadf601df Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 17 Aug 2024 13:41:30 +0300 Subject: [PATCH 1/1] Add navigation tabs to new block pages --- app/views/user_blocks/_navigation.html.erb | 8 +++++++- app/views/user_blocks/new.html.erb | 5 ++++- config/locales/en.yml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/views/user_blocks/_navigation.html.erb b/app/views/user_blocks/_navigation.html.erb index f4f9b04f8..061989586 100644 --- a/app/views/user_blocks/_navigation.html.erb +++ b/app/views/user_blocks/_navigation.html.erb @@ -34,11 +34,17 @@ :class => ["nav-link", { :active => action_name == "blocks_by" }] %> <% end %> - <% if @user_block %> + <% if @user_block&.persisted? %> + <% elsif @user_block&.new_record? %> + <% end %> diff --git a/app/views/user_blocks/new.html.erb b/app/views/user_blocks/new.html.erb index 3de6aa539..14eaff2b9 100644 --- a/app/views/user_blocks/new.html.erb +++ b/app/views/user_blocks/new.html.erb @@ -1,7 +1,11 @@ <% @title = t ".title", :name => @user.display_name %> + +<% content_for :heading_class, "pb-0" %> <% content_for :heading do %>

<%= t(".heading_html", :name => link_to(@user.display_name, @user)) %>

+ <%= render :partial => "navigation" %> <% end %> + <%= bootstrap_form_for(@user_block) do |f| %> <%= hidden_field_tag "display_name", @user.display_name, :autocomplete => "off" %> <%= f.richtext_field :reason, :cols => 80, :rows => 20 %> @@ -18,5 +22,4 @@ <% end %> <%= f.primary %> - <%= link_to t(".back"), user_blocks_path, :class => "btn btn-link" %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index a97eca9c0..30721562a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2936,7 +2936,6 @@ en: title: "Creating block on %{name}" heading_html: "Creating block on %{name}" period: "How long, starting now, the user will be blocked from the API for." - back: "View all blocks" edit: title: "Editing block on %{name}" heading_html: "Editing block on %{name}" @@ -3034,6 +3033,7 @@ en: blocks_by_me: "Blocks by Me" blocks_by_user: "Blocks by %{user}" block: "Block #%{id}" + new_block: "New Block" user_mutes: index: title: "Muted Users" -- 2.39.5