[wip] layout of custom field edition

[ci skip]
This commit is contained in:
Julien Fastré 2015-11-25 08:45:17 +01:00
parent cbcc722c0d
commit b96076022f
5 changed files with 62 additions and 14 deletions

View File

@ -159,7 +159,7 @@ class CustomFieldController extends Controller
$editForm = $this->createEditForm($entity, $entity->getType()); $editForm = $this->createEditForm($entity, $entity->getType());
$deleteForm = $this->createDeleteForm($id); $deleteForm = $this->createDeleteForm($id);
return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array( return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array(
'entity' => $entity, 'entity' => $entity,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),

View File

@ -136,7 +136,8 @@ class CustomFieldChoice implements CustomFieldInterface
'choices' => array( 'choices' => array(
1 => 'Multiple', 1 => 'Multiple',
0 => 'Unique'), 0 => 'Unique'),
'empty_data' => 0 'empty_data' => 0,
'label' => 'Multiplicity'
)) ))
->add(self::EXPANDED, 'choice', array( ->add(self::EXPANDED, 'choice', array(
'expanded' => true, 'expanded' => true,
@ -144,7 +145,8 @@ class CustomFieldChoice implements CustomFieldInterface
'choices' => array( 'choices' => array(
1 => 'Expanded', 1 => 'Expanded',
0 => 'Non expanded'), 0 => 'Non expanded'),
'empty_data' => 0 'empty_data' => 0,
'label' => 'Choice display'
)) ))
->add(self::ALLOW_OTHER, 'choice', array( ->add(self::ALLOW_OTHER, 'choice', array(
'label' => 'Allow other', 'label' => 'Allow other',

View File

@ -2,7 +2,7 @@
'Other value': 'Autre valeur' 'Other value': 'Autre valeur'
'None': 'Pas spécifié' 'None': 'Pas spécifié'
#customfieldsgroup administration
CustomFieldsGroup list: Groupes de champs personnalisés CustomFieldsGroup list: Groupes de champs personnalisés
CustomFieldsGroup creation: Nouveau groupe de champs personnalisés CustomFieldsGroup creation: Nouveau groupe de champs personnalisés
Entity: Entité Entity: Entité
@ -26,3 +26,24 @@ CustomFieldsGroup edit: Edition d'un groupe de champs personnalisé
Custom fields configuration: Champs personnalisés Custom fields configuration: Champs personnalisés
CustomFields List: Liste des champs personnalisés CustomFields List: Liste des champs personnalisés
CustomFields Groups: Groupe de champs personnalisés CustomFields Groups: Groupe de champs personnalisés
#customfield administration
CustomField edit: Modification d'un champ personnalisé
General informations: Informations générales
Options: Options
Custom fields group: Groupe de champ personnalisé
Ordering: Ordre d'apparition
Back to the group: Retour au groupe de champs personnalisé
#custom field choice
Multiplicity: Multiplicité
Multiple: Multiple
Unique: Un seul choix possible
Choice display: Affichage des choix
Expanded: Choix étendus (boutons radio)
Non expanded: Choix rassemblés
Allow other: Autoriser une autre valeur
No: Non
Yes: Oui
Other value label (empty if use by default): Label du champ "autre valeur"
Choices: Choix

View File

@ -16,17 +16,33 @@
#} #}
{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %}
{% block admin_content %} {% block title %}{{ 'CustomField edit'|trans }}{% endblock title %}
<h1>CustomField edit</h1>
{{ form(edit_form) }} {% block admin_content %}
<h1>{{ 'CustomField edit'|trans }}</h1>
<h2>{{ 'General informations'|trans }}</h2>
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.active) }}
{% if edit_form.customFieldsGroup is defined %}
{{ form_row(edit_form.customFieldsGroup) }}
{% endif %}
{{ form_row(edit_form.ordering) }}
{% if edit_form.options is not empty %}
<h2>{{ 'Options'|trans }}</h2>
{% for option in edit_form.options %}
{{ form_row(option) }}
{% endfor %}
{% endif %}
{{ form_row(edit_form.submit, {'attr': { 'class': 'sc-button btn-update' } } ) }}
{{ form_end(edit_form) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
<a href="{{ path('customfield') }}"> <a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}">
Back to the list {{ 'Back to the group'|trans }}
</a> </a>
</li> </li>
<li>{{ form(delete_form) }}</li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -32,10 +32,19 @@
{% endblock cf_choices_list_widget %} {% endblock cf_choices_list_widget %}
{# render the possibility to add different elements in a choice list #} {# CFChoice : render the different elements in a choice list #}
{% block cf_choices_widget %} {% block cf_choices_row %}
<h3>{{ 'Choices'|trans }}</h3>
{{ form(form) }} <table><tbody>
{% for choice in form %}
<tr><td>
{{ form_row(choice.name) }}
</td></tr>
{% endfor %}
</tbody></table>
{# we use javascrit to add an additional element. All functions are personnalized with the id ( = form.vars.id) #} {# we use javascrit to add an additional element. All functions are personnalized with the id ( = form.vars.id) #}
<script type="text/javascript"> <script type="text/javascript">
@ -67,7 +76,7 @@
jQuery(document).ready(initializeCFChoiceOptionsChoices('{{ form.vars.id }}')); jQuery(document).ready(initializeCFChoiceOptionsChoices('{{ form.vars.id }}'));
</script> </script>
{% endblock cf_choices_widget %} {% endblock cf_choices_row %}
{% block choice_with_other_widget %} {% block choice_with_other_widget %}
<div {{ block('widget_container_attributes') }}> <div {{ block('widget_container_attributes') }}>