From 859892d1fdd79dd366d10a8d856cb15acb27e44d Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 28 Apr 2024 16:13:43 +0300 Subject: [PATCH] adjust template preferences --- app/views/templates/_title.html.erb | 2 +- app/views/templates_preferences/show.html.erb | 94 ++++++++++--------- 2 files changed, 51 insertions(+), 45 deletions(-) diff --git a/app/views/templates/_title.html.erb b/app/views/templates/_title.html.erb index 848dfecc..75f9de60 100644 --- a/app/views/templates/_title.html.erb +++ b/app/views/templates/_title.html.erb @@ -37,7 +37,7 @@ <% if !template.archived_at? %>
- <% if can?(:update, template) && (Docuseal.multitenant? || current_account.testing? || current_account.id == 1) %> + <% if can?(:update, template) %>
<%= link_to template_preferences_path(template), class: 'btn border border-base-200 bg-base-200 hover:bg-base-300 hover:border-base-300 btn-sm flex-1 hidden md:flex', data: { turbo_frame: :modal } do %> diff --git a/app/views/templates_preferences/show.html.erb b/app/views/templates_preferences/show.html.erb index 6df97354..a42ed0a2 100644 --- a/app/views/templates_preferences/show.html.erb +++ b/app/views/templates_preferences/show.html.erb @@ -1,17 +1,21 @@ <%= render 'shared/turbo_modal_large', title: 'Preferences', close_after_submit: false do %> - <% options = [['General', 'general'], ['API and Embedding', 'api']] %> - -
- <% options.each_with_index do |(label, value), index| %> - - <%= radio_button_tag 'option', value, value == 'general', class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %> - - - <% end %> -
-
+ <% show_api = Docuseal.multitenant? || current_account.testing? || !current_account.linked_account_account %> + <% options = [%w[General general]] %> + <% options << ['API and Embedding', 'api'] if show_api %> + <% if options.size > 1 %> + +
+ <% options.each_with_index do |(label, value), index| %> + + <%= radio_button_tag 'option', value, value == 'general', class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %> + + + <% end %> +
+
+ <% end %>
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' } do |f| %> @@ -62,39 +66,41 @@ <% end %> <%= render 'templates_code_modal/preferences' %>
-