Remove some dead code, make sidebar toggle animated

This commit is contained in:
Luka Murn 2018-05-27 16:24:47 +02:00
parent b86edf20a5
commit b3ae1d8fa6
6 changed files with 21 additions and 81 deletions

View file

@ -170,7 +170,7 @@ function initializeEdit() {
// Hide sidebar & also its toggle button
$("#wrapper").addClass("hidden2");
$("#wrapper").find(".sidebar-header-toggle").hide();
$("#sideBarButton").addClass("hidden2");
$(".navbar-secondary").addClass("navbar-without-sidebar");
// Also, hide zoom levels button group

View file

@ -3,8 +3,6 @@
global.SideBarToggle = (function() {
function show() {
$('#sideBarLeft').show();
$('#sideBarRight').hide();
$('#sidebar-wrapper').show(
'slide', { direction: 'right', easing: 'linear' }, 400
);
@ -16,8 +14,6 @@
}
function hide() {
$('#sideBarLeft').hide();
$('#sideBarRight').show();
$('#sidebar-wrapper').hide(
'slide', { direction: 'left', easing: 'linear'}, 400
);

View file

@ -37,51 +37,6 @@ $toggle-btn-size: 50px;
#slide-panel {
height: 100%;
.sidebar-header {
height: $toggle-btn-size;
background: $brand-primary;
border-bottom: 2px solid darken($brand-primary, 10%);
.sidebar-header-title {
width: inherit;
color: $color-white;
display: inline-block;
margin-left: 15px;
margin-top: 6px;
text-transform: uppercase;
max-width: ($wrapper-width - $toggle-btn-size);
overflow: hidden;
text-overflow: ellipsis;
opacity: 1;
// Animations
@include transition(opacity 0.5s ease);
}
}
.sidebar-header-toggle {
height: $toggle-btn-size;
width: $toggle-btn-size;
margin-left: ($wrapper-width - $toggle-btn-size);
margin-top: -$toggle-btn-size;
font-size: $font-size-h3;
background: $brand-primary;
border-left: 2px solid darken($brand-primary, 10%);
border-bottom: 2px solid darken($brand-primary, 10%);
// Animations
@include transition(margin-left 0.5s ease);
span {
margin: 10px;
color: $color-white;
// Animations
@include rotate-animation(0.5s, 180deg);
@include transition(color 0.5s ease);
}
}
.tree {
margin-bottom: 0;
opacity: 1;
@ -103,29 +58,6 @@ $toggle-btn-size: 50px;
width: 0;
#slide-panel {
.sidebar-header .sidebar-header-title {
width: 0;
opacity: 0;
@include transition(width 0.5s ease);
@include transition(opacity 0.5s ease);
}
.sidebar-header-toggle {
margin-left: 0;
background: none;
border: none;
@include transition(margin-left 0.5s ease);
span {
color: darken($brand-primary, 10%);
@include rotate-animation(0.5s, 0deg);
@include transition(color 0.5s ease);
}
}
.tree {
opacity: 0;

View file

@ -65,10 +65,22 @@
}
}
#sideBarButton > span {
@include rotate-animation(0.5s, 0deg);
}
#sideBarButton[data-shown] > span {
@include rotate-animation(0.5s, 180deg);
}
#sideBarButton:hover {
background-color: $color-concrete;
cursor: pointer;
}
#sideBarButton.hidden2 {
visibility: hidden;
}
}
@media(max-height:510px) {

View file

@ -24,4 +24,10 @@ module LeftMenuBarHelper
def activities_are_selected?
controller_name == 'activities'
end
def navigation_sidebar_shown?
projects_are_selected? ||
repositories_are_selected? ||
settings_are_selected?
end
end

View file

@ -65,21 +65,15 @@
<% end %>
</li>
<!-- arrow for opening/closing -->
<li class="text-center"
<li class="text-center <%= navigation_sidebar_shown? ? '' : 'hidden2' %>"
style="padding: 5px;"
id="sideBarButton"
data-shown=""
onclick="SideBarToggle.toggle()"
>
<span id="sideBarLeft"
class="fas fa-chevron-left"
<span class="fas fa-chevron-right"
aria-hidden="false"
></span>
<span id="sideBarRight"
class="fas fa-chevron-right"
aria-hidden="true"
style="display:none;"
></span>
</li>
</ul>
</div>