diff --git a/resources/js/components/page-picker.js b/resources/js/components/page-picker.js index 130972fdd63..9bb0bee04a3 100644 --- a/resources/js/components/page-picker.js +++ b/resources/js/components/page-picker.js @@ -1,7 +1,7 @@ import {Component} from './component'; function toggleElem(elem, show) { - elem.style.display = show ? null : 'none'; + elem.toggleAttribute('hidden', !show); } export class PagePicker extends Component { @@ -21,6 +21,7 @@ export class PagePicker extends Component { setupListeners() { this.selectButton.addEventListener('click', this.showPopup.bind(this)); this.display.parentElement.addEventListener('click', this.showPopup.bind(this)); + this.display.addEventListener('click', e => e.stopPropagation()); this.resetButton.addEventListener('click', () => { this.setValue('', ''); diff --git a/resources/sass/_layout.scss b/resources/sass/_layout.scss index 94a36ecba59..6c78419d86c 100644 --- a/resources/sass/_layout.scss +++ b/resources/sass/_layout.scss @@ -270,10 +270,14 @@ body.flexbox { overflow: hidden; } -.fill-height { +.height-fill { height: 100%; } +.height-auto { + height: auto !important; +} + .float { float: left; &.right { diff --git a/resources/views/books/parts/form.blade.php b/resources/views/books/parts/form.blade.php index b4ca2fba5ea..973bae98701 100644 --- a/resources/views/books/parts/form.blade.php +++ b/resources/views/books/parts/form.blade.php @@ -40,17 +40,18 @@
-
-

+

+

{{ trans('entities.books_default_template_explain') }}

- - @include('form.page-picker', [ - 'name' => 'default_template_id', - 'placeholder' => trans('entities.books_default_template_select'), - 'value' => $book?->default_template_id ?? null, - ]) +
+ @include('form.page-picker', [ + 'name' => 'default_template_id', + 'placeholder' => trans('entities.books_default_template_select'), + 'value' => $book?->default_template_id ?? null, + ]) +
diff --git a/resources/views/form/page-picker.blade.php b/resources/views/form/page-picker.blade.php index 90ce7567658..d9810d575df 100644 --- a/resources/views/form/page-picker.blade.php +++ b/resources/views/form/page-picker.blade.php @@ -1,13 +1,13 @@ {{--Depends on entity selector popup--}}
-
- - +
- - + +
\ No newline at end of file diff --git a/resources/views/pages/edit.blade.php b/resources/views/pages/edit.blade.php index 841b275037b..58fb5f355ea 100644 --- a/resources/views/pages/edit.blade.php +++ b/resources/views/pages/edit.blade.php @@ -4,7 +4,7 @@ @section('content') -
+
{{ csrf_field() }} diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.php index fbb47226e6a..7841a255e0e 100644 --- a/tests/Entity/EntitySearchTest.php +++ b/tests/Entity/EntitySearchTest.php @@ -252,6 +252,31 @@ public function test_entity_selector_search_reflects_items_without_permission() $this->withHtml($resp)->assertElementContains($baseSelector, "You don't have the required permissions to select this item"); } + public function test_entity_template_selector_search() + { + $templatePage = $this->entities->newPage(['name' => 'Template search test', 'html' => 'template test']); + $templatePage->template = true; + $templatePage->save(); + + $nonTemplatePage = $this->entities->newPage(['name' => 'Nontemplate page', 'html' => 'nontemplate', 'template' => false]); + + // Visit both to make popular + $this->asEditor()->get($templatePage->getUrl()); + $this->asEditor()->get($nonTemplatePage->getUrl()); + + $normalSearch = $this->get('/search/entity-selector-templates?term=test'); + $normalSearch->assertSee($templatePage->name); + $normalSearch->assertDontSee($nonTemplatePage->name); + + $normalSearch = $this->get('/search/entity-selector-templates?term=beans'); + $normalSearch->assertDontSee($templatePage->name); + $normalSearch->assertDontSee($nonTemplatePage->name); + + $defaultListTest = $this->get('/search/entity-selector-templates'); + $defaultListTest->assertSee($templatePage->name); + $defaultListTest->assertDontSee($nonTemplatePage->name); + } + public function test_sibling_search_for_pages() { $chapter = $this->entities->chapterHasPages();