- Posts: 84
- Thank you received: 4
Ask the community, share ideas, and connect with other LimeSurvey users!
<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>
{% if indexItem.showItem == 1 %} {#other code here#} {% endif %}
Please Log in to join the conversation.
Please Log in to join the conversation.
&zwnj
Please Log in to join the conversation.
Please Log in to join the conversation.
{% for step, indexItem in aSurveyInfo.aQuestionIndex.items %} {% if '#' in indexItem.text %} {% 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|split('#')[0] }} </a> </li> {% endif %} {% endfor %}
Please Log in to join the conversation.
{% if '#' in indexItem.text %}
Please Log in to join the conversation.
Yes, if you are after a binary attribute, this is a great way to handle it.I've solved it by just adding a "#" (the character(s) are arbitrary. You can just choose whatever) at the end of the question group title.
Please Log in to join the conversation.
{% if attribute(indexItem.stepStatus, 'index-item-unanswered') is defined and attribute(indexItem.stepStatus, 'index-item-unanswered') == true %}
Please Log in to join the conversation.
$(document).on("ready pjax:scriptcomplete", function () { // Highlight navbar when in group // Get current page var pagenum = -3 $('header ul.dropdown-menu li.index-item a').each(function(){ if ($(this).hasClass('disabled')){ var myHref = $(this).attr('href'); pagenum = Number(myHref.split("=")[1].trim()) return false; } }); // Mark Block if (pagenum != -3){ // console.log("pagenum: " + pagenum); var lastItem = null; var lastGroupNum = -3 $('body div.list-group div.index-item a').each(function(){ //Get current group num let currentGroupNum = Number($(this).attr('href').split("=")[1].trim()); // Catching potential errors if (lastGroupNum == -3) { lastGroupNum = currentGroupNum; } if (lastItem == null){ lastItem = this; } // console.log("currentGroupNum: " + currentGroupNum) // Mark current group if (currentGroupNum == pagenum) { // console.log("bingo"); $(this).addClass("current-group") return false; } else if (lastGroupNum < pagenum && pagenum < currentGroupNum){ // console.log("In between group " + pagenum + " between " + lastGroupNum + " and " + currentGroupNum); $(lastItem).addClass("current-group") return false; } else { lastGroupNum = currentGroupNum; lastItem = this } }); } });
.current-group { font-weight: bold; color: #4883a3; /* custom coloring */ }
Please Log in to join the conversation.