Browse Source

Form footer

develop
Guillaume 3 years ago
parent
commit
792ab4fb25
5 changed files with 36 additions and 17 deletions
  1. +0
    -8
      Form/User/ChangePasswordFormType.php
  2. +0
    -8
      Form/User/ProfileFormType.php
  3. +11
    -0
      Resources/views/admin/user/edit_password.html.twig
  4. +12
    -1
      Resources/views/admin/user/edit_profile.html.twig
  5. +13
    -0
      Resources/views/adminlte/macro/button.html.twig

+ 0
- 8
Form/User/ChangePasswordFormType.php View File

'invalid_message' => $this->translatorAdmin->trans('form.account_password.message.invalid_passwords'), 'invalid_message' => $this->translatorAdmin->trans('form.account_password.message.invalid_passwords'),
] ]
); );

$builder->add(
'submit',
SubmitType::class,
array(
'label' => $this->translatorAdmin->transAction('save')
)
);
} }


/** /**

+ 0
- 8
Form/User/ProfileFormType.php View File

TextType::class TextType::class
); );
} }

$builder->add(
'submit',
SubmitType::class,
[
'label' => $this->translatorAdmin->transAction('save')
]
);
} }


/** /**

+ 11
- 0
Resources/views/admin/user/edit_password.html.twig View File



{% block main %} {% block main %}
<div class="col-8"> <div class="col-8">
{% set form_id = 'form-user-change-password' %}
{% embed '@LcSov/adminlte/embed/card.html.twig' %} {% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block header_wrapper %}{% endblock %} {% block header_wrapper %}{% endblock %}
{% block body %} {% block body %}
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %} {% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form, {attr: {id: form_id} }) }}
{{ form(form) }} {{ form(form) }}
{{ form_end(form) }}
{% endblock %} {% endblock %}
{% block footer_wrapper %}{% endblock %} {% block footer_wrapper %}{% endblock %}
{% endembed %} {% endembed %}
</div> </div>

{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %}
{% block width %}8{% endblock %}
{% block content %}
{% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %}
{{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }}
{% endblock %}
{% endembed %}
{% endblock main %} {% endblock main %}

+ 12
- 1
Resources/views/admin/user/edit_profile.html.twig View File



{% block main %} {% block main %}
<div class="col-8"> <div class="col-8">
{% set form_id = 'form-user-profile' %}
{% embed '@LcSov/adminlte/embed/card.html.twig' %} {% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block header_wrapper %}{% endblock %} {% block header_wrapper %}{% endblock %}
{% block body %} {% block body %}
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %} {% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form, {'attr' : {'id' : form_id}}) }}
{{ form(form) }} {{ form(form) }}
{{ form_end(form) }}
{% endblock %} {% endblock %}
{% block footer_wrapper %}{% endblock %} {% block footer_wrapper %}{% endblock %}
{% endembed %} {% endembed %}
</div> </div>
{% endblock main %}

{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %}
{% block width %}8{% endblock %}
{% block content %}
{% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %}
{{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }}
{% endblock %}
{% endembed %}
{% endblock main %}

+ 13
- 0
Resources/views/adminlte/macro/button.html.twig View File


{% macro button(params) %}
{% set params_default = {type: 'submit', name: 'submit', class: 'float-right btn btn-primary', label: 'save', value: 'save'} %}
{% set params = params_default|merge(params) %}
<button type="{{ params.type }}" name="{{ params.name }}" class="{{ params.class }}" value="{{ params.value }}" form="{{ params.form }}">
<span class="btn-label">
{% if params.icon is defined %}
<i class="{{ params.icon }}"></i>
{% endif %}
{{ params.label|sov_trans_admin_action }}
</span>
</button>
{% endmacro %}

Loading…
Cancel
Save