Register `appName` as global view variable

Minor mail template improvements
This commit is contained in:
Samuel Georges 2017-07-23 17:20:53 +10:00
parent e6b191bd94
commit 3f0e6d8b29
7 changed files with 28 additions and 9 deletions

View File

@ -1,14 +1,14 @@
subject = "Welcome to October CMS"
subject = "Welcome to {{ appName }}"
layout = "system"
description = "Invite new admin to the site"
==
Hi {{ name }}
A user account has been created for you.
A user account has been created for you on **{{ appName }}**.
{% component 'panel' %}
- Login: `{{ login }}`
- Password: `{{ password }}`
- Login: `{{ login ?: 'sample' }}`
- Password: `{{ password ?: '********' }}`
{% endcomponent %}
You can use the following link to sign in:

View File

@ -2,6 +2,7 @@
use App;
use Lang;
use View;
use Event;
use Config;
use Backend;
@ -54,6 +55,7 @@ class ServiceProvider extends ModuleServiceProvider
$this->registerMarkupTags();
$this->registerAssetBundles();
$this->registerValidator();
$this->registerGlobalViewVars();
/*
* Register other module providers
@ -518,4 +520,9 @@ class ServiceProvider extends ModuleServiceProvider
});
});
}
protected function registerGlobalViewVars()
{
View::share('appName', Config::get('app.name'));
}
}

View File

@ -1,7 +1,6 @@
<?php namespace System\Classes;
use Twig;
use Config;
use Markdown;
use System\Models\MailPartial;
use System\Models\MailTemplate;
@ -94,8 +93,7 @@ class MailManager
}
$data += [
'subject' => $swiftMessage->getSubject(),
'appName' => Config::get('app.name')
'subject' => $swiftMessage->getSubject()
];
/*

View File

@ -2,6 +2,16 @@
use View as ViewFacade;
/**
* This helper class is used to extract basic variables
* (scalar or array) from the global `View` Facade.
*
* You can register these global variables with `View::share`.
*
* View::share('siteName', 'OctoberCMS');
*
* Then available globally for use in the front-end and mail templates.
*/
class View
{
/**

View File

@ -201,6 +201,10 @@ img {
padding: 35px;
}
.wrapper.layout-system .content-cell {
padding: 35px 0;
}
/* Buttons */
.action {

View File

@ -14,7 +14,7 @@ name = "Default layout"
{{ css|raw }}
</style>
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0">
<table class="wrapper layout-default" width="100%" cellpadding="0" cellspacing="0">
<!-- Header -->
{% component 'header' %}

View File

@ -18,7 +18,7 @@ This is an automatic message. Please do not reply to it.
{{ css|raw }}
</style>
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0">
<table class="wrapper layout-system" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table class="content" width="100%" cellpadding="0" cellspacing="0">