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

@@ -73,14 +73,6 @@ class ChangePasswordFormType extends AbstractType
'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

@@ -51,14 +51,6 @@ class ProfileFormType extends AbstractType
TextType::class
);
}

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

/**

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

@@ -7,13 +7,24 @@

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

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

@@ -6,13 +6,24 @@

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

@@ -0,0 +1,13 @@

{% 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