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') %>
+5 -5
View File
@@ -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?) %>
<li>
<%= 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| %>
<li>
<label class="flex items-center text-base hover:bg-base-300 w-full justify-between" for="testing_toggle">
<span class="mr-2 w-full">
<%= t('test_environment') %>
<%= t('test_mode') %>
</span>
<%= f.check_box :testing_toggle, class: 'toggle toggle-sm', checked: current_account.testing?, onchange: 'this.form.requestSubmit()' %>
</label>
<% end %>
</li>
</li>
<% end %>
<% end %>
<% end %>
</ul>
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="hidden md:flex alert py-1 text-sm font-medium gap-x-2 whitespace-nowrap">
<a href="<%= testing_api_settings_path %>" data-turbo-frame="modal" class="link font-semibold flex">
<%= svg_icon('code_circle', class: 'w-5 h-5 mr-1') %>
<span><%= t('testing_environment') %></span>
<span><%= t('test_mode') %></span>
</a>
<span>
|
+1 -1
View File
@@ -2,7 +2,7 @@
<%= form_for '', url: testing_account_path, method: current_account.testing? ? :delete : :get, html: { class: 'flex' } do |f| %>
<label class="flex items-center justify-between" for="testing_toggle">
<span class="mr-2 text-lg">
<%= t('test_environment') %>
<%= t('test_mode') %>
</span>
<%= f.check_box :testing_toggle, class: 'toggle', checked: current_account.testing?, onchange: 'this.form.requestSubmit()' %>
</label>
+1 -1
View File
@@ -23,7 +23,7 @@
<%= f.hidden_field :template_id, value: @template.id %>
<div class="flex items-center justify-between">
<span>
<%= t('share_template_with_test_environment') %>
<%= t('share_template_with_test_mode') %>
</span>
<%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: current_account.testing_accounts), onchange: 'this.form.requestSubmit()' %>
</div>
@@ -308,7 +308,7 @@
<%= f.hidden_field :template_id, value: @template.id %>
<div class="flex items-center justify-between">
<span>
<%= t('share_template_with_test_environment') %>
<%= t('share_template_with_test_mode') %>
</span>
<%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: current_account.testing_accounts), onchange: 'this.form.requestSubmit()' %>
</div>
@@ -1,4 +1,4 @@
<%= render 'shared/turbo_modal', title: t('testing_environment') do %>
<%= render 'shared/turbo_modal', title: t('test_mode') do %>
<div>
<label class="text-sm font-semibold" for="api_key">
x-Auth-Token