Skip to content

Commit

Permalink
Dev: Open question explorer when viewing a question
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jan 20, 2016
1 parent b00b65d commit cd422f5
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 33 deletions.
10 changes: 5 additions & 5 deletions application/controllers/admin/questions.php
Expand Up @@ -96,14 +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;
$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['sidemenu']['explorer']['state'] = true;
$aData['sidemenu']['explorer']['gid'] = $gid;
$aData['sidemenu']['explorer']['qid'] = $qid;


$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
Expand Down
56 changes: 39 additions & 17 deletions application/views/admin/super/_question_explorer.php
Expand Up @@ -12,8 +12,8 @@
<?php if(isset($sidemenu['explorer']['state']) && $sidemenu['explorer']['state']==true):?>
<input type="hidden" id="open-explorer" />

<?php if(isset($sidemenu['explorer']['questiongroup'])):?>
<input type="hidden" id="open-questiongroup" data-gid="<?php echo $sidemenu['explorer']['questiongroup'];?>" />
<?php if(isset($sidemenu['explorer']['gid'])):?>
<input type="hidden" id="open-questiongroup" data-gid="<?php echo $sidemenu['explorer']['gid'];?>" />
<?php endif;?>
<?php endif;?>

Expand Down Expand Up @@ -57,21 +57,43 @@
<?php if(count($aGroup['aQuestions'])):?>
<?php foreach($aGroup['aQuestions'] as $question):?>
<?php if($question->parent_qid == 0):?>
<a href="<?php echo $this->createUrl("/admin/questions/sa/view/surveyid/$iSurveyId/gid/".$aGroup->gid."/qid/".$question->qid); ?>">
<span class="question-collapse-title">
<span class="glyphicon glyphicon-list"></span>
<strong>
<?php echo sanitize_html_string(strip_tags($question->title));?>
</strong>
<br/>
<em>
<?php
templatereplace($question->question, array(),$aReplacementData,'Unspecified', false ,$question->qid);
echo viewHelper::stripTagsEM(LimeExpressionManager::GetLastPrettyPrintExpression());
?>
</em>
</span>
</a>

<!-- Active question -->
<?php if(isset($sidemenu['explorer']['qid']) && $question->qid == $sidemenu['explorer']['qid']): ?>
<div class="question-link active" >
<span class="question-collapse-title">
<span class="glyphicon glyphicon-list"></span>
<strong>
<?php echo sanitize_html_string(strip_tags($question->title));?>
</strong>
<br/>
<em>
<?php
templatereplace($question->question, array(),$aReplacementData,'Unspecified', false ,$question->qid);
echo viewHelper::stripTagsEM(LimeExpressionManager::GetLastPrettyPrintExpression());
?>
</em>
</span>
</div>

<!-- Other questions -->
<?php else: ?>
<a href="<?php echo $this->createUrl("/admin/questions/sa/view/surveyid/$iSurveyId/gid/".$aGroup->gid."/qid/".$question->qid); ?>" class="question-link" >
<span class="question-collapse-title">
<span class="glyphicon glyphicon-list"></span>
<strong>
<?php echo sanitize_html_string(strip_tags($question->title));?>
</strong>
<br/>
<em>
<?php
templatereplace($question->question, array(),$aReplacementData,'Unspecified', false ,$question->qid);
echo viewHelper::stripTagsEM(LimeExpressionManager::GetLastPrettyPrintExpression());
?>
</em>
</span>
</a>
<?php endif; ?>
<?php endif; ?>
<?php endforeach;?>
<?php else:?>
Expand Down
1 change: 1 addition & 0 deletions application/views/admin/super/sidemenu.php
Expand Up @@ -80,6 +80,7 @@
<ul class="nav navbar-nav dropdown-first-level">
<!-- Explorer -->
<?php $this->renderPartial( "/admin/super/_question_explorer", array(
'sidemenu' => $sidemenu,
'aGroups' => $aGroups,
'iSurveyId' => $surveyid,
'bSurveyIsActive' => $bSurveyIsActive
Expand Down
20 changes: 12 additions & 8 deletions styles/Black_Pearl/css/lime-admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions styles/Black_Pearl/scripts/sidemenu.js
Expand Up @@ -273,16 +273,22 @@ $(document).ready(function(){

if ( $("#open-explorer").length ) {
$('#explorer-lvl1').collapse({"toggle": true, 'parent': '#explorer'});
if ( $sidemenu.hasClass('fixed-top'))
{
toTop = ( $(window).scrollTop() + 45 ); // 45px is the heigh of the top menu bar
$sidemenu.css({position:"absolute", top: toTop+"px"});
}
$sidemenu.addClass('exploring');
}

if ( $("#open-questiongroup").length ) {
$gid = $("#open-questiongroup").data('gid');

$questionGroup = $('#questions-group-'+$gid);
$groupCaret = $('#caret-'+$gid);
$questionGroup.toggle(500);
$questionGroup.toggle(0);
$groupCaret.toggleClass('fa-caret-right');
$groupCaret.toggleClass('fa-caret-down');
$groupCaret.toggleClass('fa-caret-down');

}

Expand All @@ -294,7 +300,6 @@ $(document).ready(function(){
$sidemenu.css({position:"absolute", top: toTop+"px"});
}
$sidemenu.addClass('exploring');

});

$explorer.on('hidden.bs.collapse', function(){
Expand Down

0 comments on commit cd422f5

Please sign in to comment.