Skip to content

Commit

Permalink
UI: Sidebar improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
helgihg committed Jul 3, 2018
1 parent caae8a4 commit fd78129
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 26 deletions.
2 changes: 2 additions & 0 deletions core/static/css/_constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ $secondary-family: $font-text;

$color-btn-light: #eee;
$color-btn-primary: lighten($piratepurple, 10%);

$sidebar-width: 290px;
36 changes: 27 additions & 9 deletions core/static/css/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
left: $sidebar-width;
width: 0;
height: 100%;
margin-left: -250px;
margin-left: -$sidebar-width;
overflow-y: auto;
background: $background-lightgray;
-webkit-transition: all 0.5s ease;
Expand All @@ -22,20 +22,34 @@
}

#wrapper.toggled #sidebar-wrapper {
width: 250px;
width: $sidebar-width;
}

.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
width: $sidebar-width;
margin: 0;
padding: 0;
list-style: none;
}

.sidebar-nav .dropdown-menu {
width: $sidebar-width;
}

.sidebar-nav .dropdown-menu li {
text-indent: 0px;
border-bottom: 1px solid $background-lightgray;
}

.sidebar-nav .dropdown-menu li > a {
white-space: normal;
padding-left: 10px;
}

.sidebar-nav li {
text-indent: 20px;
text-indent: 10px;
line-height: 40px;
}

Expand All @@ -59,6 +73,10 @@
background: #ddd;
}

.sidebar-nav li > span.label {
margin-left: 10px;
}

.navbar-toggle {
float: left;
margin-left: 12px;
Expand All @@ -73,15 +91,15 @@

@media(min-width:768px) {
#wrapper {
padding-left: 250px;
padding-left: $sidebar-width;
}
#wrapper.toggled {
padding-left: 250px;
padding-left: $sidebar-width;
}
#sidebar-wrapper {
width: 250px;
width: $sidebar-width;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px;
width: $sidebar-width;
}
}
36 changes: 23 additions & 13 deletions core/static/css/application.css

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

2 changes: 1 addition & 1 deletion core/static/css/application.css.map

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions polity/contextprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ def add_to_menulist(polity_menulist, polity, depth):
add_to_menulist(polity_menulist, subpolity, depth + 1)

# Add "root" polities with a depth of 0.
for polity in Polity.objects.filter(parent_id=None):
add_to_menulist(polity_menulist, polity, 0)
root_polities = Polity.objects.filter(parent_id=None)
if len(root_polities) == 1:
# If there is only one root polity, we'll only want to add its
# children, and not the root polity itself.
for subpolity in parent_children_map[root_polities[0].id]:
add_to_menulist(polity_menulist, subpolity, 0)
else:
for root_polity in root_polities:
add_to_menulist(polity_menulist, root_polity, 0)

ctx = {
'polity_menulist': polity_menulist,
Expand Down
2 changes: 1 addition & 1 deletion wasa2il/templates/_sidenav_polity.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{polity.name}}
</a></li>
{% else %}
<li class="dropdown" style="font-size: 115%;">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fas fa-users"></i>
{{polity.name}}
Expand Down

0 comments on commit fd78129

Please sign in to comment.