From 58692d68d444cd87197b36d2d3e10bf856c83281 Mon Sep 17 00:00:00 2001 From: Uladzimir Tsykun Date: Wed, 17 May 2023 21:40:39 +0200 Subject: [PATCH] Fix display choice labels and api token --- src/Form/Type/ApiTokenType.php | 1 + templates/forms.html.twig | 2 +- templates/profile/show.html.twig | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Form/Type/ApiTokenType.php b/src/Form/Type/ApiTokenType.php index 3ea83cd0..9b41bebb 100644 --- a/src/Form/Type/ApiTokenType.php +++ b/src/Form/Type/ApiTokenType.php @@ -44,6 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('scores', ChoiceType::class, [ 'multiple' => true, 'expanded' => true, + 'attr' => ['with_value' => true], 'choices' => array_flip($this->getScores()) ]); diff --git a/templates/forms.html.twig b/templates/forms.html.twig index c6d81e0c..73a7091d 100644 --- a/templates/forms.html.twig +++ b/templates/forms.html.twig @@ -118,7 +118,7 @@ {%- for child in form %}
{{- form_widget(child) -}} - {{- form_label(child, null, {translation_domain: choice_translation_domain, with_value: true}) -}} + {{- form_label(child, null, {translation_domain: choice_translation_domain, with_value: attr['with_value'] is defined and attr['with_value']}) -}}
{% endfor -%} diff --git a/templates/profile/show.html.twig b/templates/profile/show.html.twig index ce263b72..9a5cfdda 100644 --- a/templates/profile/show.html.twig +++ b/templates/profile/show.html.twig @@ -17,10 +17,15 @@

You need to authenticate to access their Composer repository, for example to enter credentials run command:

+
composer config --global --auth http-basic.{{ app.request.getHttpHost() }} {{ user.userIdentifier }} {{ show_api_token(apiToken) }}
+

The storage can be done either globally in the COMPOSER_HOME/auth.json file

+ +

For continuous integration or deployment environments, you may use COMPOSER_AUTH environment variable

+
-composer config --global --auth http-basic.{{ app.request.getHttpHost() }} {{ user.userIdentifier }} {{ apiToken }}
-        
-

The storage can be done either globally in the COMPOSER_HOME/auth.json file


+COMPOSER_AUTH='{"http-basic": {"{{ app.request.getHttpHost() }}": {"username": "{{ user.userIdentifier }}", "password": "{{ show_api_token(user) }}"}}}' +
+ {%- endif %} {% if isMaintainer %}