Skip to content

Commit

Permalink
Dev: open question explorer if ['explorer']['state']==true
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jan 19, 2016
1 parent 5c2579f commit 4953db1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
5 changes: 3 additions & 2 deletions application/controllers/admin/questions.php
Expand Up @@ -96,13 +96,14 @@ public function view($surveyid, $gid, $qid)
$questionsummary .= $this->getController()->renderPartial('/admin/survey/Question/questionbar_view', $aData, true);
$finaldata['display'] = $questionsummary;
$aData['display']['menu_bars']['gid_action'] = 'viewquestion';
$aData['questionbar']['buttons']['view'] = TRUE;

///////////
// sidemenu
$aData['sidemenu']['questiongroups'] = true;
$aData['sidemenu']['listquestions'] = true;

$aData['sidemenu']['question'] = true;
$aData['sidemenu']['question_name'] = $qrrow['title'].' : '.$qrrow['question'];
$aData['questionbar']['buttons']['view'] = TRUE;

$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
Expand Down
7 changes: 7 additions & 0 deletions application/views/admin/super/_question_explorer.php
Expand Up @@ -2,10 +2,17 @@
/**
* This view render the question explorer
*
* @var $sidemenu
* @var $aGroups
* @var $iSurveyId
*/
?>

<!-- State when page is loaded : for JavaScript-->
<?php if(isset($sidemenu['explorer']['state']) && $sidemenu['explorer']['state']==true):?>
<input type="hidden" id="open-explorer" />
<?php endif;?>

<li class="panel panel-default" id="explorer" class="dropdownlvl2 dropdownstyle">
<a data-toggle="collapse" id="explorer-collapse" href="#explorer-lvl1">
<span class="glyphicon glyphicon-folder-open"></span> <?php eT('Questions explorer');?>
Expand Down
13 changes: 7 additions & 6 deletions application/views/admin/super/sidemenu.php
@@ -1,12 +1,16 @@
<?php
/**
* Sidemenu
* This view displays the sidemenu on the left side, containing the question explorer
*
* Var to manage open/close state of the sidemenu, question explorer :
* @var $sidemenu['state'] : if set, the sidemnu is close
* @var $sidemenu['explorer']['state'] : if set to true, question explorer will be opened
*/
?>
<?php
// TODO : move to controller
$bSurveyIsActive = (isset($surveyIsActive))?$surveyIsActive:$oSurvey->active=='Y';
?>
<?php // print_r(get_defined_vars()); die();?>

<!-- State when page is loaded : for JavaScript-->
<?php if(isset($sidemenu['state'])):?>
Expand Down Expand Up @@ -67,11 +71,10 @@
<li class="panel panel-default dropdownlvl1" id="dropdown">
<a data-toggle="collapse" id="questions-groups-collapse" href="#dropdown-lvl1" <?php if( isset($sidemenu["questiongroups"]) ) echo 'aria-expanded="true"'; ?> >
<span class="glyphicon glyphicon-folder-open"></span> <?php eT('Questions and groups:');?>
<!-- <span class="glyphicon glyphicon-sort-by-order" id="sort-questions-button" aria-url="<?php echo $this->createUrl("admin/survey/sa/organize/surveyid/$surveyid"); ?>" ></span>-->
<span class="caret"></span>
</a>

<!-- Dropdown level 1 -->
<!-- Question Explorer -->
<div id="dropdown-lvl1" class="panel-collapse collapse <?php if( isset($sidemenu["questiongroups"]) || isset($sidemenu["listquestions"]) || 1==1 ) echo 'in'; ?>" <?php if( isset($sidemenu["questiongroups"]) || isset($sidemenu["listquestions"]) ) echo 'aria-expanded="true"'; ?> >
<div class="panel-body">
<ul class="nav navbar-nav dropdown-first-level">
Expand Down Expand Up @@ -119,8 +122,6 @@
</li>
<?php endif; ?>
<?php endif;?>


</ul>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions styles/Black_Pearl/scripts/sidemenu.js
Expand Up @@ -270,6 +270,11 @@ $(document).ready(function(){
var $explorer = $('#explorer');
var $sidemenu = $('#sideMenu');


if ( $("#open-explorer").length ) {
$('#explorer-lvl1').collapse({"toggle": true, 'parent': '#explorer'});
}

$explorer.on('shown.bs.collapse', function () {
// If the side bar is fixed to top, we must unfix it first
if ( $sidemenu.hasClass('fixed-top'))
Expand Down

0 comments on commit 4953db1

Please sign in to comment.