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" layout = "system"
description = "Invite new admin to the site" description = "Invite new admin to the site"
== ==
Hi {{ name }} Hi {{ name }}
A user account has been created for you. A user account has been created for you on **{{ appName }}**.
{% component 'panel' %} {% component 'panel' %}
- Login: `{{ login }}` - Login: `{{ login ?: 'sample' }}`
- Password: `{{ password }}` - Password: `{{ password ?: '********' }}`
{% endcomponent %} {% endcomponent %}
You can use the following link to sign in: You can use the following link to sign in:

View File

@ -2,6 +2,7 @@
use App; use App;
use Lang; use Lang;
use View;
use Event; use Event;
use Config; use Config;
use Backend; use Backend;
@ -54,6 +55,7 @@ class ServiceProvider extends ModuleServiceProvider
$this->registerMarkupTags(); $this->registerMarkupTags();
$this->registerAssetBundles(); $this->registerAssetBundles();
$this->registerValidator(); $this->registerValidator();
$this->registerGlobalViewVars();
/* /*
* Register other module providers * 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; <?php namespace System\Classes;
use Twig; use Twig;
use Config;
use Markdown; use Markdown;
use System\Models\MailPartial; use System\Models\MailPartial;
use System\Models\MailTemplate; use System\Models\MailTemplate;
@ -94,8 +93,7 @@ class MailManager
} }
$data += [ $data += [
'subject' => $swiftMessage->getSubject(), 'subject' => $swiftMessage->getSubject()
'appName' => Config::get('app.name')
]; ];
/* /*

View File

@ -2,6 +2,16 @@
use View as ViewFacade; 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 class View
{ {
/** /**

View File

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

View File

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

View File

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