Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@
{{ partial "breadcrumbs.html" . }}

<div id="content">
<div class="container">
<div class="row">
<div class="container content-container">
<div class="content-layout" data-sidebar-layout>
<div class="content-layout__toolbar">
<button class="sidebar-toggle" type="button" data-sidebar-toggle
aria-controls="content-sidebar" aria-expanded="true" hidden>
<i class="fas fa-columns" aria-hidden="true"></i>
<span data-sidebar-toggle-label>Hide sidebar</span>
</button>
</div>
<div class="row">
<!-- *** LEFT COLUMN *** -->

<div class="col-md-9" id="blog-listing-medium">
<div class="col-md-9 content-layout__main" id="blog-listing-medium">
{{ $paginator := .Paginate (where .Data.Pages "Type" "blog") }}
{{ range $paginator.Pages }}
<section class="post">
Expand Down Expand Up @@ -94,7 +102,7 @@ <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<!-- *** RIGHT COLUMN ***
_________________________________________________________ -->

<aside class="col-md-3 content-sidebar" aria-label="Browse and filter">
<aside class="col-md-3 content-sidebar" id="content-sidebar" aria-label="Browse and filter">

<!-- *** MENUS AND WIDGETS *** -->

Expand All @@ -107,8 +115,10 @@ <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>

<!-- *** RIGHT COLUMN END *** -->

</div>
<!-- /.row -->
</div>
<!-- /.row -->
<!-- /.content-layout -->
</div>
<!-- /.container -->
</div>
Expand Down
23 changes: 18 additions & 5 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@
{{ partial "breadcrumbs.html" . }}

<div id="content">
<div class="container">
<div class="container content-container">

<div class="row">
<div class="content-layout" data-sidebar-layout>

<div class="content-layout__toolbar">
<button class="sidebar-toggle" type="button" data-sidebar-toggle
aria-controls="content-sidebar" aria-expanded="true" hidden>
<i class="fas fa-columns" aria-hidden="true"></i>
<span data-sidebar-toggle-label>Hide sidebar</span>
</button>
</div>

<div class="row">

<!-- *** LEFT COLUMN *** -->

<div class="col-md-9" id="blog-post">
<div class="col-md-9 content-layout__main" id="blog-post">

{{ if or .Params.author .Params.date }}
<p class="text-muted text-uppercase mb-small text-right">
Expand Down Expand Up @@ -54,7 +64,7 @@

<!-- *** RIGHT COLUMN *** -->

<aside class="col-md-3 content-sidebar" aria-label="Related content">
<aside class="col-md-3 content-sidebar" id="content-sidebar" aria-label="Related content">

<!-- *** MENUS AND WIDGETS *** -->

Expand All @@ -67,8 +77,11 @@

<!-- *** RIGHT COLUMN END *** -->

</div>
<!-- /.row -->

</div>
<!-- /.row -->
<!-- /.content-layout -->

</div>
<!-- /.container -->
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/headers.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<!-- Custom stylesheet - for your changes -->
<link href="{{ "css/custom.css" | relURL}}" rel="stylesheet">
<script src="{{ "js/table-enhancements.js" | relURL}}" defer></script>
<script src="{{ "js/sidebar-toggle.js" | relURL}}" defer></script>

<!-- Responsivity for older IE -->
{{ `
Expand Down
56 changes: 56 additions & 0 deletions static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,58 @@ h3.text-uppercase {
padding-top: 52px;
}

/* Give long-form content more of the viewport while keeping comfortable gutters. */
@media (min-width: 1200px) {
#content .content-container {
max-width: 1420px;
width: calc(100% - 64px);
}
}

.content-layout__toolbar {
display: flex;
justify-content: flex-end;
margin: -20px 0 18px;
}

.sidebar-toggle {
align-items: center;
background: var(--surface);
border: 1px solid #cbd8de;
border-radius: 999px;
color: #40545f;
display: inline-flex;
font-size: 13px;
font-weight: 700;
gap: 8px;
padding: 7px 13px;
transition: background-color 160ms ease, border-color 160ms ease,
color 160ms ease, box-shadow 160ms ease;
}

.sidebar-toggle[hidden] {
display: none;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
background: var(--primary-accent-light);
border-color: #9fd7e0;
color: var(--primary-accent-dark);
}

.content-layout__main {
transition: width 220ms ease;
}

.content-layout.is-sidebar-hidden .content-layout__main {
width: 100%;
}

.content-layout.is-sidebar-hidden .content-sidebar {
display: none;
}

#content h2,
#content h3 {
margin-top: 1.6em;
Expand Down Expand Up @@ -1260,6 +1312,10 @@ ul ul {
padding-top: 36px;
}

.content-layout__toolbar {
margin-top: -12px;
}

.community_logo {
float: none;
margin: 0 auto 20px;
Expand Down
46 changes: 46 additions & 0 deletions static/js/sidebar-toggle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
(function () {
"use strict";

var storageKey = "misp-content-sidebar-hidden";
var layouts = document.querySelectorAll("[data-sidebar-layout]");

function savedPreference() {
try {
return window.localStorage.getItem(storageKey) === "true";
} catch (error) {
return false;
}
}

function savePreference(isHidden) {
try {
window.localStorage.setItem(storageKey, String(isHidden));
} catch (error) {
// The control still works when browser storage is unavailable.
}
}

Array.prototype.forEach.call(layouts, function (layout) {
var button = layout.querySelector("[data-sidebar-toggle]");
var label = layout.querySelector("[data-sidebar-toggle-label]");

if (!button || !label) {
return;
}

function setSidebar(hidden) {
layout.classList.toggle("is-sidebar-hidden", hidden);
button.setAttribute("aria-expanded", String(!hidden));
label.textContent = hidden ? "Show sidebar" : "Hide sidebar";
}

setSidebar(savedPreference());
button.hidden = false;

button.addEventListener("click", function () {
var hidden = !layout.classList.contains("is-sidebar-hidden");
setSidebar(hidden);
savePreference(hidden);
});
});
}());
Loading