From d2cd33e226127288c8caadbde2f7a051265f6d2e Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 12 Nov 2022 09:02:33 +0000 Subject: [PATCH] Added login/register message partials for easier use via theme system Related to #608 --- resources/views/auth/login.blade.php | 2 ++ .../views/auth/parts/login-message.blade.php | 2 ++ .../views/auth/parts/register-message.blade.php | 2 ++ resources/views/auth/register.blade.php | 2 ++ tests/ThemeTest.php | 17 +++++++++++++++++ 5 files changed, 25 insertions(+) create mode 100644 resources/views/auth/parts/login-message.blade.php create mode 100644 resources/views/auth/parts/register-message.blade.php diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index de99bb3f2..6278adcd7 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -9,6 +9,8 @@

{{ Str::title(trans('auth.log_in')) }}

+ @include('auth.parts.login-message') + @include('auth.parts.login-form-' . $authMethod) @if(count($socialDrivers) > 0) diff --git a/resources/views/auth/parts/login-message.blade.php b/resources/views/auth/parts/login-message.blade.php new file mode 100644 index 000000000..471198979 --- /dev/null +++ b/resources/views/auth/parts/login-message.blade.php @@ -0,0 +1,2 @@ +{{-- This is a placeholder template file provided as a --}} +{{-- convenience to users of the visual theme system. --}} \ No newline at end of file diff --git a/resources/views/auth/parts/register-message.blade.php b/resources/views/auth/parts/register-message.blade.php new file mode 100644 index 000000000..471198979 --- /dev/null +++ b/resources/views/auth/parts/register-message.blade.php @@ -0,0 +1,2 @@ +{{-- This is a placeholder template file provided as a --}} +{{-- convenience to users of the visual theme system. --}} \ No newline at end of file diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 91ec0b621..d345b037a 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -8,6 +8,8 @@

{{ Str::title(trans('auth.sign_up')) }}

+ @include('auth.parts.register-message') +
{!! csrf_field() !!} diff --git a/tests/ThemeTest.php b/tests/ThemeTest.php index 4d612a870..efab53379 100644 --- a/tests/ThemeTest.php +++ b/tests/ThemeTest.php @@ -338,6 +338,23 @@ class ThemeTest extends TestCase }); } + public function test_login_and_register_message_template_files_can_be_used() + { + $loginMessage = 'Welcome to this instance, login below you scallywag'; + $registerMessage = 'You want to register? Enter the deets below you numpty'; + + $this->usingThemeFolder(function (string $folder) use ($loginMessage, $registerMessage) { + $viewDir = theme_path('auth/parts'); + mkdir($viewDir, 0777, true); + file_put_contents($viewDir . '/login-message.blade.php', $loginMessage); + file_put_contents($viewDir . '/register-message.blade.php', $registerMessage); + $this->setSettings(['registration-enabled' => 'true']); + + $this->get('/login')->assertSee($loginMessage); + $this->get('/register')->assertSee($registerMessage); + }); + } + protected function usingThemeFolder(callable $callback) { // Create a folder and configure a theme