Skip to content

Commit

Permalink
Dev: some more redesign. Some bugfixing with the sidemenu always moving
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Nov 25, 2016
1 parent 85de30a commit d8f934c
Show file tree
Hide file tree
Showing 10 changed files with 1,010 additions and 76 deletions.
2 changes: 1 addition & 1 deletion application/config/third_party.php
Expand Up @@ -304,7 +304,7 @@
'dist/jquery.fancytree-all.js'
),
'css' => array(
'dist/skin-bootstrap/ui.fancytree.min.css'
'dist/skin-bootstrap-ls/ui.fancytree.css'
),
),

Expand Down
8 changes: 2 additions & 6 deletions application/controllers/admin/questiongroups.php
Expand Up @@ -534,11 +534,7 @@ public function getGroupExplorerDatas($surveyid, $language)

$aGroupArray["key"] = $aGroup->gid; // The key is used by fancy tree to build the node id.
$aGroupArray["gid"] = $aGroup->gid;
$aGroupArray["title"] = ( // The title will be shown as text, but be truncated to max 28 letters
(mb_strlen($aGroup->sanitized_group_name, Yii::app()->charset) > 26)
? mb_substr($aGroup->sanitized_group_name, 0, 23, Yii::app()->charset).""
: $aGroup->sanitized_group_name
);
$aGroupArray["title"] = $aGroup->sanitized_group_name; //shortening the name is a css thing now
$aGroupArray["folder"] = true; // Means it's a node with children
$aGroupArray["href"] = Yii::app()->createUrl('admin/questiongroups/sa/view/', array('surveyid' => $iSurveyID, 'gid' => $aGroup->gid)); // Means it's a node with children
$aGroupArray['extraClasses'] = 'lsi-tree-group-item';
Expand Down Expand Up @@ -573,7 +569,7 @@ public function getGroupExplorerDatas($surveyid, $language)
$aDatasQuestions = array(); // The indexed array that will contain questions
$aDatasQuestions["key"] = $oQuestion->qid;
$aDatasQuestions["gid"] = $aGroup->gid;
$aDatasQuestions["title"] = $oQuestion->sanitized_title . ' : ' . $oQuestion->getEllipsized_question(20);
$aDatasQuestions["title"] = "[".$oQuestion->sanitized_title . '] ' . $oQuestion->sanitized_question;
$aDatasQuestions['href'] = Yii::app()->createUrl('admin/questions/sa/view/', array('surveyid' => $surveyid, 'gid' => $aGroup->gid, 'qid' => $oQuestion->qid));
$aDatasQuestions['toggle'] = 'tooltip';
$aDatasQuestions['placement'] = 'bottom';
Expand Down
94 changes: 44 additions & 50 deletions application/views/admin/super/sidemenu.php
Expand Up @@ -113,7 +113,6 @@
<!-- Main Menu -->
<div class="side-menu-container hidden-xs">
<!-- Add new Questiongroup, add new Question => quickadd -->
<ul class="nav navbar-nav sidemenuscontainer hidden-xs" style="">
<div class="container-fluid" id="quickadd-button-bar">
<div class="row">
<div class="col-xs-8">
Expand All @@ -136,17 +135,52 @@
</div>
</div>
</div>

<ul class="nav navbar-nav sidemenuscontainer hidden-xs" style="">
<!-- Question & Groups-->
<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="caret"></span>
</a>

<ul class="nav navbar-nav dropdown-first-level">
<?php if($permission):?>
<!-- List Groups -->
<li class="toWhite <?php if( isset($sidemenu["listquestiongroups"]) ) echo 'active'; ?>">
<!-- admin/survey/sa/view/surveyid/838454 listquestiongroups($iSurveyID)-->
<a href="<?php echo $this->createUrl("admin/survey/sa/listquestiongroups/surveyid/$surveyid"); ?>">
<span class="glyphicon glyphicon-list"></span>
<?php eT("List question groups");?>
</a>
</li>

<!-- List Questions -->
<li class="toWhite <?php if( isset($sidemenu["listquestions"]) ) echo 'active'; ?>">
<a href="<?php echo $this->createUrl("admin/survey/sa/listquestions/surveyid/$surveyid"); ?>">
<span class="glyphicon glyphicon-list"></span>
<?php eT("List questions");?>
</a>
</li>
<?php endif; ?>

<!-- Organize questions -->
<?php if($surveycontentupdate):?>
<?php if ($activated):?>
<li class="disabled">
<a href='#'>
<span class="icon-organize"></span>
<span class="btntooltip" data-toggle="tooltip" data-placement="bottom" title="<?php echo gT("Question group/question organizer disabled").' - '.gT("This survey is currently active."); ?>">
<?php eT("Question organizer"); ?>
</span>
</a>
</li>
<?php else: ?>
<li>
<a href="<?php echo $this->createUrl("admin/survey/sa/organize/surveyid/$surveyid"); ?>">
<span class="icon-organize"></span>
<?php eT("Question organizer"); ?>
</a>
</li>
<?php endif; ?>
<?php endif;?>
<!-- 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">
<div id="dropdown-lvl1" >
<div class="panel-body">
<!-- Explorer -->
<?php $this->renderPartial( "/admin/super/_question_explorer", array(
'sidemenu' => $sidemenu,
Expand All @@ -157,49 +191,9 @@
'iQuestionId' => $activeQuestion,
'iQuestionGroupId' => $activeQuestionGroup,
)); ?>
<ul class="nav navbar-nav dropdown-first-level">
<?php if($permission):?>
<!-- List Groups -->
<li class="toWhite <?php if( isset($sidemenu["listquestiongroups"]) ) echo 'active'; ?>">
<!-- admin/survey/sa/view/surveyid/838454 listquestiongroups($iSurveyID)-->
<a href="<?php echo $this->createUrl("admin/survey/sa/listquestiongroups/surveyid/$surveyid"); ?>">
<span class="glyphicon glyphicon-list"></span>
<?php eT("List question groups");?>
</a>
</li>

<!-- List Questions -->
<li class="toWhite <?php if( isset($sidemenu["listquestions"]) ) echo 'active'; ?>">
<a href="<?php echo $this->createUrl("admin/survey/sa/listquestions/surveyid/$surveyid"); ?>">
<span class="glyphicon glyphicon-list"></span>
<?php eT("List questions");?>
</a>
</li>
<?php endif; ?>

<!-- Organize questions -->
<?php if($surveycontentupdate):?>
<?php if ($activated):?>
<li class="disabled">
<a href='#'>
<span class="icon-organize"></span>
<span class="btntooltip" data-toggle="tooltip" data-placement="bottom" title="<?php echo gT("Question group/question organizer disabled").' - '.gT("This survey is currently active."); ?>">
<?php eT("Question organizer"); ?>
</span>
</a>
</li>
<?php else: ?>
<li>
<a href="<?php echo $this->createUrl("admin/survey/sa/organize/surveyid/$surveyid"); ?>">
<span class="icon-organize"></span>
<?php eT("Question organizer"); ?>
</a>
</li>
<?php endif; ?>
<?php endif;?>
</ul>
</div>
</div>
</ul>
</li>

<!-- Token -->
Expand Down
8 changes: 4 additions & 4 deletions scripts/admin/jquery.fancytree.bsbuttonbar.js
Expand Up @@ -27,18 +27,18 @@
iconElement = span.find('.fancytree-icon'),
titleElement = span.find('.fancytree-title');
//Add the bootstrap classes
expandElement.addClass('col-xs-1 font-huge');
expandElement.addClass('col-xs-3 font-huge');
iconElement.addClass('col-xs-2 font-huge');
titleElement.addClass('col-xs-10');
titleElement.addClass('col-xs-9');
//combine in row-wrapper
wrapperElement
.append(iconElement)
.append(titleElement);

if(expandElement.hasClass('fa')){
wrapperElement.append(expandElement);
titleElement.removeClass('col-xs-10');
titleElement.addClass('col-xs-9');
titleElement.removeClass('col-xs-9');
titleElement.addClass('col-xs-7');
}
//combine in outer wrapper
wrapperContainerElement.append( wrapperElement );
Expand Down
27 changes: 16 additions & 11 deletions styles/Sea_Green/css/lime-admin-common.css
Expand Up @@ -619,9 +619,14 @@ div.panel.disabled {
box-shadow: none; }
.side-menu .navbar-header {
width: 100%; }
.side-menu .navbar-nav li {
.side-menu .navbar-nav {
display: block;
width: 100%; }
.side-menu .navbar-nav li ,
.side-menu .navbar-nav ul {
display: block;
width: 100%;
overflow: hidden;}
.side-menu .navbar-nav li a:not(.btn) {
padding: 15px; }
.side-menu .navbar-nav li a .glyphicon {
Expand Down Expand Up @@ -733,12 +738,14 @@ div.panel.disabled {
width:100%;
clear: both;
}
#fancytree ul.fancytree-container{
border: 0;
}
#fancytree.fancytree-ext-filter-hide ul span.fancytree-node.fancytree-hide,
#fancytree.fancytree-ext-filter-hide ul tr.fancytree-hide{
display: none;
}


#fancytree>ul>li>span {
padding: 12px 2px;
display: block;
Expand All @@ -752,8 +759,11 @@ div.panel.disabled {
font-weight: 400;
}

#fancytree ul>li .lsi-tree-question-item .fancytree-title{
white-space: pre-wrap;
#fancytree .lsi-tree-question-item .fancytree-title{
white-space: nowrap;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
margin: initial;
}
#fancytree .fancytree-innerhtml-buttonbar{
Expand All @@ -777,9 +787,6 @@ div.panel.disabled {
box-shadow: none;
}

.side-menu .navbar-nav #explorer ul {
font-size: 0.9em;
}
.side-menu .navbar-nav #explorer ul li{
padding-left: 1px;
}
Expand All @@ -790,10 +797,8 @@ div.panel.disabled {
border-radius: 0;
background-color: transparent;
box-shadow: none; }

#sideMenuContainer{
padding-bottom: 62px;
}


#sideMenu {
min-height: 700px;
overflow: hidden; }
Expand Down
10 changes: 6 additions & 4 deletions styles/Sea_Green/scripts/sidemenu.js
Expand Up @@ -185,8 +185,10 @@ var WindowBindings = function(){
//methods
//Stick the side menu and the survey bar to the top
onWindowScroll = function(e){
$toTop = (surveybar.offset().top - $(window).scrollTop());

var $toTop = (surveybar.offset().top - $(window).scrollTop());
console.log(upperContainer.offset());
var topPosition = upperContainer.offset().top;
sidemenuContainer.css({position:"fixed", top: topPosition});
if($toTop <= 0)
{
surveybar.addClass('navbar-fixed-top');
Expand All @@ -202,9 +204,9 @@ var WindowBindings = function(){
},
//fixSizings
onWindowResize = function(){
maxHeight = ($('footer').position().top - ($('#surveybarid').position().top +$('#surveybarid').height()));
maxHeight = ($('footer').position().top - (surveybar.position().top +surveybar.height()));
//maxHeightInside = (maxHeight - $('#in_survey_common').offset().top-2);
sidemenu.css({'max-height': maxHeight, overflow: 'auto'});
sidemenu.css({'max-height': maxHeight, "overflow-y": 'auto'});
sidemenuContainer.css({'max-height': (maxHeight)});
}
onWindowResize();
Expand Down

0 comments on commit d8f934c

Please sign in to comment.