-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '365-required-mailer-configs' into 'master'
Resolve "Mailer by mal hlasit chybajuci config pre aktualne zvoleny defaultny mailer" See merge request remp/remp!272
- Loading branch information
Showing
13 changed files
with
265 additions
and
50 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
Mailer/app/components/MissingConfiguration/IMissingConfigurationFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Remp\MailerModule\Components; | ||
|
||
interface IMissingConfigurationFactory | ||
{ | ||
/** @return MissingConfiguration */ | ||
public function create(); | ||
} |
45 changes: 45 additions & 0 deletions
45
Mailer/app/components/MissingConfiguration/MissingConfiguration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Remp\MailerModule\Components; | ||
|
||
use Nette\Application\UI\Control; | ||
use Remp\MailerModule\Repository\ConfigsRepository; | ||
use Remp\MailerModule\Sender\MailerFactory; | ||
|
||
class MissingConfiguration extends Control | ||
{ | ||
/** @var ConfigsRepository */ | ||
private $configsRepository; | ||
|
||
/** @var MailerFactory */ | ||
private $mailerFactory; | ||
|
||
public function __construct( | ||
ConfigsRepository $configsRepository, | ||
MailerFactory $mailerFactory | ||
) { | ||
parent::__construct(); | ||
$this->configsRepository = $configsRepository; | ||
$this->mailerFactory = $mailerFactory; | ||
} | ||
|
||
public function render() | ||
{ | ||
$defaultMailerSetting = $this->configsRepository->loadByName('default_mailer'); | ||
$mailerConfigured = false; | ||
|
||
if ($defaultMailerSetting->value !== null) { | ||
$activeMailer = $this->mailerFactory->getMailer($defaultMailerSetting->value); | ||
|
||
if ($mailerConfigured = $activeMailer->isConfigured()) { | ||
return; | ||
} | ||
} | ||
|
||
$this->template->link = $this->getPresenter()->link('Settings:default'); | ||
$this->template->missingConfigs = !$mailerConfigured; | ||
|
||
$this->template->setFile(__DIR__ . '/missing_configuration.latte'); | ||
$this->template->render(); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
Mailer/app/components/MissingConfiguration/missing_configuration.latte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<a href="{$link}" class="missing-configuration-widget"> | ||
<i class="zmdi zmdi-alert-triangle"></i> | ||
Missing configuration keys | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.