Skip to content

Commit

Permalink
Dev: moved classes, id and attribute to core for question_index_menu.…
Browse files Browse the repository at this point in the history
…twig
  • Loading branch information
LouisGac committed Aug 24, 2017
1 parent 5c310c5 commit 20cd0b5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
24 changes: 20 additions & 4 deletions application/helpers/SurveyRuntimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ private function setClassAndIds()
$this->aSurveyInfo['attr']['lctdropdown'] = ' style="overflow: scroll" ';

$this->aSurveyInfo['attr']['lctli'] = $this->aSurveyInfo['attr']['lctspan'] = $this->aSurveyInfo['attr']['lctdropdownli'] = $this->aSurveyInfo['attr']['lctdropdownlia'] = ' ';

$this->aSurveyInfo['attr']['navigatorcontainer'] = $this->aSurveyInfo['attr']['navigatorbuttonl'] = $this->aSurveyInfo['attr']['loadsavecontainer'] = $this->aSurveyInfo['attr']['loadsavecol'] = '';

// Navigator
$this->aSurveyInfo['id']['navigatorcontainer'] = 'navigator-container';
Expand All @@ -1883,14 +1883,30 @@ private function setClassAndIds()
$this->aSurveyInfo['class']['loadbutton'] = ' ls-saveaction ls-loadall btn btn-default ';
$this->aSurveyInfo['class']['savebutton'] = ' ls-saveaction ls-loadall btn btn-default ';



$this->aSurveyInfo['attr']['navigatorbuttonprev'] = ' type="submit" value="moveprev" name="move" accesskey="p" accesskey="n"';
$this->aSurveyInfo['attr']['navigatorbuttonsumbit'] = ' type="submit" value="movesubmit" name="move" accesskey="l" ';
$this->aSurveyInfo['attr']['navigatorbuttonnext'] = ' type="submit" value="movenext" name="move" ';
$this->aSurveyInfo['attr']['loadbutton'] = ' type="submit" value="loadall" name="loadall" accesskey="L"';
$this->aSurveyInfo['attr']['savebutton'] = ' type="submit" value="saveall" name="saveall" accesskey="s" ';
$this->aSurveyInfo['attr']['navigatorcontainer'] = $this->aSurveyInfo['attr']['navigatorbuttonl'] = $this->aSurveyInfo['attr']['loadsavecontainer'] = $this->aSurveyInfo['attr']['loadsavecol'] = '';

// Index Menu
$this->aSurveyInfo['class']['indexmenugli'] = ' dropdown ls-index-menu ls-no-js-hidden ';
$this->aSurveyInfo['class']['indexmenuglia'] = ' dropdown-toggle ';
$this->aSurveyInfo['class']['indexmenugspan'] = ' caret ';
$this->aSurveyInfo['class']['indexmenusgul'] = ' dropdown-menu ';
$this->aSurveyInfo['class']['indexmenusli'] = ' dropdown ls-index-menu ls-no-js-hidden ';
$this->aSurveyInfo['class']['indexmenuslia'] = ' dropdown-toggle ';
$this->aSurveyInfo['class']['indexmenusspan'] = ' caret ';
$this->aSurveyInfo['class']['indexmenussul'] = ' dropdown-menu ';
$this->aSurveyInfo['class']['indexmenusddh'] = ' dropdown-menu ';
$this->aSurveyInfo['class']['indexmenusddspan'] = ' caret ';
$this->aSurveyInfo['class']['indexmenusddul'] = ' dropdown-menu dropdown-sub-menu ';

$this->aSurveyInfo['attr']['indexmenuglia'] = ' data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"';
$this->aSurveyInfo['attr']['indexmenuslia'] = ' data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"';

$this->aSurveyInfo['attr']['indexmenugli'] = $this->aSurveyInfo['attr']['indexmenugspan'] = $this->aSurveyInfo['attr']['indexmenusgul'] = $this->aSurveyInfo['attr']['indexmenusli'] = $this->aSurveyInfo['attr']['indexmenusspan'] = $this->aSurveyInfo['attr']['indexmenussul'] = '';
$this->aSurveyInfo['attr']['indexmenusddh'] = $this->aSurveyInfo['attr']['indexmenusddspan'] = $this->aSurveyInfo['attr']['indexmenusddul'] = $this->aSurveyInfo['attr']['indexmenussli'] = $this->aSurveyInfo['attr']['indexmenusgli'] = '';


// Here you can add metas from core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
{% if (aSurveyInfo.aQuestionIndex.bShow == true) %}
{% if aSurveyInfo.format == 'G' %}
<!-- Question index, group, {{ aSurveyInfo.aQuestionIndex.type }} -->
<li class="dropdown ls-index-menu ls-no-js-hidden index-menu-{{ aSurveyInfo.aQuestionIndex.type }}">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
<li class="{{ aSurveyInfo.class.indexmenugli }} index-menu-{{ aSurveyInfo.aQuestionIndex.type }}" {{ aSurveyInfo.attr.indexmenugli }} >
<a class="{{ aSurveyInfo.class.indexmenuglia }}" {{ aSurveyInfo.attr.indexmenuglia }} href="#" >
{{ "Question index" | t }}
<span class="caret"></span>
<span class="{{ aSurveyInfo.class.indexmenugspan }}" {{ aSurveyInfo.attr.indexmenugspan }}></span>
</a>

<ul class="dropdown-menu">
<ul class="{{ aSurveyInfo.class.indexmenusgul }}" {{ aSurveyInfo.attr.indexmenusgul }}>
{# TODO: move back this logic to SurveyRuntime, and provide a ready to use indexItem.statusClass #}
{% for step, indexItem in aSurveyInfo.aQuestionIndex.items %}
{% set statusClass = '' %}
Expand All @@ -54,7 +54,7 @@
{% endif %}


<li class="{{ indexItem.coreClass }} {{ statusClass }}">
<li class="{{ indexItem.coreClass }} {{ statusClass }}" {{ aSurveyInfo.attr.indexmenusgli }}>
<a href='{{ indexItem.url }}' data-limesurvey-submit='{{ indexItem.submit }}'>
{{ indexItem.text }}
</a>
Expand All @@ -67,22 +67,22 @@
{# Question index in question by question mode #}
{% if aSurveyInfo.format == 'S' %}
<!-- Question index, question by question, {{ aSurveyInfo.aQuestionIndex.type }} -->
<li class="dropdown ls-index-menu ls-no-js-hidden index-menu-{{ aSurveyInfo.aQuestionIndex.type }}">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
<li class="{{ aSurveyInfo.class.indexmenusli }} index-menu-{{ aSurveyInfo.aQuestionIndex.type }}" {{ aSurveyInfo.attr.indexmenusli }}>
<a class="{{ aSurveyInfo.class.indexmenuslia }}" {{ aSurveyInfo.attr.indexmenuslia }}>
{{ "Question index" | t }}
<span class="caret"></span>
<span class="{{ aSurveyInfo.class.indexmenusspan }}" {{ aSurveyInfo.attr.indexmenusspan }}></span>
</a>

<ul class="dropdown-menu">
<ul class="{{ aSurveyInfo.class.indexmenussul }}" {{ aSurveyInfo.attr.indexmenussul }}>

{% for group in aSurveyInfo.indexItems %}
{# TODO: move back this logic to SurveyRuntime, and provide a ready to use indexItem.statusClass #}
<li>
<div class="dropdown-header">
<div class="{{ aSurveyInfo.class.indexmenusddh }}" {{ aSurveyInfo.attr.indexmenusddh }}>
{{ flatEllipsizeText(group.text, true, 30, " &hellip; ", 0.6 ) }}
<span class="caret"></span>
<span class="{{ aSurveyInfo.class.indexmenusddspan }}" {{ aSurveyInfo.class.indexmenusddspan }}></span>
</div>
<ul class="dropdown-menu dropdown-sub-menu">
<ul class="{{ aSurveyInfo.class.indexmenusddul }}" {{ aSurveyInfo.attr.indexmenusddul }}>
{% for step, indexItem in group.questions %}
{% set statusClass = '' %}
{% if attribute(indexItem.stepStatus, 'index-item-unanswered') is defined and attribute(indexItem.stepStatus, 'index-item-unanswered') == true %}
Expand All @@ -94,7 +94,7 @@
{% if attribute(indexItem.stepStatus, 'index-item-current') is defined and attribute(indexItem.stepStatus, 'index-item-current') == true %}
{% set statusClass = statusClass ~ ' disabled' %}
{% endif %}
<li class="{{ indexItem.coreClass }} {{statusClass}}">
<li class="{{ indexItem.coreClass }} {{statusClass}}" {{ aSurveyInfo.attr.indexmenussli }}>
<a href='{{ indexItem.url }}' data-limesurvey-submit='{{ indexItem.submit }}'>
{{ flatEllipsizeText(indexItem.text, true, 30, " &hellip; ", 0.6 ) }}
</a>
Expand Down

0 comments on commit 20cd0b5

Please sign in to comment.