]> BookStack Code Mirror - bookstack/commitdiff
extraded template form to own file and changed translations
authorSascha <redacted>
Mon, 29 Jan 2024 18:55:39 +0000 (19:55 +0100)
committerGitHub <redacted>
Mon, 29 Jan 2024 18:55:39 +0000 (19:55 +0100)
lang/en/entities.php
resources/views/books/parts/form.blade.php
resources/views/chapters/parts/form.blade.php
resources/views/entities/template-selector.blade.php [new file with mode: 0644]

index 21ef93fed3c358f684ce68e99062814c6560743b..8860e243e775b33513c915ebafe6742a900abbb7 100644 (file)
@@ -39,6 +39,9 @@ return [
     'export_pdf' => 'PDF File',
     'export_text' => 'Plain Text File',
     'export_md' => 'Markdown File',
+    'default_template' => 'Default Page Template',
+    'default_template_explain' => 'Assign a page template that will be used as the default content for all new pages in this book/chapter. Keep in mind this will only be used if the page creator has view access to those chosen template page.',
+    'default_template_select' => 'Select a template page',
 
     // Permissions and restrictions
     'permissions' => 'Permissions',
@@ -132,9 +135,6 @@ return [
     'books_edit_named' => 'Edit Book :bookName',
     'books_form_book_name' => 'Book Name',
     'books_save' => 'Save Book',
-    'books_default_template' => 'Default Page Template',
-    'books_default_template_explain' => 'Assign a page template that will be used as the default content for all new pages in this book. Keep in mind this will only be used if the page creator has view access to those chosen template page.',
-    'books_default_template_select' => 'Select a template page',
     'books_permissions' => 'Book Permissions',
     'books_permissions_updated' => 'Book Permissions Updated',
     'books_empty_contents' => 'No pages or chapters have been created for this book.',
@@ -192,9 +192,6 @@ return [
     'chapters_permissions_success' => 'Chapter Permissions Updated',
     'chapters_search_this' => 'Search this chapter',
     'chapter_sort_book' => 'Sort Book',
-    'chapter_default_template' => 'Default Page Template',
-    'chapter_default_template_explain' => 'Assign a page template that will be used as the default content for all new pages in this chapter. Keep in mind this will only be used if the page creator has view access to those chosen template page.',
-    'chapter_default_template_select' => 'Select a template page',
 
     // Pages
     'page' => 'Page',
index fa8f16e52f4a5d5d17273025900d9c08bd6a5682..ee261e72d4a55b5449f84891cafcec85502711c2 100644 (file)
 
 <div class="form-group collapsible" component="collapsible" id="template-control">
     <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false">
-        <label for="template-manager">{{ trans('entities.books_default_template') }}</label>
+        <label for="template-manager">{{ trans('entities.default_template') }}</label>
     </button>
     <div refs="collapsible@content" class="collapse-content">
-        <div class="flex-container-row gap-l justify-space-between pb-xs wrap">
-            <p class="text-muted small my-none min-width-xs flex">
-                {{ trans('entities.books_default_template_explain') }}
-            </p>
-
-            <div class="min-width-m">
-                @include('form.page-picker', [
-                    'name' => 'default_template_id',
-                    'placeholder' => trans('entities.books_default_template_select'),
-                    'value' => $book->default_template_id ?? null,
-                    'selectorEndpoint' => '/search/entity-selector-templates',
-                ])
-            </div>
-        </div>
-
+        @include('entities.template-selector', ['entity' => $book ?? null])
     </div>
 </div>
 
index ea7f84bc839e0ba2129c74739628217b00e17804..602693916ea04ef2b00c9779b7a93ea0c0a28e61 100644 (file)
 
 <div class="form-group collapsible" component="collapsible" id="template-control">
     <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false">
-        <label for="template-manager">{{ trans('entities.chapter_default_template') }}</label>
+        <label for="template-manager">{{ trans('entities.default_template') }}</label>
     </button>
     <div refs="collapsible@content" class="collapse-content">
-        <div class="flex-container-row gap-l justify-space-between pb-xs wrap">
-            <p class="text-muted small my-none min-width-xs flex">
-                {{ trans('entities.chapter_default_template_explain') }}
-            </p>
-
-            <div class="min-width-m">
-                @include('form.page-picker', [
-                    'name' => 'default_template_id',
-                    'placeholder' => trans('entities.chapter_default_template_select'),
-                    'value' => $chapter->default_template_id ?? null,
-                    'selectorEndpoint' => '/search/entity-selector-templates',
-                ])
-            </div>
-        </div>
-
+        @include('entities.template-selector', ['entity' => $chapter ?? null])
     </div>
 </div>
 
diff --git a/resources/views/entities/template-selector.blade.php b/resources/views/entities/template-selector.blade.php
new file mode 100644 (file)
index 0000000..80b2f49
--- /dev/null
@@ -0,0 +1,14 @@
+<div class="flex-container-row gap-l justify-space-between pb-xs wrap">\r
+    <p class="text-muted small my-none min-width-xs flex">\r
+        {{ trans('entities.default_template_explain') }}\r
+    </p>\r
+\r
+    <div class="min-width-m">\r
+        @include('form.page-picker', [\r
+            'name' => 'default_template_id',\r
+            'placeholder' => trans('entities.default_template_select'),\r
+            'value' => $entity->default_template_id ?? null,\r
+            'selectorEndpoint' => '/search/entity-selector-templates',\r
+        ])\r
+    </div>\r
+</div>
\ No newline at end of file