mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Show legend for permission values.
This commit is contained in:
parent
35dd1fabc0
commit
e7a95926f6
2 changed files with 37 additions and 0 deletions
|
@ -35,6 +35,9 @@ namespace App\Form\Permissions;
|
|||
use App\Services\PermissionResolver;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PermissionsType extends AbstractType
|
||||
{
|
||||
|
@ -48,6 +51,18 @@ class PermissionsType extends AbstractType
|
|||
}
|
||||
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'show_legend' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['show_legend'] = $options['show_legend'];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$groups = $this->perm_structure['groups'];
|
||||
|
|
|
@ -47,6 +47,28 @@
|
|||
|
||||
{% block permissions_row %}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
{% if show_legend %}
|
||||
<div class="mb-2">
|
||||
<label><b>{% trans %}permission.legend.title{% endtrans %}:</b></label>
|
||||
<div>
|
||||
<div class="custom-control custom-control-inline custom-checkbox">
|
||||
<input type="checkbox" hidden class="custom-control-input">
|
||||
<label class="custom-control-label">{% trans %}permission.legend.disallow{% endtrans %}</label>
|
||||
</div>
|
||||
<div class="custom-control custom-control-inline custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" hidden checked>
|
||||
<label class="custom-control-label">{% trans %}permission.legend.allow{% endtrans %}</label>
|
||||
</div>
|
||||
<div class="custom-control custom-control-inline custom-checkbox">
|
||||
<input type="checkbox" class="tristate custom-control-input" hidden indeterminate="indeterminate">
|
||||
<label class="custom-control-label">{% trans %}permission.legend.inherit{% endtrans %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
{% for group in form %}
|
||||
<li class="nav-item">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue