]> BookStack Code Mirror - bookstack/commitdiff
Standardised export views with base layout, Reduced included export styles
authorDan Brown <redacted>
Tue, 4 May 2021 22:15:05 +0000 (23:15 +0100)
committerDan Brown <redacted>
Tue, 4 May 2021 22:15:05 +0000 (23:15 +0100)
Related to #2666

resources/sass/export-styles.scss
resources/views/books/export.blade.php
resources/views/chapters/export.blade.php
resources/views/export-layout.blade.php [new file with mode: 0644]
resources/views/pages/export.blade.php
resources/views/partials/export-styles.blade.php

index 278e5b6c500af3a42ebc2c532c40abd0e45b326e..b8682ed05f69b030e6f8fbef343cf3b995d39f3d 100644 (file)
@@ -1,16 +1,13 @@
 @import "variables";
 @import "mixins";
-@import "spacing";
 @import "html";
 @import "text";
 @import "layout";
 @import "blocks";
 @import "tables";
-@import "header";
 @import "lists";
 @import "pages";
 
-
 html, body {
   background-color: #FFF;
 }
@@ -40,4 +37,25 @@ pre:after {
 }
 pre code {
   white-space: pre-wrap;
+}
+
+.page-break {
+  page-break-after: always;
+}
+@media screen {
+  .page-break {
+    border-top: 1px solid #DDD;
+  }
+}
+
+ul.contents ul li {
+  list-style: circle;
+}
+
+.chapter-hint {
+  color: #888;
+  margin-top: 32px;
+}
+.chapter-hint + h1 {
+  margin-top: 0;
 }
\ No newline at end of file
index 1faa3880e722c63cc51fc793ea7abdbfa28f2779..9cd5618a53f3be19fe609fefdeadb3e6e1fed4f0 100644 (file)
@@ -1,38 +1,8 @@
-<!doctype html>
-<html lang="{{ config('app.lang') }}">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>{{ $book->name }}</title>
+@extends('export-layout')
 
-    @include('partials.export-styles', ['format' => $format])
-
-    <style>
-        .page-break {
-            page-break-after: always;
-        }
-        .chapter-hint {
-            color: #888;
-            margin-top: 32px;
-        }
-        .chapter-hint + h1 {
-            margin-top: 0;
-        }
-        ul.contents ul li {
-            list-style: circle;
-        }
-        @media screen {
-            .page-break {
-                border-top: 1px solid #DDD;
-            }
-        }
-    </style>
-    @yield('head')
-    @include('partials.export-custom-head')
-</head>
-<body>
-
-<div class="page-content">
+@section('title', $book->name)
 
+@section('content')
     <h1 style="font-size: 4.8em">{{$book->name}}</h1>
 
     <p>{{ $book->description }}</p>
@@ -73,8 +43,4 @@
         @endif
 
     @endforeach
-
-</div>
-
-</body>
-</html>
+@endsection
\ No newline at end of file
index 96d9d77005754ee4fb483349562bb429ef8e24d6..18f056f27f175570b8546be9322bc858afecbd19 100644 (file)
@@ -1,30 +1,8 @@
-<!doctype html>
-<html lang="{{ config('app.lang') }}">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>{{ $chapter->name }}</title>
+@extends('export-layout')
 
-    @include('partials.export-styles', ['format' => $format])
-
-    <style>
-        .page-break {
-            page-break-after: always;
-        }
-        ul.contents ul li {
-            list-style: circle;
-        }
-        @media screen {
-            .page-break {
-                border-top: 1px solid #DDD;
-            }
-        }
-    </style>
-    @include('partials.export-custom-head')
-</head>
-<body>
-
-<div class="page-content">
+@section('title', $chapter->name)
 
+@section('content')
     <h1 style="font-size: 4.8em">{{$chapter->name}}</h1>
 
     <p>{{ $chapter->description }}</p>
@@ -42,8 +20,4 @@
         <h1 id="page-{{$page->id}}">{{ $page->name }}</h1>
         {!! $page->html !!}
     @endforeach
-
-</div>
-
-</body>
-</html>
+@endsection
\ No newline at end of file
diff --git a/resources/views/export-layout.blade.php b/resources/views/export-layout.blade.php
new file mode 100644 (file)
index 0000000..f23b3cc
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="{{ config('app.lang') }}">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <title>@yield('title')</title>
+
+    @include('partials.export-styles', ['format' => $format])
+    @include('partials.export-custom-head')
+</head>
+<body>
+<div class="page-content">
+    @yield('content')
+</div>
+</body>
+</html>
\ No newline at end of file
index 1f2e605768a5238e201f52b2c9157ed9be17bfbd..74d17c128f794be4c7857c6eb584c07211a3a534 100644 (file)
@@ -1,51 +1,13 @@
-<!doctype html>
-<html lang="{{ config('app.lang') }}">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>{{ $page->name }}</title>
+@extends('export-layout')
 
-    @include('partials.export-styles', ['format' => $format])
+@section('title', $page->name)
 
-    @if($format === 'pdf')
-        <style>
-            body {
-                font-size: 14px;
-                line-height: 1.2;
-            }
+@section('content')
+    @include('pages.page-display')
 
-            h1, h2, h3, h4, h5, h6 {
-                line-height: 1.2;
-            }
-
-            table {
-                max-width: 800px !important;
-                font-size: 0.8em;
-                width: 100% !important;
-            }
-
-            table td {
-                width: auto !important;
-            }
-        </style>
-    @endif
-
-    @include('partials.export-custom-head')
-</head>
-<body>
-
-<div id="page-show">
-    <div class="page-content">
-
-        @include('pages.page-display')
-
-        <hr>
-
-        <div class="text-muted text-small">
-            @include('partials.entity-export-meta', ['entity' => $page])
-        </div>
+    <hr>
 
+    <div class="text-muted text-small">
+        @include('partials.entity-export-meta', ['entity' => $page])
     </div>
-</div>
-
-</body>
-</html>
+@endsection
\ No newline at end of file
index 52bfda2a6fc40c6c02d745b5079261e88093c017..967dc19ec709264de9302900d967189358aa39e8 100644 (file)
@@ -6,6 +6,27 @@
 
 @if ($format === 'pdf')
     <style>
+
+        /* PDF size adjustments */
+        body {
+            font-size: 14px;
+            line-height: 1.2;
+        }
+
+        h1, h2, h3, h4, h5, h6 {
+            line-height: 1.2;
+        }
+
+        table {
+            max-width: 800px !important;
+            font-size: 0.8em;
+            width: 100% !important;
+        }
+
+        table td {
+            width: auto !important;
+        }
+
         /* Patches for CSS variable colors */
         a {
             color: {{ setting('app-color') }};