refactor(program): move item types out of Settings > Configuration
Relocate the item type lists (insights, allocations, objectives, tasks, stakeholders, audience values) from the Configuration tab to a dedicated "Item types" page under Programs, served by ItemTypesController at /program-item-types and guarded by the new program:itemtypes:view permission. The Program settings tab in Configuration now only holds the general settings (currency, stakeholder phone region, audience attribute toggles), so ConfigSubscriber no longer needs the item repositories; the in-use type protection moved to ItemTypeInUseGuard.
This commit is contained in:
1 parent
71ff11390b
commit
687d33d30c
14 files changed
+444
-219
No files matched your search
@@ -1,84 +1,10 @@
|
||||
{#
|
||||
# Settings > Configuration > Program Settings: the general currency, then one section per kind of initiative
|
||||
# item (insights, allocation, objectives, tasks), each with a pictogram. Adding and removing
|
||||
# types, and the pictogram preview, are handled by Assets/js/program.js (delegated handlers on
|
||||
# .program-config-types).
|
||||
# Settings > Configuration > Program Settings: the plugin's general settings only — the currency,
|
||||
# the stakeholder phone region, and the audience attribute toggles. The item type lists moved to
|
||||
# their own page under Programs (ItemTypesController, Resources/views/ItemTypes/form.html.twig).
|
||||
#}
|
||||
|
||||
{% macro type_row(type) %}
|
||||
<div class="panel panel-default program-config-type">
|
||||
<div class="panel-body">
|
||||
{{ form_widget(type.children.key) }}
|
||||
{{ form_errors(type) }}
|
||||
{% if type.children.icon is defined %}
|
||||
{% set icon = type.children.icon.vars.value %}
|
||||
<div class="row mb-sm">
|
||||
<div class="col-xs-1 text-center pt-lg">
|
||||
<i class="initiative-type-icon-preview {{ icon }}" style="font-size: 28px;" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="col-xs-5">{{ form_row(type.children.icon) }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<table class="table table-condensed mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-2">{{ 'mautic.program.config.type.language'|trans }}</th>
|
||||
<th class="col-xs-4">{{ 'mautic.program.config.type.name'|trans }}</th>
|
||||
<th class="col-xs-6">{{ 'mautic.program.config.type.description'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for locale, name in type.children.names.children %}
|
||||
<tr>
|
||||
<td class="text-muted" title="{{ name.vars.attr['data-locale'] }}">
|
||||
{{ name.vars.attr['data-language'] }}
|
||||
{% if name.vars.required %}<span class="required">*</span>{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ form_widget(name) }}
|
||||
{{ form_errors(name) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ form_widget(type.children.descriptions.children[locale]) }}
|
||||
{{ form_errors(type.children.descriptions.children[locale]) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="text-right mt-xs">
|
||||
<button type="button" class="btn btn-ghost btn-sm program-config-type-remove">
|
||||
<i class="ri-delete-bin-line"></i> {{ 'mautic.program.config.type.remove'|trans }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{# One editable list of types (one per kind of initiative item). #}
|
||||
{% macro type_section(types, titleKey, helpKey) %}
|
||||
{% import _self as cfg %}
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ titleKey|trans }}</h4>
|
||||
<p class="text-muted small">{{ helpKey|trans }}</p>
|
||||
{{ form_errors(types) }}
|
||||
<div class="program-config-types" data-prototype="{{ cfg.type_row(types.vars.prototype)|e('html_attr') }}">
|
||||
<p class="text-muted program-config-types-empty{% if types|length > 0 %} hide{% endif %}">
|
||||
{{ 'mautic.program.config.types.empty'|trans }}
|
||||
</p>
|
||||
<div class="program-config-types-list">
|
||||
{% for type in types %}
|
||||
{{ cfg.type_row(type) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="button" class="btn btn-ghost program-config-type-add">
|
||||
<i class="ri-add-line"></i> {{ 'mautic.program.config.type.add'|trans }}
|
||||
</button>
|
||||
</div>
|
||||
{% do types.setRendered %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block _config_programconfig_widget %}
|
||||
{% import _self as cfg %}
|
||||
<div class="text-muted small pb-md">{{ 'mautic.program.config.description'|trans }}</div>
|
||||
|
||||
<h4 class="fw-sb mb-xs">{{ 'mautic.program.config.section.general'|trans }}</h4>
|
||||
@@ -88,36 +14,6 @@
|
||||
</div>
|
||||
<p class="text-muted small">{{ 'mautic.program.config.currency.help'|trans }}</p>
|
||||
|
||||
{{ cfg.type_section(form.children.program_description_item_types,
|
||||
'mautic.program.config.section.description_item_types',
|
||||
'mautic.program.config.section.description_item_types.help') }}
|
||||
|
||||
{{ cfg.type_section(form.children.program_allocation_item_types,
|
||||
'mautic.program.config.section.allocation_item_types',
|
||||
'mautic.program.config.section.allocation_item_types.help') }}
|
||||
|
||||
{{ cfg.type_section(form.children.program_objective_types,
|
||||
'mautic.program.config.section.objective_types',
|
||||
'mautic.program.config.section.objective_types.help') }}
|
||||
|
||||
{{ cfg.type_section(form.children.program_task_types,
|
||||
'mautic.program.config.section.task_types',
|
||||
'mautic.program.config.section.task_types.help') }}
|
||||
|
||||
{{ cfg.type_section(form.children.program_stakeholder_types,
|
||||
'mautic.program.config.section.stakeholder_types',
|
||||
'mautic.program.config.section.stakeholder_types.help') }}
|
||||
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ 'mautic.program.config.section.audience_values'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mautic.program.config.section.audience_values.help'|trans }}</p>
|
||||
{{ cfg.type_section(form.children.program_audience_decision_roles,
|
||||
'mautic.program.config.section.audience_decision_roles',
|
||||
'mautic.program.config.section.audience_decision_roles.help') }}
|
||||
|
||||
{{ cfg.type_section(form.children.program_audience_tones,
|
||||
'mautic.program.config.section.audience_tones',
|
||||
'mautic.program.config.section.audience_tones.help') }}
|
||||
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ 'mautic.program.config.section.audience_attributes'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mautic.program.config.section.audience_attributes.help'|trans }}</p>
|
||||
<div class="program-config-audience-attributes">
|
||||
|
||||
Reference in new issue
Block a user