demarches-normaliennes/app/components/profile/api_token_component.rb
simon lehericey 01efae960b fix component
2023-09-20 14:11:09 +02:00

16 lines
418 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class Profile::APITokenComponent < ApplicationComponent
def initialize(api_token:, packed_token: nil)
@api_token = api_token
@packed_token = packed_token
end
private
def procedures_to_allow_options
@api_token.targetable_procedures.map { ["#{_1.id} #{_1.libelle}", _1.id] }
end
def procedures_to_allow_select_options
{ selected: @api_token.targetable_procedures.first&.id }
end
end