From 954c5334efd922f21e98eb4b36494d7449413856 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 13 Sep 2023 09:56:25 +0200 Subject: [PATCH] use new procedure in view --- .../api_token_component/api_token_component.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/components/profile/api_token_component/api_token_component.html.haml b/app/components/profile/api_token_component/api_token_component.html.haml index 364ddfa8e..d187510a0 100644 --- a/app/components/profile/api_token_component/api_token_component.html.haml +++ b/app/components/profile/api_token_component/api_token_component.html.haml @@ -27,13 +27,13 @@ = t('.allowed_full_access_html') - else %p.fr-text--lg - = t('.allowed_procedures_html', count: @api_token.allowed_procedures.size) + = t('.allowed_procedures_html', count: @api_token.procedures.size) - if @api_token.procedures.empty? = button_to t('.action_all'), @api_token, method: :patch, params: { api_token: { become_full_access: '1' } }, class: "fr-btn fr-btn--secondary" - else %ul - - @api_token.allowed_procedures.each do |procedure| + - @api_token.procedures.each do |procedure| %li.flex.justify-between.align-center .truncate-80 = "#{procedure.id} – #{procedure.libelle}" @@ -43,8 +43,9 @@ = form_for @api_token, namespace: dom_id(@api_token, :allowed_procedures), html: { class: 'mb-3', data: { turbo: true } } do |f| = f.label :allowed_procedure_ids, class: 'fr-label' do = t('.action_choice') - - @api_token.allowed_procedures.each do |procedure| - = f.hidden_field :allowed_procedure_ids, value: procedure.id, multiple: true, id: dom_id(procedure, :allowed_procedure) + - if !@api_token.full_access? + - @api_token.procedures.each do |procedure| + = f.hidden_field :allowed_procedure_ids, value: procedure.id, multiple: true, id: dom_id(procedure, :allowed_procedure) .flex.justify-between.align-center{ 'data-turbo-force': :server } = f.select :allowed_procedure_ids, procedures_to_allow_options, {prompt: t('.prompt_choose_procedure')}, { class: 'fr-select ', name: "api_token[allowed_procedure_ids][]" } = f.button type: :submit, class: "fr-btn fr-btn--secondary" do