Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
improve sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Nov 13, 2022
1 parent 44c38f8 commit ec2b0a3
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 143 deletions.
25 changes: 16 additions & 9 deletions pyra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
# - integer (integer)
# - digits (string)
_CONFIG_SPEC_DICT = dict(
Hidden=dict(
Info=dict(
type='section',
name=_('Hidden'),
description=_('These options should be hidden from the user interface.'),
name=_('Info'),
description=_('For information purposes only.'),
icon='info',
CONFIG_VERSION=dict(
type='integer',
name=_('Config version'),
Expand All @@ -60,19 +61,22 @@
min=0,
max=0, # increment when updating config
data_parsley_type='integer',
extra_class='col-md-1',
extra_class='col-md-3',
locked=True,
),
FIRST_RUN_COMPLETE=dict(
type='boolean',
name=_('First run complete'),
description=_('Todo: Indicates if the user has completed the initial setup.'),
default=False,
locked=True,
),
),
General=dict(
type='section',
name=_('General'),
description=_('General settings.'),
icon='gear',
LOCALE=dict(
type='option',
name=_('Locale'),
Expand All @@ -86,7 +90,7 @@
f'English ({_("English")})',
f'Español ({_("Spanish")})',
],
extra_class='col-md-3',
extra_class='col-lg-6',
),
LAUNCH_BROWSER=dict(
type='boolean',
Expand All @@ -105,6 +109,7 @@
type='section',
name=_('Logging'),
description=_('Logging settings.'),
icon='file-code',
LOG_DIR=dict(
type='string',
name=_('Log directory'),
Expand All @@ -114,7 +119,7 @@
else r'^\/(?:[^/]+\/)*$ ',
# https://regexpattern.com/windows-folder-path/
# https://regexpattern.com/linux-folder-path/
extra_class='col-md-6',
extra_class='col-lg-8',
),
DEBUG_LOGGING=dict(
type='boolean',
Expand All @@ -128,6 +133,7 @@
type='section',
name=_('Network'),
description=_('Network settings.'),
icon='network-wired',
HTTP_HOST=dict(
type='string',
name=_('HTTP host address'),
Expand All @@ -137,7 +143,7 @@
data_parsley_pattern=r'\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}'
r'(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b',
# https://codverter.com/blog/articles/tech/20190105-extract-ipv4-ipv6-ip-addresses-using-regex.html
extra_class='col-md-2',
extra_class='col-md-4',
),
HTTP_PORT=dict(
type='integer',
Expand All @@ -148,20 +154,21 @@
min=21,
max=65535,
data_parsley_type='integer',
extra_class='col-md-1',
extra_class='col-md-3',
),
HTTP_ROOT=dict(
type='string',
name=_('HTTP root'),
beta=True,
description=_('Todo: The base URL of the web server. Used for reverse proxies.'),
extra_class='col-md-4',
extra_class='col-lg-6',
),
),
Updater=dict(
type='section',
name=_('Updater'),
description=_('Updater settings.'),
icon='arrows-spin',
AUTO_UPDATE=dict(
type='boolean',
name=_('Auto update'),
Expand Down
156 changes: 61 additions & 95 deletions web/css/sidebar.css
Original file line number Diff line number Diff line change
@@ -1,140 +1,106 @@
/*sidebar*/
/*!
* Start Bootstrap - Simple Sidebar (https://startbootstrap.com/template-overviews/simple-sidebar)
* Copyright 2013-2017 Start Bootstrap
* Licensed under MIT
(https://github.com/BlackrockDigital/startbootstrap-simple-sidebar/blob/master/LICENSE)
*/

#menu-toggle {
color: white;
position: absolute;
top: 10px;
left: 10px;
background: black;
}

/*https://codepen.io/lfrichter/pen/mQJJyB*/
#wrapper {
padding-left: 250px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}

#wrapper.toggled {
padding-left: 0;
#wrapper.sidebar-expanded {
padding-left: 250px;
}

#wrapper.sidebar-collapsed {
padding-left: 80px;
}

#sidebar-wrapper {
top: 80px;
position: fixed;
left: 250px;
width: 250px;
height: 100%;
margin-left: -250px;
height: 100vh;
background-color: #151515;
/*padding: 0;*/
overflow-y: scroll;
overflow-x: hidden;
background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}

#wrapper.toggled #sidebar-wrapper {
width: 0;
#sidebar-wrapper.sidebar-expanded {
width: 250px;
left: 250px;
margin-left: -250px;
}

#page-content-wrapper {
/*calc method - https://stackoverflow.com/a/14101451/11214013*/
width: calc(100% - 250px);
position: absolute;
padding: 50px;
#sidebar-wrapper.sidebar-collapsed {
width: 80px;
left: 80px;
margin-left: -80px;
}

#wrapper.toggled #page-content-wrapper {
#page-content-wrapper {
position: absolute;
margin-right: -250px;
width: 100%;
padding: 10px;
}

/* Sidebar Styles */

.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
list-style: none;
#page-content-wrapper.sidebar-expanded {
/*calc method - https://stackoverflow.com/a/14101451/11214013*/
width: -moz-calc(100% - 250px); /* Firefox */
width: -webkit-calc(100% - 250px); /* WebKit */
width: -o-calc(100% - 250px); /* Opera */
width: calc(100% - 250px); /* Standard */
}

.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
#page-content-wrapper.sidebar-collapsed {
/*calc method - https://stackoverflow.com/a/14101451/11214013*/
width: -moz-calc(100% - 80px); /* Firefox */
width: -webkit-calc(100% - 80px); /* WebKit */
width: -o-calc(100% - 80px); /* Opera */
width: calc(100% - 80px); /* Standard */
}

.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
/* ----------| Menu item*/
#sidebar-wrapper .list-group a {
height: 50px;
color: white;
}

.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255, 255, 255, 0.2);
/* ----------| Submenu item*/
#sidebar-wrapper .list-group li.list-group-item {
background-color: #151515;
}

.sidebar-nav li a:active, .sidebar-nav li a:focus {
text-decoration: none;
#sidebar-wrapper .list-group .sidebar-submenu a {
height: 45px;
padding-left: 30px;
}

.sidebar-nav>.sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
.sidebar-submenu {
font-size: 0.9rem;
}

.sidebar-nav>.sidebar-brand a {
color: #999999;
/* ----------| Separators */
.sidebar-separator-title {
background-color: #151515;
height: 35px;
}

.sidebar-nav>.sidebar-brand a:hover {
color: #fff;
background: none;
.sidebar-separator {
background-color: #151515;
height: 25px;
}

/**
@media(min-width:768px) {
#wrapper {
padding-left: 0;
}
#wrapper.toggled {
padding-left: 0px;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled
#sidebar-wrapper {
width: 250px;
}
#page-content-wrapper {
padding-left: 50px;
position: relative;
}
.logo-separator {
background-color: #151515;
height: 60px;
}

#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
padding-left: 35px; }
a.bg-dark {
background-color: #151515 !important;
}

a.bg-dark:not(.no-hover):hover {
background-color: #303436 !important;
}
**/
33 changes: 19 additions & 14 deletions web/js/sidebar.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
$("#menu-toggle").click(function(e) {
e.preventDefault();
const isIE11 = !!navigator.userAgent.match(/Trident.*rv\:11\./);
//https://codepen.io/lfrichter/pen/mQJJyB

$("#toggleIcon").toggleClass("fa fa-angle-double-left fa fa-angle-double-right");
let wrapper = $("#wrapper")
wrapper.toggleClass("toggled");
// Collapse/Expand icon
button = $('#collapse-icon')
button.addClass('fa-xmark');

if(isIE11){
let sidebarWrapper = $("#sidebar-wrapper")
if(wrapper.hasClass("toggled")){
sidebarWrapper.css("margin-left", "-268px")
} else {
sidebarWrapper.css("margin-left", "-250px")
}
}
// Collapse click
$('[data-toggle=sidebar-collapse]').click(function() {
SidebarCollapse();
});

function SidebarCollapse () {
$('.sidebar-separator-title').toggleClass('invisible');
$('.menu-collapsed').toggleClass('d-none');
$('#wrapper').toggleClass('sidebar-expanded sidebar-collapsed');
$('#sidebar-wrapper').toggleClass('sidebar-expanded sidebar-collapsed');
$('#page-content-wrapper').toggleClass('sidebar-expanded sidebar-collapsed');
$('.sidebar-item').toggleClass('justify-content-start justify-content-center')

// Collapse/Expand icon
button.toggleClass('fa-xmark fa-bars');
}
Loading

0 comments on commit ec2b0a3

Please sign in to comment.