mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
Fix option with RoleWithoutScope distinction. Remove flag.
This commit is contained in:
@@ -44,13 +44,13 @@
|
||||
{%- endif -%}
|
||||
</td>
|
||||
<td>
|
||||
<span class="role_scope role">{{ role_scope.role|trans|replace({'(⚑)': ''}) }}</span>
|
||||
<span class="role_scope role">{{ role_scope.role|trans }}</span>
|
||||
{% if expanded_roles[role_scope.role]|length > 1 %}
|
||||
<div class="help-text">
|
||||
<span style="text-decoration: underline dotted;">{{ 'Which implies'|trans }} :</span>
|
||||
{% for role in expanded_roles[role_scope.role] %}
|
||||
{% if role != role_scope.role %}
|
||||
{{ role|trans|replace({'(⚑)': ''}) }}
|
||||
{{ role|trans }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -83,7 +83,7 @@
|
||||
{{ form_widget(add_role_scopes_form.composed_role_scope.role, { 'attr': { 'class': 'w-50' }}) }}
|
||||
{{ form_widget(add_role_scopes_form.composed_role_scope.scope) }}
|
||||
</div>
|
||||
<div class="help-text mb-3">{{ 'Help to pick role an scope'|trans }}</div>
|
||||
<div id="role_scope_legend" class="help-text mb-3">{{ 'Help to pick role and scope'|trans }}</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
@@ -102,3 +102,26 @@
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
|
||||
// An event listener give contextual legend when choosing an option.
|
||||
const select = document.getElementById('form_composed_role_scope_role');
|
||||
const legend = document.getElementById('role_scope_legend');
|
||||
|
||||
select.addEventListener('change', function() {
|
||||
const option = this.options[this.selectedIndex];
|
||||
const hasScope = option.getAttribute('data-has-scope');
|
||||
legend.style.display = 'block';
|
||||
if (hasScope === '0') {
|
||||
legend.innerText = '{{ 'The role does not need scope'|trans }}';
|
||||
} else if (hasScope === '1') {
|
||||
legend.innerText = '{{ 'The role need scope'|trans }}';
|
||||
} else {
|
||||
legend.innerText = '{{ 'Help to pick role and scope'|trans }}';
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@@ -37,13 +37,13 @@
|
||||
{%- endif -%}
|
||||
</td>
|
||||
<td>
|
||||
<span class="role_scope role">{{ role_scope.role|trans|replace({'(⚑)': ''}) }}</span>
|
||||
<span class="role_scope role">{{ role_scope.role|trans }}</span>
|
||||
{% if expanded_roles[role_scope.role]|length > 1 %}
|
||||
<div class="help-text">
|
||||
<span style="text-decoration: underline dotted;">{{ 'Which implies'|trans }} :</span>
|
||||
{% for role in expanded_roles[role_scope.role] %}
|
||||
{% if role != role_scope.role %}
|
||||
{{ role|trans|replace({'(⚑)': ''}) }}
|
||||
{{ role|trans }}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user