mirror of
https://github.com/flarum/core.git
synced 2025-08-06 16:36:47 +02:00
feat: use components for email templating (#4102)
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
@endif
|
||||
</a>
|
||||
</div>
|
||||
@yield('header')
|
||||
{{ $header ?? '' }}
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
@endif
|
||||
<div class="main-content">
|
||||
@yield('content')
|
||||
{{ $content ?? '' }}
|
||||
</div>
|
||||
@if(!isset($signoff) || $signoff !== false)
|
||||
<div class="signoff">
|
||||
@@ -77,7 +77,7 @@
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
@yield('footer')
|
||||
{{ $footer ?? '' }}
|
||||
</div>
|
||||
|
||||
</body>
|
18
framework/core/views/email/html/information.blade.php
Normal file
18
framework/core/views/email/html/information.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<x-mail::html>
|
||||
<x-slot:header>
|
||||
<h2>{{ $title ?? $translator->trans('core.email.informational.default_title') }}</h2>
|
||||
</x-slot:header>
|
||||
|
||||
<x-slot:content>
|
||||
{{ $slot ?? $body ?? '' }}
|
||||
@if (isset($preview))
|
||||
<div class="content-preview">
|
||||
{{ $preview }}
|
||||
</div>
|
||||
@endif
|
||||
</x-slot:content>
|
||||
|
||||
<x-slot:footer>
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.informational.footer', ['userEmail' => $userEmail, 'forumUrl' => $url->to('forum')->base(), 'forumTitle' => $settings->get('forum_title')])) !!}</p>
|
||||
</x-slot:footer>
|
||||
</x-mail::html>
|
@@ -1,22 +0,0 @@
|
||||
@extends('flarum.forum::email.html.base')
|
||||
|
||||
@section('header')
|
||||
<h2>{{ $title ?? $translator->trans('core.email.informational.default_title') }}</h2>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@if(isset($infoContent))
|
||||
<p>{!! $formatter->convert($infoContent) !!}</p>
|
||||
@else
|
||||
@yield('informationContent')
|
||||
@endif
|
||||
@hasSection('contentPreview')
|
||||
<div class="content-preview">
|
||||
@yield('contentPreview')
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('footer')
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.informational.footer', ['userEmail' => $userEmail, 'forumUrl' => $url->to('forum')->base(), 'forumTitle' => $settings->get('forum_title')])) !!}</p>
|
||||
@endsection
|
@@ -0,0 +1,3 @@
|
||||
<x-mail::html.information>
|
||||
{{ $infoContent ?? '' }}
|
||||
</x-mail::html.information>
|
20
framework/core/views/email/html/notification.blade.php
Normal file
20
framework/core/views/email/html/notification.blade.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<x-mail::html>
|
||||
<x-slot:header>
|
||||
<h2>{{ $title ?? $translator->trans('core.email.notification.default_title') }}</h2>
|
||||
</x-slot:header>
|
||||
|
||||
<x-slot:content>
|
||||
{{ $slot ?? $body ?? '' }}
|
||||
@if (isset($preview))
|
||||
<div class="content-preview">
|
||||
{{ $preview }}
|
||||
</div>
|
||||
@endif
|
||||
</x-slot:content>
|
||||
|
||||
<x-slot:footer>
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.notification.footer.main_text', ['email' => $user->email, 'type' => $type, 'forumUrl' => $url->to('forum')->base(), 'forumTitle' => $settings->get('forum_title')])) !!}</p>
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.notification.footer.unsubscribe_text', ['unsubscribeLink' => $unsubscribeLink])) !!}</p>
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.notification.footer.settings_text', ['settingsLink' => $settingsLink])) !!}</p>
|
||||
</x-slot:footer>
|
||||
</x-mail::html>
|
@@ -1,20 +0,0 @@
|
||||
@extends('flarum.forum::email.html.base')
|
||||
|
||||
@section('header')
|
||||
<h2>{{ $title ?? $translator->trans('core.email.notification.default_title') }}</h2>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@yield('notificationContent')
|
||||
@hasSection('contentPreview')
|
||||
<div class="content-preview">
|
||||
@yield('contentPreview')
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('footer')
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.notification.footer.main_text', ['email' => $user->email, 'type' => $type, 'forumUrl' => $url->to('forum')->base(), 'forumTitle' => $settings->get('forum_title')])) !!}</p>
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.notification.footer.unsubscribe_text', ['unsubscribeLink' => $unsubscribeLink])) !!}</p>
|
||||
<p>{!! $formatter->convert($translator->trans('core.email.notification.footer.settings_text', ['settingsLink' => $settingsLink])) !!}</p>
|
||||
@endsection
|
@@ -1,14 +1,14 @@
|
||||
@yield('header')
|
||||
{{ strip_tags($header ?? '') }}
|
||||
|
||||
@if(!isset($greeting) || $greeting !== false)
|
||||
{{ $translator->trans('core.email.greeting', ['displayName' => $username]) }}
|
||||
@endif
|
||||
|
||||
@yield('content')
|
||||
{{ strip_tags($content ?? '') }}
|
||||
|
||||
@if(!isset($signoff) || $signoff !== false)
|
||||
- {{ $translator->trans('core.email.signoff', ['forumTitle' => $settings->get('forum_title')]) }} -
|
||||
@endif
|
||||
|
||||
|
||||
@yield('footer')
|
||||
{{ strip_tags($footer ?? '') }}
|
@@ -1,13 +1,13 @@
|
||||
@extends('flarum.forum::email.plain.base')
|
||||
|
||||
@section('header')
|
||||
<x-mail::plain>
|
||||
<x-slot:header>
|
||||
{{ $title ?? $translator->trans('core.email.informational.default_title') }}
|
||||
@endsection
|
||||
</x-slot:header>
|
||||
|
||||
@section('content')
|
||||
{{ $infoContent ?? '' }}
|
||||
@endsection
|
||||
<x-slot:content>
|
||||
{{ $slot ?? $body ?? '' }}
|
||||
</x-slot:content>
|
||||
|
||||
@section('footer')
|
||||
<x-slot:footer>
|
||||
{!! $translator->trans('core.email.informational.footer_plain', ['userEmail' => $userEmail, 'forumTitle' => $forumTitle]) !!}
|
||||
@endsection
|
||||
</x-slot:footer>
|
||||
</x-mail::plain>
|
@@ -0,0 +1,3 @@
|
||||
<x-mail::plain.information>
|
||||
{{ $infoContent ?? '' }}
|
||||
</x-mail::plain.information>
|
@@ -1,17 +1,17 @@
|
||||
@extends('flarum.forum::email.plain.base')
|
||||
|
||||
@section('header')
|
||||
<x-mail::plain>
|
||||
<x-slot:header>
|
||||
{{ $title ?? $translator->trans('core.email.notification.default_title') }}
|
||||
@endsection
|
||||
</x-slot:header>
|
||||
|
||||
@section('content')
|
||||
@yield('notificationContent')
|
||||
@endsection
|
||||
<x-slot:content>
|
||||
{{ $slot ?? $body ?? '' }}
|
||||
</x-slot:content>
|
||||
|
||||
@section('footer')
|
||||
<x-slot:footer>
|
||||
{!! $translator->trans('core.email.notification.footer.main_text_plain', ['email' => $user->email, 'type' => $type, 'forumTitle' => $forumTitle]) !!}
|
||||
|
||||
{!! $translator->trans('core.email.notification.footer.unsubscribe_text_plain', ['unsubscribeLink' => $unsubscribeLink]) !!}
|
||||
|
||||
{!! $translator->trans('core.email.notification.footer.settings_text_plain', ['settingsLink' => $settingsLink]) !!}
|
||||
@endsection
|
||||
</x-slot:footer>
|
||||
</x-mail::plain>
|
Reference in New Issue
Block a user