]> BookStack Code Mirror - website/commitdiff
Cleaned list design and other bits
authorDan Brown <redacted>
Sun, 12 Feb 2023 18:23:02 +0000 (18:23 +0000)
committerDan Brown <redacted>
Sun, 12 Feb 2023 18:23:02 +0000 (18:23 +0000)
Opened hack code blocks by default if only a few lines.
Added recent hacks to footer of back pages to fill them a bit.
Updated sidebar with alternate hacking links.
Set design for main hacks list.

content/hacks/_index.md [new file with mode: 0644]
themes/bookstack/layouts/hacks/list.html [new file with mode: 0644]
themes/bookstack/layouts/hacks/single.html
themes/bookstack/layouts/partials/list-hack.html [new file with mode: 0644]
themes/bookstack/layouts/shortcodes/hack.html
themes/bookstack/sass/styles.scss

diff --git a/content/hacks/_index.md b/content/hacks/_index.md
new file mode 100644 (file)
index 0000000..88b8949
--- /dev/null
@@ -0,0 +1,5 @@
+---
+title: "BookStack Hacks"
+url: "/hacks"
+---
+Hacks for BookStack
\ No newline at end of file
diff --git a/themes/bookstack/layouts/hacks/list.html b/themes/bookstack/layouts/hacks/list.html
new file mode 100644 (file)
index 0000000..48fa94b
--- /dev/null
@@ -0,0 +1,49 @@
+{{ partial "header.html" . }}
+
+{{ $baseurl := .Site.BaseURL }}
+
+<div class="shaded primary">
+       <div class="container hero padded-vertical">
+               <div class="row">
+                       <div class="col-sm-8 col-sm-offset-2">
+                               <h1 class="text-left">{{.Title}}</h1>
+                       </div>
+               </div>
+       </div>
+</div>
+
+<div class="container">
+
+       <div class="row">
+
+               <div class="col-sm-8 col-sm-offset-2">
+
+                       <p class="margins-vertical large">
+                               This part of the site lists available "hacks" that can be applied to customize
+                               BookStack or extend its functionality.
+                               These hacks are not official supported and can cause instability, introduce issues and may conflict with future updates. Apply at your own risk!  
+                       </p>
+
+                       <div class="margins-vertical large text-left">
+                               <a href="/hacks/applying/" target="_blank">Applying Hacks</a>
+                               <span class="inline block margins-horizontal muted">|</span>
+                               <a href="https://github.com/BookStackApp/hacks" target="_blank">Hacks Source Repo</a>
+                       </div>
+
+                       {{ $paginator := .Paginate (where .Pages "Params.Author" "!=" nil) }}
+
+                       <div class="hack-box-list">
+                       {{ range $paginator.Pages }}
+                               {{ partial "list-hack" .}}
+                       {{ end }}
+                       </div>
+               
+
+                       {{ partial "pagination" $paginator }}
+
+               </div>
+
+       </div>
+</div>
+
+{{ partial "footer.html" . }}
\ No newline at end of file
index 61ecde94e7c4fb2c8037caedb4479bdec30e497f..6a2c7d9f3e4e4744ef27713a679ab275de25db82 100644 (file)
           <li><a href="/hacks/applying/">Applying Hacks</a></li>
           <li><a href="https://github.com/BookStackApp/hacks">Hacks Source Repo</a></li>
         </ul>
-        <div>
-          <h4>Latest Hacks</h4>
-        </div>
-        <ul>
+      </div>
+      <div>
+        <h4>Other Hacking</h4>
         <ul>
-          {{ range first 8 ( where .Site.RegularPages "Section" "hacks") }}
-            {{ if .Params.Date }}
-            <li><a href="{{.Permalink}}">{{ .Title }}</a></li>
-            {{ end }}
-          {{ end }}
+          <li><a href="/docs/admin/hacking-bookstack/">All Hacking Methods</a></li>
+          <li><a href="https://github.com/BookStackApp/api-scripts">Example API Scripts</a></li>
         </ul>
       </div>
       <div class="sidebar-inner mobile">
@@ -55,7 +51,7 @@
 
       <h1>{{.Title}}</h1>
 
-      {{ if .Params.Date }}
+      {{ if .Params.Tested }}
       <ul class="hack-meta">
         {{ $author := .Params.Author }}
         <li><strong>Author:</strong> <a href="https://github.com/{{ strings.TrimLeft "@" $author }}" target="_blank">{{ $author }}</a></li>
 
       {{.Content}}
 
+
+      {{ if .Params.Tested }}
+      <hr>
+
+      <h4>Latest Hacks</h4>
+
+      <div class="hack-box-list">
+        {{ range first 5 ( where .Site.RegularPages "Section" "hacks") }}
+        {{ if .Params.Date }}
+          {{ partial "list-hack" .}}
+        {{ end }}
+      {{ end }}
+      </div>
+      {{ end }}
+
     </main>
   </div>
 
diff --git a/themes/bookstack/layouts/partials/list-hack.html b/themes/bookstack/layouts/partials/list-hack.html
new file mode 100644 (file)
index 0000000..dacebae
--- /dev/null
@@ -0,0 +1,12 @@
+{{ $baseurl := .Site.BaseURL }}
+<a href="{{ .RelPermalink }}" class="hack-box {{ .Section }}">
+    <div class="hack-header">
+        <h2 class="hack-title">{{ .Title }}</h2>
+    </div>
+    <section class="hack-excerpt">
+        <p>{{ .Summary }} <span class="read-more">&raquo;</span></p>
+    </section>
+    <div class="hack-meta">
+        Last Tested On {{ .Params.tested }}
+    </div>
+</a>
index df37db844ca20d5d2755c5f1f42041ee8031dca6..fcd64062cac56da3391856367f54393e9ac8a17f 100644 (file)
@@ -6,12 +6,13 @@
 {{ end }}
 {{ $type := .Get "type" }}
 {{ $md := printf "```%s\n%s\n```" $ext (readFile $file) }}
+{{ $mdLen := len (split $md "\n") }}
 
 
 <div class="hack-file-wrapper">
 
     
-    <details>
+    <details {{if lt $mdLen 15}}open{{end}}>
         <summary class="hack-file-block">
             <div class="hack-file-block-filename">{{ $filename }}</div>
         
index 8598f6a0fe8a6a1857fd3269f223c367cc163251..8efec14f25595accd397bce1b11294eb13ce0f21 100644 (file)
@@ -642,4 +642,57 @@ details[open] .hack-file-block-filename:before {
   svg {
     width: 1.6em;
   }
+}
+
+.hack-box-list {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  gap: 1rem;
+}
+
+.hack-box {
+  background-color: #FFF;
+  border: 1.5px solid #e2e2e2;
+  box-shadow: 0 1px 3px 0 rgba(0,0,0,.1);
+  border-radius: 4px;
+  text-decoration: none;
+  display: flex;
+  flex-direction: column;
+  color: #222;
+  margin-bottom: 1rem;
+  min-width: 180px;
+  flex-basis: 320px;
+  flex-grow: 1;
+  h2 {
+    font-size: 1.4rem;
+    font-weight: bold;
+    padding: 0 1rem;
+  }
+  .hack-excerpt {
+    display: -webkit-box;
+    padding: 0 1rem;
+    -webkit-line-clamp: 2;
+    -webkit-box-orient: vertical;
+    overflow: hidden;
+    margin-bottom: .5rem;
+    p {
+      margin-bottom: 0;
+    }
+  }
+  .hack-meta {
+    padding: 0 1rem;
+    font-size: .9rem;
+    color: #444;
+    margin-top: auto;
+  }
+  &:hover {
+    text-decoration: none;
+    box-shadow: 0 2px 8px 0 rgba(0,0,0,.15);
+    color: #000;
+    h2 {
+      color: $primary;
+      text-decoration: underline;
+    }
+  }
 }
\ No newline at end of file