Commit 92872b40 authored by Emma's avatar Emma 🦉

use help form option/accessible form descriptions

parent 868b8700
Pipeline #53406148 passed with stage
in 1 minute and 5 seconds
......@@ -28,11 +28,6 @@
}
}
&__help {
color: var(--text-muted);
font-size: 0.80rem;
}
&__markdown-help {
font-size: smaller;
text-align: right;
......
......@@ -3,6 +3,7 @@
flex-wrap: wrap;
padding-left: 1px;
padding-top: 1px;
width: 100%;
> * {
display: inline-block !important;
......
......@@ -7,4 +7,10 @@
// crappy hack
margin-top: -0.5rem;
}
.form-row + & {
// another crappy hack
margin-top: -0.5rem;
margin-bottom: 1rem;
}
}
......@@ -13,6 +13,7 @@ class ForumCategoryType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('name', TextType::class, [
'help' => 'help.will_appear_in_the_url',
'label' => 'label.name',
])
->add('title', TextType::class, [
......
......@@ -43,7 +43,9 @@ final class ForumType extends AbstractType {
$builder
->add('name', TextType::class)
->add('title', TextType::class)
->add('description', TextareaType::class)
->add('description', TextareaType::class, [
'help' => 'help.forum_description',
])
->add('sidebar', MarkdownType::class, [
'label' => 'label.sidebar',
])
......
......@@ -38,6 +38,7 @@ class ThemeCssType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('parent', TextType::class, [
'help' => 'help.parent_theme_input',
'invalid_message' => 'No such theme.',
'label' => 'label.parent_theme',
'required' => false,
......@@ -55,10 +56,12 @@ class ThemeCssType extends AbstractType {
'required' => false,
])
->add('appendToDefaultStyle', CheckboxType::class, [
'help' => 'help.append_to_default_style',
'required' => false,
'label' => 'label.append_to_default_style',
])
->add('comment', TextareaType::class, [
'help' => 'help.revision_summary',
'label' => 'label.comment',
'required' => false,
]);
......
......@@ -53,8 +53,11 @@ final class UserType extends AbstractType {
$editing = $builder->getData() && $builder->getData()->getEntityId();
$builder
->add('username', TextType::class)
->add('username', TextType::class, [
'help' => 'user.username_rules',
])
->add('password', RepeatedType::class, [
'help' => 'user.password_rules',
'property_path' => 'plainPassword',
'required' => !$editing,
'first_options' => ['label' => $editing ? 'user_form.new_password' : 'user_form.password'],
......@@ -62,6 +65,7 @@ final class UserType extends AbstractType {
'type' => PasswordType::class,
])
->add('email', EmailType::class, [
'help' => 'user.email_optional',
'required' => false,
]);
......
......@@ -35,17 +35,18 @@
</div>
{%- endblock button_row -%}
{% block checkbox_row -%}
{% block checkbox_row %}
{{- form_errors(form) -}}
<span class="form-row form-row--single-line form-row--no-collapse">
{{- form_widget(form) -}}
{{- form_label(form) -}}
</span>
{%- endblock checkbox_row %}
{{- form_help(form) -}}
{% endblock checkbox_row %}
{% block form_help -%}
{%- if help is not empty -%}
{%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' form-help')|trim}) -%}
{%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' form-help form__help')|trim}) -%}
<p id="{{ id }}_help"{% with { attr: help_attr } %}{{ block('attributes') }}{% endwith %}>
{%- if translation_domain is same as(false) -%}
{{- help -}}
......@@ -57,11 +58,15 @@
{%- endblock form_help %}
{%- block form_row -%}
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
{{- form_errors(form) -}}
<div class="form-row form__row">
{{- form_label(form) -}}
{{- form_widget(form) -}}
{{- form_widget(form, widget_attr ?? {}) -}}
</div>
{{- form_help(form) -}}
{%- endblock form_row -%}
{%- block form_errors -%}
......@@ -88,6 +93,7 @@
</p>
<div class="markdown-input__preview-container"></div>
</div>
{{- form_help(form) -}}
{%- endblock markdown_row -%}
{# labels #}
......@@ -182,3 +188,31 @@
{%- set attr = attr|merge({'style': 'display: none'}) -%}
{{- block('form_widget') -}}
{% endblock honeypot_widget %}
{# repeated form type #}
{% block repeated_errors %}
{{- form_errors(form.first) -}}
{% endblock repeated_errors %}
{% block repeated_label %}
{{- form_label(form.first) -}}
{% endblock repeated_label %}
{% block repeated_row %}
{{- block('form_row') -}}
{% endblock repeated_row %}
{%- block repeated_widget -%}
<div class="compound-form-widget">
{{- form_widget(form.first, { attr: attr|merge(form.first.vars.attr) }) -}}
{{- form_widget(form.second, { attr: attr|merge(form.second.vars.attr)|merge({
'placeholder': 'placeholder.repeat'|trans,
'aria-label': form.second.vars.label is defined
? form.second.vars.label|trans
: (form.second.vars.label_format is defined
? form.second.vars.label_format|replace({'%name%': name, '%id%': id})
: form.second.vars.name|humanize)
})}) -}}
</div>
{%- endblock repeated_widget -%}
......@@ -12,18 +12,16 @@
<input class="form-control" type="hidden" name="forum" value="{{ forum_path }}" />
{% endif %}
<div class="form__row">
<div class="form-row form__row">
<input class="form-control" type="text" name="query" placeholder="{{ 'label.search'|trans }}" />
</div>
<div class="form__help">
<p>
<strong>{{ 'help.search_external_prefix'|trans }}</strong>
{{ 'help.search_external_message'|trans }}
</p>
</div>
<div class="form__row form__button-row">
<p class="form-help form__help">
<strong>{{ 'help.search_external_prefix'|trans }}</strong>
{{ 'help.search_external_message'|trans }}
</p>
<div class="form-row form__row">
<button class="button" type="submit">
{{ 'action.search'|trans }}
</button>
......
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.title) }}
<div class="form__row">
{{ form_label(form.description) }}
{{ form_errors(form.description) }}
{{ form_widget(form.description) }}
<div class="form__help">
<p>{{ 'help.forum_description'|trans }}</p>
</div>
</div>
{{ form_row(form.description) }}
{{ form_row(form.sidebar, {attr: {rows: 8}}) }}
......
{{ form_start(form) }}
<div class="form__row">
{{ form_label(form.name) }}
{{ form_errors(form.name) }}
{{ form_widget(form.name) }}
<div class="form__help">
<p>{{ 'help.will_appear_in_the_url'|trans }}</p>
</div>
</div>
{{ form_row(form.name) }}
{{ form_row(form.title) }}
{{ form_row(form.description) }}
{{ form_row(form.sidebar, { attr: { rows: 8 } }) }}
<div class="form__row form__button-row">
......
{{ form_start(form) }}
<div class="form__row">
{{ form_label(form.parent) }}
{{ form_errors(form.parent) }}
{{ form_widget(form.parent) }}
<div class="form__help">
<p>{{ 'help.parent_theme_input'|trans }}</p>
</div>
</div>
{{ form_row(form.parent) }}
{{ form_row(form.commonCss, { attr: { rows: 12 } }) }}
{{ form_row(form.dayCss, { attr: { rows: 12 } }) }}
{{ form_row(form.nightCss, { attr: { rows: 12 } }) }}
<div class="form__row">
{{ form_label(form.comment) }}
{{ form_errors(form.comment) }}
{{ form_widget(form.comment) }}
<div class="form__help">
<p>{{ 'help.revision_summary'|trans }}</p>
</div>
</div>
<div class="form__row">
{{ form_label(form.appendToDefaultStyle) }}
{{ form_errors(form.appendToDefaultStyle) }}
{{ form_widget(form.appendToDefaultStyle) }}
<div class="form__help">
<p>{{ 'help.append_to_default_style'|trans }}</p>
<p>{{ 'help.append_to_default_style_inheritance_warning'|trans }}</p>
</div>
</div>
{{ form_row(form.comment) }}
{{ form_row(form.appendToDefaultStyle) }}
<div class="form__row form__button-row">
<button class="button">{{ 'action.edit_theme'|trans }}</button>
......
{{ form_start(form) }}
<div class="form__row">
{{ form_errors(form.username) }}
{{ form_label(form.username) }}
{{ form_widget(form.username) }}
{{ form_row(form.username) }}
<div class="form__help">
<p>{{ 'user.username_rules'|trans }}</p>
</div>
</div>
<div class="form__row">
{{ form_errors(form.password.first) }}
{{ form_label(form.password.first) }}
{{ form_widget(form.password.first) }}
<div class="form__help">
<p>{{ 'user.password_rules'|trans }}</p>
</div>
</div>
{{ form_row(form.password) }}
{{ form_row(form.password.second) }}
<div class="form__row">
{{ form_errors(form.email) }}
{{ form_label(form.email) }}
{{ form_widget(form.email) }}
<div class="form__help">
<p>{{ 'user.email_optional'|trans }}</p>
</div>
</div>
{{ form_row(form.email) }}
{% if form.verification is defined %}
<div class="form__row">
......
......@@ -178,8 +178,7 @@ help:
block_users: Ο αποκλεισμός χρηστών τους εμποδίζει να σας στέλνουν προσωπικά μηνύματα και δεν θα λαμβάνετε ειδοποιήσεις όταν σας απαντούν.
revision_summary: Εισαγάγετε μια σύνοψη των αλλαγών σας.
parent_theme_input: Καταχωρίστε το <όνομα χρήστη> / <φύλλο στυλ> του θέματος που θέλετε να επεκτείνετε. Εναλλακτικά, μπορείτε να εισαγάγετε ένα UUID για να επεκτείνετε μια συγκεκριμένη αναθεώρηση.
append_to_default_style_inheritance_warning: Η ρύθμιση αυτή δεν επηρεάζει την επέκταση ενός υπάρχοντος φύλλου στυλ.
append_to_default_style: Αφήστε αυτό το στοιχείο εκτός εάν το CSS σας παρέχει ένα πλήρες φύλλο στυλ για ολόκληρη την ιστοσελίδα.
append_to_default_style: Αφήστε αυτό το στοιχείο εκτός εάν το CSS σας παρέχει ένα πλήρες φύλλο στυλ για ολόκληρη την ιστοσελίδα. Η ρύθμιση αυτή δεν επηρεάζει την επέκταση ενός υπάρχοντος φύλλου στυλ.
inbox:
message_reply_head: 'Re: %τίτλος%'
......
......@@ -204,11 +204,10 @@ heading:
help:
delete_forum_warning: All content on this forum will be irreversibly deleted!
forum_description: A short description of the forum. Search engines will present this description in their results.
append_to_default_style: Leave this checked unless your CSS provides a complete stylesheet for the entire site.
append_to_default_style: Leave this checked unless your CSS provides a complete stylesheet for the entire site. Setting this has no effect when extending an existing theme.
block_users: Blocking users prevents them from sending you private messages, and you won't receive notifications when they reply to you.
revision_summary: Enter a summary of your changes.
parent_theme_input: Enter the <username>/<theme> of the theme you wish to extend. Alternatively, you can enter a UUID to extend a particular revision.
append_to_default_style_inheritance_warning: Setting this has no effect when extending an existing theme.
will_appear_in_the_url: Will appear in the URL.
search_external_prefix: Please note:
search_external_message: Your query will be redirected to DuckDuckGo.
......@@ -396,8 +395,9 @@ nav:
notifications_count: 'Notifications (%count%)'
placeholder:
default: (default)
choose_one: Choose one…
default: (default)
repeat: (repeat)
prompt:
confirm_comment_delete: Are you sure you want to delete this comment?
......
......@@ -184,11 +184,10 @@ heading:
help:
delete_forum_warning: Ĉiu enhavo en ĉi tiu diskutejo senrevene estos forigita
forum_description: Mallonga priskrivo de la diskutejo. Retserĉiloj montros ĉi tiun priskrivon en siaj rezultoj
append_to_default_style: Lasu tion krom se via CSS disponigas kompletan stilfolion por la tuta ejo.
append_to_default_style: Lasu tion krom se via CSS disponigas kompletan stilfolion por la tuta ejo. Agordi ĉi tion ne efikas dum la plivastigado de eksistenta estoso.
block_users: Bloki uzantoj evitas, ke ili sendu al vi privatajn mesaĝojn, kaj vi ne ricevos avizojn, kiam ili respondos al vi.
revision_summary: Enigu resumon de via ŝanĝoj
parent_theme_input: Enigu la <uzantnomo>/<estoso> de la estoso vi volas plivastigi. Alternative vi povas enigi UUID, por plivastigi konkretan revizion.
append_to_default_style_inheritance_warning: Agordi ĉi tion ne efikas dum la plivastigado de eksistenta estoso.
will_appear_in_the_url: Ĝi aperos en la URL
inbox:
......
......@@ -189,11 +189,10 @@ heading:
help:
delete_forum_warning: ¡Todo el contenido de este foro será borrado irreversiblemente!
forum_description: Una descripción corta del foro. Los motores de búsqueda presentarán una descripción en sus resultados.
append_to_default_style: Deja esto marcado a no ser que tu CSS proporcione una hoja de estilo completa para el sitio entero.
append_to_default_style: Deja esto marcado a no ser que tu CSS proporcione una hoja de estilo completa para el sitio entero. Ajustar esto no tiene efecto cuando extiendes un tema existente.
block_users: Bloquear usuarias impide que te envíen mensajes privados, y no recibirás notificaciones cuando te respondan.
revision_summary: Introducir un resumen de tus cambios.
parent_theme_input: Introduce el <username>/<theme> del tema que deseas extender. Alternativamente, puedes introducir un UUID para extender una revisión particular.
append_to_default_style_inheritance_warning: Ajustar esto no tiene efecto cuando extiendes un tema existente.
will_appear_in_the_url: Aparecerá en la URL.
inbox:
......
......@@ -190,11 +190,10 @@ heading:
help:
delete_forum_warning: Tout le contenu de ce forum sera supprimé pour toujours!
forum_description: Une courte description du forum. Les moteurs de recherche afficheront cette description dans leurs résultats.
append_to_default_style: Laissez décoché sauf si votre CSS est une feuille de style complète visant le site tout entier.
append_to_default_style: Laissez décoché sauf si votre CSS est une feuille de style complète visant le site tout entier. Régler cela n'aura pas d'effet si un thème existant est étendu.
block_users: Bloquer un utilisateur l'empêche de vous envoyer des messages privés, et vous ne recevrez pas de notifications lorsqu'ils vous répondent.
revision_summary: Veuillez saisir un résumé de vos modifications.
parent_theme_input: Veuillez saisir l'<utilisateur>/<thème> du thème que vous voulez étendre. Vous pouvez également saisir un UUID pour étendre une modification particulière.
append_to_default_style_inheritance_warning: Régler cela n'aura pas d'effet si un thème existant est étendu.
will_appear_in_the_url: Apparaîtra dans l'URL.
search_external_prefix: Veuillez noter:
search_external_message: Votre requête sera redirigée vers DuckDuckGo.
......
......@@ -171,11 +171,10 @@ heading:
help:
delete_forum_warning: Todo o conteúdo deste fórum será apagado permanentemente!
forum_description: Uma curta descrição dp fórum. Motores de busca vão mostrar esta descrição nos resultados.
append_to_default_style: Deixe desmarcado a menos que seu CSS ofereça uma folha de estilo completa para o site inteiro.
append_to_default_style: Deixe desmarcado a menos que seu CSS ofereça uma folha de estilo completa para o site inteiro. Ativar isto não tem nehum efeito ao extender um tema existente.
block_users: Bloquear usuários impede que eles lhe enviem mensagens privadas, e você não receberá notificações quando eles lhe responderem.
revision_summary: Insira um sumário das suas alterações.
parent_theme_input: Insira o <username>/<theme> do tema que você quer extender. Ou então, insira uma UUID para extender uma revisão específica.
append_to_default_style_inheritance_warning: Ativar isto não tem nehum efeito ao extender um tema existente.
inbox:
message_reply_head: 'Re: %title%'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment