demarches-normaliennes/app/views/administrateurs/api_tokens/edit.html.haml

76 lines
3.2 KiB
Text
Raw Normal View History

- content_for :title, "Modification du jeton d'API « #{@api_token.name} »"
= render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Tableau de bord', tableau_de_bord_helper_path],
[t('users.profil.show.profile'), profil_path],
["Jeton dAPI : #{@api_token.name}"]] }
.fr-container.fr-mt-2w
2024-01-30 09:56:36 +01:00
%turbo-frame#tokenUpdate
%h1 Modification du jeton d'API « #{@api_token.name} »
= form_with url: admin_api_token_path(@api_token), method: :patch, html: { class: 'fr-mt-2w' } do |f|
.fr-input-group
= f.label :name, class: 'fr-label' do
= t('name', scope: [:administrateurs, :api_tokens, :nom])
%span.fr-hint-text= t('name-hint', scope: [:administrateurs, :api_tokens, :nom])
.flex
= f.text_field :name,
class: 'fr-input width-33',
autocomplete: 'off',
autocapitalize: 'off',
autocorrect: 'off',
spellcheck: false,
required: true,
value: @api_token.name
%button.fr-btn.fr-btn--secondary.fr-ml-1w Renommer
= form_with url: admin_api_token_path(@api_token), method: :patch, html: { class: 'fr-mt-2w' } do |f|
.fr-input-group.fr-mb-4w{
class: class_names('fr-input-group--error': @invalid_network_message.present?) }
= f.label :name, class: 'fr-label' do
= @api_token.eternal? ? "Entrez au moins 1 réseau autorisé" : "Entrez les adresses ip autorisées"
%span.fr-hint-text adresses réseaux séparées par des espaces. ex: 176.31.79.200 192.168.33.0/24 2001:41d0:304:400::52f/128
.flex
= f.text_field :networks,
class: class_names('fr-input': true, 'fr-input--error': @invalid_network_message.present?),
autocomplete: 'off',
autocapitalize: 'off',
autocorrect: 'off',
spellcheck: false,
value: @api_token.authorized_networks_for_ui.gsub(/,/, ' ')
%button.fr-btn.fr-btn--secondary.fr-ml-1w Modifier
- if @invalid_network_message.present?
%p.fr-error-text= @invalid_network_message
2024-01-30 09:57:30 +01:00
= form_with url: admin_api_token_path(@api_token), method: :patch, html: { class: 'fr-mt-2w' } do |f|
.fr-mb-4w
- if @api_token.full_access?
%p Votre jeton d'API a accès à toutes vos démarches.
= hidden_field_tag :procedure_to_add, '[]'
%button.fr-btn.fr-btn--secondary.fr-btn--sm Restreindre l'accès à certaines les démarches
- else
.fr-select-group
%label.fr-label{ for: 'procedure_to_add' } Ajouter des démarches autorisées
.flex
= f.select :value,
options_for_select(@libelle_id_procedures),
{ include_blank: true },
{ class: 'fr-select width-33',
name: 'procedure_to_add'}
%button.fr-btn.fr-btn--secondary.fr-ml-1w Ajouter
%ul.fr-mb-4w
- @api_token.procedures.each do |procedure|
%li{ id: dom_id(procedure, :authorized) }
= procedure.libelle
2024-01-30 09:56:36 +01:00
%ul.fr-btns-group.fr-btns-group--inline
%li
= link_to 'Revenir', profil_path, class: "fr-btn fr-btn--secondary"