Please help us help you and fill where relevant:
Your LimeSurvey version: Version 6.4.12
Own server or LimeSurvey hosting: LimeSurvey Cloud
Survey theme/template: Customised fruity23 blueberry template
==================
Hello everyone,
I'm trying to adjust my navigation menu/question index, so only specific question groups are shown. I'm using the question group after question group setting.
I want to use some flag to determine wether a question group should be shown or not.
I think to achieve this I need to adjust some code in the question_index_menu.twig. This would be the relevant code, I think:
Code:
<div>
{# TODO: move back this logic to SurveyRuntime, and provide a ready to use indexItem.statusClass #}
{% for step, indexItem in aSurveyInfo.aQuestionIndex.items %}
{% set statusClass = '' %}
{% if attribute(indexItem.stepStatus, 'index-item-unanswered') is defined and attribute(indexItem.stepStatus, 'index-item-unanswered') == true %}
{% set statusClass = statusClass ~ ' index-warning' %}
{% endif %}
{% if attribute(indexItem.stepStatus, 'index-item-error') is defined and attribute(indexItem.stepStatus, 'index-item-error') == true %}
{% set statusClass = statusClass ~ ' index-danger' %}
{% endif %}
{% if attribute(indexItem.stepStatus, 'index-item-current') is defined and attribute(indexItem.stepStatus, 'index-item-current') == true %}
{% set statusClass = statusClass ~ ' disabled' %}
{% endif %}
<li class="list-group-item {{ indexItem.coreClass }}">
<a href='{{ indexItem.url }}' data-limesurvey-submit='{{ indexItem.submit }}'
class='dropdown-item {{ statusClass }}'>
{{ indexItem.text }}
</a>
</li>
{% endfor %}
</div>
To achieve this I figure the best way would be to put everything within the for-loop into some if clause that checks if a flag on the indexItem is set. Like this:
Code:
{% if indexItem.showItem == 1 %}
{#other code here#}
{% endif %}
Could this work? And how could I attach some custom attribute to my question groups?
Or is there some other workaround I could chose?