mirror of
https://github.com/flarum/core.git
synced 2025-08-05 07:57:46 +02:00
feat: notification unsubscribe & email overhaul with HTML multipart (#3872)
This commit is contained in:
84
framework/core/views/email/html/base.blade.php
Normal file
84
framework/core/views/email/html/base.blade.php
Normal file
@@ -0,0 +1,84 @@
|
||||
@inject('url', 'Flarum\Http\UrlGenerator')
|
||||
|
||||
@php
|
||||
$primaryColor = $settings->get('theme_primary_color');
|
||||
$secondaryColor = $settings->get('theme_secondary_color');
|
||||
@endphp
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ $translator->getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ $title ?? 'Flarum Email' }}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #e1e1e1;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.footer {
|
||||
margin-top: 20px;
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
}
|
||||
.content-preview {
|
||||
background-color: #f7f7f7; /* Light gray background */
|
||||
padding: 15px;
|
||||
margin: 15px 0;
|
||||
border: 1px solid #e1e1e1;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.signoff {
|
||||
margin-top: 20px;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div class="Header-title">
|
||||
<a href="{{ $url->to('forum')->base() }}" id="home-link">
|
||||
@if ($settings->get('logo_path'))
|
||||
<img src="{{ $url->to('forum')->base() . '/assets/' . $settings->get('logo_path') }}" alt="{{ $settings->get('forum_title') }}" class="Header-logo">
|
||||
@else
|
||||
{{ $settings->get('forum_title') }}
|
||||
@endif
|
||||
</a>
|
||||
</div>
|
||||
@yield('header')
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
@if(!isset($greeting) || $greeting !== false)
|
||||
<div class="greeting">
|
||||
<p>{!! $translator->trans('core.email.greeting', ['displayName' => $username]) !!}</p>
|
||||
</div>
|
||||
@endif
|
||||
<div class="main-content">
|
||||
@yield('content')
|
||||
</div>
|
||||
@if(!isset($signoff) || $signoff !== false)
|
||||
<div class="signoff">
|
||||
<p>{!! $translator->trans('core.email.signoff', ['forumTitle' => $settings->get('forum_title')]) !!}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
@yield('footer')
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
22
framework/core/views/email/html/information/base.blade.php
Normal file
22
framework/core/views/email/html/information/base.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@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
|
20
framework/core/views/email/html/notification/base.blade.php
Normal file
20
framework/core/views/email/html/notification/base.blade.php
Normal file
@@ -0,0 +1,20 @@
|
||||
@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
|
14
framework/core/views/email/plain/base.blade.php
Normal file
14
framework/core/views/email/plain/base.blade.php
Normal file
@@ -0,0 +1,14 @@
|
||||
@yield('header')
|
||||
|
||||
@if(!isset($greeting) || $greeting !== false)
|
||||
{{ $translator->trans('core.email.greeting', ['displayName' => $username]) }}
|
||||
@endif
|
||||
|
||||
@yield('content')
|
||||
|
||||
@if(!isset($signoff) || $signoff !== false)
|
||||
- {{ $translator->trans('core.email.signoff', ['forumTitle' => $settings->get('forum_title')]) }} -
|
||||
@endif
|
||||
|
||||
|
||||
@yield('footer')
|
13
framework/core/views/email/plain/information/base.blade.php
Normal file
13
framework/core/views/email/plain/information/base.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends('flarum.forum::email.plain.base')
|
||||
|
||||
@section('header')
|
||||
{{ $title ?? $translator->trans('core.email.informational.default_title') }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
{{ $infoContent ?? '' }}
|
||||
@endsection
|
||||
|
||||
@section('footer')
|
||||
{!! $translator->trans('core.email.informational.footer_plain', ['userEmail' => $userEmail, 'forumTitle' => $forumTitle]) !!}
|
||||
@endsection
|
17
framework/core/views/email/plain/notification/base.blade.php
Normal file
17
framework/core/views/email/plain/notification/base.blade.php
Normal file
@@ -0,0 +1,17 @@
|
||||
@extends('flarum.forum::email.plain.base')
|
||||
|
||||
@section('header')
|
||||
{{ $title ?? $translator->trans('core.email.notification.default_title') }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@yield('notificationContent')
|
||||
@endsection
|
||||
|
||||
@section('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
|
22
framework/core/views/unsubscribe-confirmation.blade.php
Normal file
22
framework/core/views/unsubscribe-confirmation.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('flarum.forum::layouts.basic')
|
||||
|
||||
@section('title', $translator->trans('core.views.unsubscribe_email.title'))
|
||||
|
||||
@section('content')
|
||||
<h2>{{ $translator->trans('core.views.unsubscribe_email.title') }}</h2>
|
||||
<p>{!! $formatter->convert($message) !!}</p>
|
||||
<p>{{ $translator->trans('core.views.unsubscribe_email.immediate_helptext') }}</p>
|
||||
|
||||
<form action="{{ $url->to('forum')->route('notifications.unsubscribe.confirm') }}" method="post">
|
||||
<input type="hidden" name="userId" value="{{ $userId }}">
|
||||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
<input type="hidden" name="csrfToken" value="{{ $csrfToken }}">
|
||||
<button type="submit" class="button Button Button--primary">
|
||||
{{ $translator->trans('core.views.unsubscribe_email.confirm_button') }}
|
||||
</button>
|
||||
</form>
|
||||
<br/>
|
||||
<a href="{{ $url->to('forum')->base() }}">
|
||||
{{ $translator->trans('core.views.unsubscribe_email.return_to_forum', ['forumTitle' => $settings->get('forum_title')]) }}
|
||||
</a>
|
||||
@endsection
|
12
framework/core/views/unsubscribe-error.blade.php
Normal file
12
framework/core/views/unsubscribe-error.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@extends('flarum.forum::layouts.basic')
|
||||
|
||||
@section('title', $translator->trans('core.views.unsubscribe_email_error.title'))
|
||||
|
||||
@section('content')
|
||||
<h2>{{ $translator->trans('core.views.unsubscribe_email_error.title') }}</h2>
|
||||
<p>{!! $message !!}</p>
|
||||
|
||||
<a href="{{ $url->to('forum')->base() }}">
|
||||
{{ $translator->trans('core.views.unsubscribe_email.return_to_forum', ['forumTitle' => $settings->get('forum_title')]) }}
|
||||
</a>
|
||||
@endsection
|
Reference in New Issue
Block a user