From 19b5a07bac7171aec5953f35a32f7ee5be3b581d Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Mon, 30 Dec 2024 23:26:48 +0200 Subject: [PATCH] Add 'Test mode' switch to the profile dropdown --- app/views/shared/_navbar.html.erb | 10 +++++ app/views/shared/_settings_nav.html.erb | 10 ++--- app/views/shared/_test_alert.html.erb | 2 +- app/views/shared/_test_mode_toggle.html.erb | 2 +- app/views/templates_code_modal/show.html.erb | 2 +- app/views/templates_preferences/show.html.erb | 2 +- app/views/testing_api_settings/index.html.erb | 2 +- config/locales/i18n.yml | 42 +++++++++++-------- 8 files changed, 44 insertions(+), 28 deletions(-) diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index 98acc80e..aef418a1 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -49,6 +49,16 @@ <% end %> <% end %> + <% if (can?(:manage, EncryptedConfig) && current_user == true_user) || (current_user != true_user && current_account.testing?) %> + <%= form_for '', url: testing_account_path, method: current_account.testing? ? :delete : :get, html: { class: 'w-full py-1' } do |f| %> + + <% end %> + <% end %>
  • <%= button_to destroy_user_session_path, method: :delete, data: { turbo: false }, class: 'flex items-center' do %> <%= svg_icon('logout', class: 'w-5 h-5 flex-shrink-0 stroke-2 mr-2 inline') %> diff --git a/app/views/shared/_settings_nav.html.erb b/app/views/shared/_settings_nav.html.erb index 892e65f0..f052113c 100644 --- a/app/views/shared/_settings_nav.html.erb +++ b/app/views/shared/_settings_nav.html.erb @@ -90,16 +90,16 @@ <% end %> <%= render 'shared/settings_nav_extra2' %> <% if (can?(:manage, EncryptedConfig) && current_user == true_user) || (current_user != true_user && current_account.testing?) %> -
  • - <%= form_for '', url: testing_account_path, method: current_account.testing? ? :delete : :get, html: { class: 'flex w-full' } do |f| %> + <%= form_for '', url: testing_account_path, method: current_account.testing? ? :delete : :get, html: { class: 'w-full' } do |f| %> +
  • - <% end %> -
  • + + <% end %> <% end %> <% end %> diff --git a/app/views/shared/_test_alert.html.erb b/app/views/shared/_test_alert.html.erb index a7dcbd31..96dd27b3 100644 --- a/app/views/shared/_test_alert.html.erb +++ b/app/views/shared/_test_alert.html.erb @@ -2,7 +2,7 @@