mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
fix show page
This commit is contained in:
parent
bb1e690bec
commit
043f5a1eaf
@ -6,6 +6,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
||||||
|
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CustomFieldsGroup controller.
|
* CustomFieldsGroup controller.
|
||||||
@ -152,11 +153,9 @@ class CustomFieldsGroupController extends Controller
|
|||||||
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
|
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:show.html.twig', array(
|
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:show.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'delete_form' => $deleteForm->createView(),
|
'create_field_form' => $this->createCreateFieldForm($entity)->createView()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +200,29 @@ class CustomFieldsGroupController extends Controller
|
|||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createCreateFieldForm(CustomFieldsGroup $customFieldsGroup)
|
||||||
|
{
|
||||||
|
|
||||||
|
$fieldChoices = array();
|
||||||
|
foreach ($this->get('chill.custom_field.provider')->getAllFields()
|
||||||
|
as $key => $customType) {
|
||||||
|
$fieldChoices[$key] = $customType->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->createFormBuilder(new CustomField(), array(
|
||||||
|
'method' => 'GET',
|
||||||
|
'action' => $this->generateUrl('customfield_new',
|
||||||
|
array('cfGroup' => $customFieldsGroup->getId())),
|
||||||
|
'csrf_protection' => false
|
||||||
|
))
|
||||||
|
->add('type', 'choice', array(
|
||||||
|
'choices' => $fieldChoices
|
||||||
|
))
|
||||||
|
->add('submit', 'submit')
|
||||||
|
->getForm();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits an existing CustomFieldsGroup entity.
|
* Edits an existing CustomFieldsGroup entity.
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
'Other value': 'Autre valeur'
|
'Other value': 'Autre valeur'
|
||||||
'None': 'Pas spécifié'
|
'None': 'Pas spécifié'
|
||||||
|
|
||||||
Custom fields configuration: Configuration des champs personnalisés
|
|
||||||
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é
|
||||||
@ -10,6 +10,17 @@ Entity: Entité
|
|||||||
"Some module select default groups for some usage. Example: the default person group is shown under person page.": "Certains modules sélectionnent en priorité les formulaires par défaut. Exemple: le formulaire par défaut pour une personne est affiché sur la page principale pour la personne"
|
"Some module select default groups for some usage. Example: the default person group is shown under person page.": "Certains modules sélectionnent en priorité les formulaires par défaut. Exemple: le formulaire par défaut pour une personne est affiché sur la page principale pour la personne"
|
||||||
Make default: Assigner comme formulaire par défaut
|
Make default: Assigner comme formulaire par défaut
|
||||||
Create a new group: Créer un nouveau groupe
|
Create a new group: Créer un nouveau groupe
|
||||||
|
CustomFieldsGroup details: Détail du groupe de champs personnalisés
|
||||||
|
Fields associated with this group: Champs associés à ce groupe
|
||||||
|
Any field is currently associated with this group: Aucun champ n'est associé à ce groupe actuellement
|
||||||
|
Create a new field: Créer un champ personnalisé
|
||||||
|
Add a new field: Ajouter un champ personnalisé
|
||||||
|
ordering: ordre
|
||||||
|
label_field: label du champ
|
||||||
|
active: actif
|
||||||
|
|
||||||
|
|
||||||
|
#menu entries
|
||||||
|
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
|
||||||
|
@ -16,37 +16,85 @@
|
|||||||
#}
|
#}
|
||||||
{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %}
|
{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% block title%}{{ 'CustomFieldsGroup details'|trans }}{% endblock %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
<h1>CustomFieldsGroup</h1>
|
<h1>{{ 'CustomFieldsGroup details'|trans }}</h1>
|
||||||
|
|
||||||
<table class="record_properties">
|
<table class="record_properties">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>{{ 'Name'|trans }}</th>
|
||||||
<td>{{ entity.id }}</td>
|
<td>{{ entity.getName|localize_translatable_string }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>{{ 'Entity'|trans }}</th>
|
||||||
<td>{{ entity.getName(app.request.locale) }}</td>
|
<td>{{ entity.entity|trans }}</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Entity</th>
|
|
||||||
<td>{{ entity.entity }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('customfieldsgroup') }}">
|
<a href="{{ path('customfieldsgroup') }}" class="sc-button bt-cancel">
|
||||||
Back to the list
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}">
|
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
|
||||||
Edit
|
{{ 'Edit'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>{{ form(delete_form) }}</li>
|
</ul>
|
||||||
</ul>
|
|
||||||
|
<h2>{{ 'Fields associated with this group'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if entity.customFields|length > 0 -%}
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'ordering'|trans|capitalize }}</th>
|
||||||
|
<th>{{ 'label_field'|trans|capitalize }}</th>
|
||||||
|
<th>{{ 'type'|trans|capitalize }}</th>
|
||||||
|
<th>{{ 'active'|trans|capitalize }}</th>
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{%- for field in entity.customFields -%}
|
||||||
|
<tr>
|
||||||
|
<td>{{ field.ordering }}</td>
|
||||||
|
<td>{{ field.name|localize_translatable_string }}</td>
|
||||||
|
<td>{{ field.type|trans }}</td>
|
||||||
|
<td style="text-align:center;">
|
||||||
|
{%- if field.active -%}
|
||||||
|
<i class="fa fa-check-square-o"></i>
|
||||||
|
{%- else -%}
|
||||||
|
<i class="fa fa-square-o"></i>
|
||||||
|
{%- endif -%}
|
||||||
|
</td>
|
||||||
|
<td style="text-align:center">
|
||||||
|
<a href="{{ path('customfield_edit', { 'id' : field.id }) }}" class="sc-button bt-edit">{{ 'edit'|trans|capitalize }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{%- endfor -%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{ form_start(create_field_form) }}
|
||||||
|
<div class="grid-4">
|
||||||
|
{{ form_widget(create_field_form.type) }}
|
||||||
|
</div>
|
||||||
|
{{ form_widget(create_field_form.submit, { 'attr': { 'class': 'sc-button bt-create' }, 'label': 'Add a new field' } ) }}
|
||||||
|
{{ form_end(create_field_form) }}
|
||||||
|
{%- else -%}
|
||||||
|
<p>
|
||||||
|
{{ 'Any field is currently associated with this group'|trans }}
|
||||||
|
</p>
|
||||||
|
{{ form_start(create_field_form) }}
|
||||||
|
<div class="grid-4">
|
||||||
|
{{ form_widget(create_field_form.type) }}
|
||||||
|
</div>
|
||||||
|
{{ form_widget(create_field_form.submit, { 'attr': { 'class': 'sc-button bt-create' }, 'label': 'Create a new field' } ) }}
|
||||||
|
{{ form_end(create_field_form) }}
|
||||||
|
{%- endif -%}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user