mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
fix folder name
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
{#
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
<info@champs-libres.coop> / <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
||||
|
||||
{% block vertical_menu_content %}
|
||||
{{ chill_menu('admin_custom_fields', {
|
||||
'layout': '@ChillCustomFields/Admin/menu.html.twig',
|
||||
}) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block layout_wvm_content %}
|
||||
{% block admin_content %}<!-- block personcontent empty -->
|
||||
<h1>{{ 'CustomFields configuration' |trans }}</h1>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
@@ -0,0 +1,20 @@
|
||||
{#
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
<info@champs-libres.coop> / <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
|
||||
{% block v_menu_title %}{{ 'Custom fields configuration menu'|trans }}{% endblock %}
|
@@ -0,0 +1,49 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'CustomField edit'|trans }}{% endblock title %}
|
||||
|
||||
{% 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) }}
|
||||
{{ form_row(edit_form.required) }}
|
||||
{% 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">
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}" class="sc-button btn-reset">
|
||||
{{ 'Back to the group'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
@@ -0,0 +1,7 @@
|
||||
{% extends '::base.html.twig' %}
|
||||
|
||||
{% block javascripts_head %}<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>{% endblock %}
|
||||
|
||||
{% block body -%}
|
||||
{{ form(form) }}
|
||||
{% endblock %}
|
@@ -0,0 +1,56 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'CustomField creation'|trans }}{% endblock title %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>{{ 'CustomField creation'|trans }}</h1>
|
||||
|
||||
<h2>{{ 'General informations'|trans }}</h2>
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.active) }}
|
||||
{{ form_row(form.slug) }}
|
||||
{% if form.customFieldsGroup is defined %}
|
||||
{{ form_row(form.customFieldsGroup) }}
|
||||
{% endif %}
|
||||
{{ form_row(form.ordering) }}
|
||||
{{ form_row(form.required) }}
|
||||
{% if form.options is not empty %}
|
||||
<h2>{{ 'Options'|trans }}</h2>
|
||||
{% for option in form.options %}
|
||||
{{ form_row(option) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{ form_row(form.submit, {'attr': { 'class': 'sc-button btn-create' } } ) }}
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if entity.customFieldsGroup is not null %}
|
||||
<a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}" class="sc-button btn-reset">
|
||||
{{ 'Back to the group'|trans }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ path('customfieldsgroup') }}" class="sc-button btn-reset">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
@@ -0,0 +1 @@
|
||||
{{ customField.name|localize_translatable_string }}
|
@@ -0,0 +1,56 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>CustomField</h1>
|
||||
|
||||
<table class="record_properties">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ entity.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Label</th>
|
||||
<td>{{ entity.name(app.request.locale) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td>{{ entity.type }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Active</th>
|
||||
<td>{{ entity.active }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('customfield') }}">
|
||||
Back to the list
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('customfield_edit', { 'id': entity.id }) }}">
|
||||
Edit
|
||||
</a>
|
||||
</li>
|
||||
<li>{{ form(delete_form) }}</li>
|
||||
</ul>
|
||||
{% endblock %}
|
@@ -0,0 +1,45 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'CustomFieldsGroup edit'|trans }}{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>{{ 'CustomFieldsGroup edit'|trans }}</h1>
|
||||
|
||||
{{ form_start(edit_form) }}
|
||||
{{ form_row(edit_form.name) }}
|
||||
{{ form_row(edit_form.entity) }}
|
||||
{% if edit_form.options is defined %}
|
||||
{{ form_row(edit_form.options) }}
|
||||
{% endif %}
|
||||
{{ form_row(edit_form.submit, { 'attr': { 'class': 'sc-button bt-edit' } } ) }}
|
||||
{{ form_end(edit_form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup') }}" class="sc-button bt-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup_show', { 'id' : entity.id }) }}" class="sc-button bt-cancel">
|
||||
{{ 'show'|trans|capitalize }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
@@ -0,0 +1,67 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'CustomFieldsGroup list'|trans }}{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>{{ 'CustomFieldsGroup list'|trans }}</h1>
|
||||
|
||||
<table class="records_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'Name'|trans }}</th>
|
||||
<th>{{ 'Entity'|trans }}</th>
|
||||
<th>{{ 'Is default ?'|trans }} <i class="fa fa-info-circle" title="{{ 'Some module select default groups for some usage. Example: the default person group is shown under person page.'|trans|escape('html_attr') }}"></i></th>
|
||||
<th>{{ 'Actions'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td><a href="{{ path('customfieldsgroup_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
|
||||
<td>{{ entity.entity|trans }}</td>
|
||||
<td style="text-align: center;">
|
||||
{%- if entity.id in default_groups -%}
|
||||
<i class="fa fa-star"></i>
|
||||
{%- else -%}
|
||||
{{ form_start(make_default_forms[entity.id]) }}
|
||||
{{ form_widget(make_default_forms[entity.id].submit, { 'attr' : { 'class' : 'sc-button bt-action' } } ) }}
|
||||
{{ form_end(make_default_forms[entity.id]) }}
|
||||
{%- endif -%}
|
||||
</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup_show', { 'id': entity.id }) }}" class="sc-button">{{ 'show'|trans|capitalize }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}" class="sc-button btn-edit">{{ 'edit'|trans|capitalize }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<a href="{{ path('customfieldsgroup_new') }}" class="sc-button bt-create">
|
||||
{{ 'Create a new group'|trans }}
|
||||
</a>
|
||||
</p>
|
||||
{% endblock %}
|
@@ -0,0 +1,32 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>{{ 'CustomFieldsGroup creation'|trans }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.entity) }}
|
||||
<p>
|
||||
{{ form_widget(form.submit, { 'attr' : { 'class': 'sc-button bt-create' } } ) }}
|
||||
<a href="{{ path('customfieldsgroup') }}" class="sc-button bt-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</p>
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
@@ -0,0 +1,86 @@
|
||||
{#- a customField element will be stored in title variable -#}
|
||||
{%- set title = null -%}
|
||||
{#- a customField element will be stored in subtitle variable -#}
|
||||
{%- set subtitle = null -%}
|
||||
{%- set type = constant('Chill\\CustomFieldsBundle\\CustomFields\\CustomFieldTitle::TYPE') -%}
|
||||
{%- set type_subtitle = constant('Chill\\CustomFieldsBundle\\CustomFields\\CustomFieldTitle::TYPE_SUBTITLE') -%}
|
||||
{%- set type_title = constant('Chill\\CustomFieldsBundle\\CustomFields\\CustomFieldTitle::TYPE_TITLE') -%}
|
||||
{# a variable to store that "something has been printed #}
|
||||
{%- set something_has_been_printed = false -%}
|
||||
{%- set title_div_opened = false -%}
|
||||
{%- set subtitle_div_opened = false -%}
|
||||
{% for customField in cFGroup.activeCustomFields %}
|
||||
{% if customField.type == 'title' %}
|
||||
{%- if show_empty == true %}
|
||||
{%- if customField.options[type] == type_title -%}
|
||||
{%- if title_div_opened == false -%}
|
||||
<div class="cf_title_box">
|
||||
{%- set title_div_opened = true -%}
|
||||
{%- else -%}
|
||||
{%- if subtitle_div_opened == true -%}
|
||||
</div> <!-- closing cf_subtitle_box -->
|
||||
{%- set title_div_opened = false -%}
|
||||
{%- endif -%}
|
||||
</div><div class="cf_title_box">
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- if subtitle_div_opened == false -%}
|
||||
<div class="cf_subtitle_box">
|
||||
{%- set subtitle_div_opened = true -%}
|
||||
{%- else -%}
|
||||
</div><div class="cf_subtitle_box">
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{{ chill_custom_field_widget(cFData , customField) }}
|
||||
{%- else -%}
|
||||
{# we keep the customfield in memory, and print it only if 'something' has been filled after the title #}
|
||||
{%- if customField.options[type] == type_title -%}
|
||||
{%- set title = customField -%}
|
||||
{# we have to reset the title hierarchy if we misused titles hierarchy #}
|
||||
{%- set subtitle = null -%}
|
||||
{%- elseif customField.options[type] == type_subtitle -%}
|
||||
{%- set subtitle = customField -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{% else %}
|
||||
{%- if show_empty == true or (chill_custom_field_is_empty(cFData, customField) == false) -%}
|
||||
{%- if title is not empty -%}
|
||||
{%- if title_div_opened == false -%}
|
||||
<div class="cf_title_box">
|
||||
{%- set title_div_opened = true -%}
|
||||
{%- else -%}
|
||||
{%- if subtitle_div_opened == true -%}
|
||||
</div> <!-- closing cf_subtitle_box -->
|
||||
{%- set title_div_opened = false -%}
|
||||
{%- endif -%}
|
||||
</div><div class="cf_title_box">
|
||||
{%- endif -%}
|
||||
{{ chill_custom_field_widget(cFData, title) }}
|
||||
{%- set title = null -%}
|
||||
{%- endif -%}
|
||||
{%- if subtitle is not empty -%}
|
||||
{%- if subtitle_div_opened == false -%}
|
||||
<div class="cf_subtitle_box">
|
||||
{%- set subtitle_div_opened = true -%}
|
||||
{%- else -%}
|
||||
</div><div class="cf_subtitle_box">
|
||||
{%- endif -%}
|
||||
{{ chill_custom_field_widget(cFData, subtitle) }}
|
||||
{%- set subtitle = null -%}
|
||||
{%- endif -%}
|
||||
<dt class="custom_fields_group_rendering">{{ chill_custom_field_label(customField) }}</dt>
|
||||
<dd class="custom_fields_group_rendering">{{ chill_custom_field_widget(cFData , customField) }}</dd>
|
||||
{%- set something_has_been_printed = true -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
{%- if subtitle_div_opened == true -%}
|
||||
</div> <!-- closing cf_subtitle_box -->
|
||||
{%- endif -%}
|
||||
{%- if title_div_opened == true -%}
|
||||
</div> <!-- closing cf_title_box -->
|
||||
{%- endif -%}
|
||||
{% if something_has_been_printed == false %}
|
||||
<dt class="custom_field_no_data custom_fields_group_rendering">{{ 'Empty data'|trans }}</dt>
|
||||
<dd class="custom_field_no_data custom_fields_group_rendering">{{ 'No data to show' | trans }}</dd>
|
||||
{% endif %}
|
@@ -0,0 +1,7 @@
|
||||
<dl class="custom_fields_group_rendering">
|
||||
<span class="custom_fields_group_name">{{ customFieldsGroup.name(app.request.locale) }}</span>
|
||||
{% for customField in customFieldsGroup.customFields %}
|
||||
<dt>{{ chill_custom_field_label(customField) }}</dt>
|
||||
<dd>{{ chill_custom_field_widget(fields, customField) }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
@@ -0,0 +1,116 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
{% extends "@ChillCustomFields/Admin/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'CustomFieldsGroup details'|trans }}{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>{{ 'CustomFieldsGroup details'|trans }}</h1>
|
||||
|
||||
<table class="record_properties">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{{ 'Name'|trans }}</th>
|
||||
<td>{{ entity.getName|localize_translatable_string }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ 'Entity'|trans }}</th>
|
||||
<td>{{ entity.entity|trans }}</td>
|
||||
</tr>
|
||||
{%- for key in options -%}
|
||||
<tr>
|
||||
<th>{{ key ~ '_label'|trans }}</th>
|
||||
<td>
|
||||
{%- if entity.options[key] is not defined -%}
|
||||
{{ 'No value defined for this option'|trans }}
|
||||
{%- elseif entity.options[key] is iterable -%}
|
||||
{{ entity.options[key]|join(', ') }}
|
||||
{% else %}
|
||||
{{ entity.options[key] }}
|
||||
{%- endif -%}
|
||||
</td>
|
||||
</tr>
|
||||
{%- else -%}
|
||||
<!-- no option available for this entity -->
|
||||
{%- endfor -%}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup') }}" class="sc-button bt-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
|
||||
{{ 'Edit'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</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 %}
|
@@ -0,0 +1,13 @@
|
||||
{% if selected|length > 0 %}
|
||||
{%- for choice in choices -%}
|
||||
{% if choice['slug'] in selected %}
|
||||
{%- if choice['slug'] is not same as('_other') -%}
|
||||
{{ choice['name']|localize_translatable_string|csv_cell }}
|
||||
{%- else -%}
|
||||
{{ choice['name']|csv_cell }}
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
{% else %}
|
||||
{{ 'None'|trans }}
|
||||
{% endif %}
|
@@ -0,0 +1,29 @@
|
||||
{% if selected|length > 0 %}
|
||||
<ul class="custom_fields choice">
|
||||
{%- for choice in choices -%}
|
||||
{% if choice['slug'] in selected %}
|
||||
{%- set is_selected = true -%}
|
||||
{%- else -%}
|
||||
{%- set is_selected = false -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if is_selected -%}
|
||||
<li class="{% if is_selected or expanded == 1 %} selected {% endif %}">
|
||||
{%- if is_selected -%}
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
{%- else -%}
|
||||
<i class="fa fa-square-o"></i>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if choice['slug'] is not same as('_other') -%}
|
||||
{{ choice['name']|localize_translatable_string }}
|
||||
{%- else -%}
|
||||
{{ choice['name'] }}
|
||||
{%- endif -%}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="custom_fields_choice empty">{{ 'None'|trans }}</div>
|
||||
{% endif %}
|
@@ -0,0 +1 @@
|
||||
{% if values|length == 1 %}{{ values[0].text|localize_translatable_string|default("")|csv_cell }}{% elseif values|length ==0 %}{{ 'emtpy'|csv_cell }}{% else %}{{ 'pas de rendu multiple'|csv_cell }}{% endif %}
|
@@ -0,0 +1,11 @@
|
||||
{% if values|length > 0 %}
|
||||
<ul class="custom_fields long_choice {% if values|length == 1 %}unique{% endif %}">
|
||||
{%- for value in values -%}
|
||||
<li class="long_choice_item long_choice-key-{{ value.key }} long_choice-ikey-{{ value.internalKey }} long_choice-parent-ikey-{{ value.parent.internalKey }}">
|
||||
<i class="fa fa-check-square-o"></i> {{ value.text|localize_translatable_string }}
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="custom_fields_choice long_choice empty">{{ 'None'|trans }}</div>
|
||||
{% endif %}
|
@@ -0,0 +1 @@
|
||||
{% if value is not empty %}{{ value|format_date(format)}}{% endif %}
|
@@ -0,0 +1 @@
|
||||
{% if number is not empty %}{{ number|number_format(scale)|csv_cell }}{% endif %}
|
@@ -0,0 +1 @@
|
||||
{% if number is not empty %}{{ number|number_format(scale) }} {{ post|default('') }}{% endif %}
|
@@ -0,0 +1 @@
|
||||
{% if text is not empty %}{{ text|csv_cell}}{% else %}{{ 'None'|trans }}{% endif %}
|
@@ -0,0 +1 @@
|
||||
{% if text is not empty %}{{ text|nl2br }}{% else %}<span class="custom_fields_text empty">{{ 'None'|trans }}</span>{% endif %}
|
@@ -0,0 +1,5 @@
|
||||
{% if type == "title"%}
|
||||
<h2>{{ title | localize_translatable_string }}</h2>
|
||||
{% else %}
|
||||
<h3>{{ title | localize_translatable_string }}</h3>
|
||||
{% endif %}
|
@@ -0,0 +1,111 @@
|
||||
{#
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{# CustomFields Title #}
|
||||
{% block custom_field_title_widget %}
|
||||
<span class="cf-{{ form.vars.attr.type }}">
|
||||
{{ form.vars.attr.title }}
|
||||
</span>
|
||||
{% endblock custom_field_title_widget %}
|
||||
|
||||
{# CustomFields Choice #}
|
||||
{# render an alement in a choice list #}
|
||||
{% block cf_choices_list_widget %}
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.active) }}
|
||||
{{ form_row(form.slug) }}
|
||||
{% endblock cf_choices_list_widget %}
|
||||
|
||||
{# CFChoice : render the different elements in a choice list #}
|
||||
{% block cf_choices_row %}
|
||||
<h3>{{ 'Choices'|trans }}</h3>
|
||||
|
||||
<div id="{{ form.vars.id }}" data-prototype="{{- form_row(form.vars.prototype.children.name)
|
||||
~ form_row(form.vars.prototype.children.active)
|
||||
~ form_row(form.vars.prototype.children.slug) -}}">
|
||||
<table><tbody>
|
||||
{% for choice in form %}
|
||||
<tr><td>
|
||||
{{ form_row(choice.name) }}
|
||||
{{ form_row(choice.active) }}
|
||||
{{ form_row(choice.slug) }}
|
||||
</td></tr>
|
||||
{% endfor %}
|
||||
</tbody></table>
|
||||
</div>
|
||||
|
||||
|
||||
{# we use javascrit to add an additional element. All functions are personnalized with the id ( = form.vars.id) #}
|
||||
<script type="text/javascript">
|
||||
function addElementInDiv(div_id) {
|
||||
var div = $('#' + div_id);console.log(div);
|
||||
var prototype = div.data('prototype');console.log(prototype);
|
||||
var index = div.data('index');console.log(index);
|
||||
var add_element_link = $('#' + div_id + '_add_element_link');
|
||||
var new_fields = prototype.replace(/__name__label__/g, index);
|
||||
var new_fields = prototype.replace(/__name__/g, index);
|
||||
|
||||
div.data('index', index + 1);
|
||||
console.log(index);
|
||||
add_element_link.before(new_fields);
|
||||
}
|
||||
|
||||
function initializeCFChoiceOptionsChoices(div_id) {
|
||||
var add_element_link = $('<a id="' + div_id + '_add_element_link"" href="#" class="sc-button bt-submit">{{ 'Add an element'|trans }}</a>');
|
||||
var div = $('#' + div_id);
|
||||
div.append(add_element_link);
|
||||
div.data('index', div.find('td').length);
|
||||
console.log(div.data('index'));
|
||||
|
||||
add_element_link.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
addElementInDiv(div_id);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(event) {
|
||||
jQuery(document).ready(initializeCFChoiceOptionsChoices('{{ form.vars.id }}'));
|
||||
});
|
||||
</script>
|
||||
{% endblock cf_choices_row %}
|
||||
|
||||
{# extend the number type to add post_text extension #}
|
||||
{% block number_widget %}
|
||||
{%- if post_text is defined and post_text is not empty-%}
|
||||
<div class="input_with_post_text">
|
||||
{%- endif -%}
|
||||
{{ block('form_widget') }}
|
||||
{%- if post_text is defined and post_text is not empty-%}
|
||||
<span class="post_text">{{ post_text }}</span>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{# extend the number type to add post_text extension #}
|
||||
{% block integer_widget %}
|
||||
{%- if post_text is defined and post_text is not empty-%}
|
||||
<div class="input_with_post_text">
|
||||
{%- endif -%}
|
||||
{{ block('form_widget') }}
|
||||
{%- if post_text is defined and post_text is not empty-%}
|
||||
<span class="post_text">{{ post_text }}</span>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{# The choice_with_other_widget widget is defined in the main bundle #}
|
||||
|
Reference in New Issue
Block a user