Add 'Test mode' switch to the profile dropdown

This commit is contained in:
Alex Turchyn
2024-12-30 23:26:48 +02:00
committed by Pete Matsyburka
parent 616aced4e4
commit 19b5a07bac
8 changed files with 44 additions and 28 deletions
+10
View File
@@ -49,6 +49,16 @@
<% end %>
</li>
<% 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| %>
<label class="flex items-center pl-6 pr-4 py-2 border-y border-base-300 -ml-2 -mr-2" for="testing_toggle">
<%= f.check_box :testing_toggle, class: 'toggle mr-2', checked: current_account.testing?, onchange: 'this.form.requestSubmit()', style: 'height: 0.875rem; width: 1.25rem; --handleoffset: 0.275rem;' %>
<span class="whitespace-nowrap">
<%= t('test_mode') %>
</span>
</label>
<% end %>
<% end %>
<li>
<%= 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') %>