Skip to content

Commit

Permalink
Register appName as global view variable
Browse files Browse the repository at this point in the history
Minor mail template improvements
  • Loading branch information
Samuel Georges committed Jul 23, 2017
1 parent ec71498 commit a78aab1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use App;
use Lang;
use View;
use Event;
use Config;
use Backend;
Expand Down Expand Up @@ -54,6 +55,7 @@ public function register()
$this->registerMarkupTags();
$this->registerAssetBundles();
$this->registerValidator();
$this->registerGlobalViewVars();

/*
* Register other module providers
Expand Down Expand Up @@ -518,4 +520,9 @@ protected function registerValidator()
});
});
}

protected function registerGlobalViewVars()
{
View::share('appName', Config::get('app.name'));
}
}
4 changes: 1 addition & 3 deletions classes/MailManager.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace System\Classes;

use Twig;
use Config;
use Markdown;
use System\Models\MailPartial;
use System\Models\MailTemplate;
Expand Down Expand Up @@ -94,8 +93,7 @@ public function addContentToMailer($message, $code, $data)
}

$data += [
'subject' => $swiftMessage->getSubject(),
'appName' => Config::get('app.name')
'subject' => $swiftMessage->getSubject()
];

/*
Expand Down
10 changes: 10 additions & 0 deletions helpers/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand Down
4 changes: 4 additions & 0 deletions models/mailbrandsetting/custom.less
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ img {
padding: 35px;
}

.wrapper.layout-system .content-cell {
padding: 35px 0;
}

/* Buttons */

.action {
Expand Down
2 changes: 1 addition & 1 deletion views/mail/layout-default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{ 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' %}
Expand Down
2 changes: 1 addition & 1 deletion views/mail/layout-system.htm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ 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">
Expand Down

0 comments on commit a78aab1

Please sign in to comment.