Skip to content

Commit

Permalink
Merge pull request #892 from mollie/PIPRES-350-fixed-some-issues-with…
Browse files Browse the repository at this point in the history
…-cloudsync

Adjusted cloudsync beta
  • Loading branch information
JevgenijVisockij authored Mar 19, 2024
2 parents 07e54f5 + 633b5a6 commit 780e572
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
30 changes: 18 additions & 12 deletions controllers/admin/AdminMollieSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct()
$this->bootstrap = true;
}

private function initCloudSyncAndPsAccounts(): void
private function initCloudSyncAndPsAccounts(): bool
{
$mboInstaller = new Prestashop\ModuleLibMboInstaller\DependencyBuilder($this->module);

Expand All @@ -36,6 +36,8 @@ private function initCloudSyncAndPsAccounts(): void
$this->context->smarty->assign('dependencies', $dependencies);

$this->content .= $this->context->smarty->fetch($this->module->getLocalPath() . 'views/templates/admin/dependency_builder.tpl');

return false;
}

$this->context->smarty->assign('module_dir', $this->module->getPathUri());
Expand Down Expand Up @@ -78,11 +80,24 @@ private function initCloudSyncAndPsAccounts(): void
}

$this->content .= $this->context->smarty->fetch($this->module->getLocalPath() . 'views/templates/admin/cloudsync.tpl');

return true;
}

public function postProcess()
{
$this->initCloudSyncAndPsAccounts();
/** @var \Mollie\Service\Content\TemplateParserInterface $templateParser */
$templateParser = $this->module->getService(\Mollie\Service\Content\TemplateParserInterface::class);

$this->content = $templateParser->parseTemplate(
$this->context->smarty,
$this->module->getService(\Mollie\Builder\Content\LogoInfoBlock::class),
$this->module->getLocalPath() . 'views/templates/admin/logo.tpl'
);
$cloudSyncComplete = $this->initCloudSyncAndPsAccounts();
if (!$cloudSyncComplete) {
return;
}
/** @var \Mollie\Repository\ModuleRepository $moduleRepository */
$moduleRepository = $this->module->getService(\Mollie\Repository\ModuleRepository::class);
$moduleDatabaseVersion = $moduleRepository->getModuleDatabaseVersion($this->module->name);
Expand All @@ -101,9 +116,6 @@ public function postProcess()
return;
}

/** @var \Mollie\Service\Content\TemplateParserInterface $templateParser */
$templateParser = $this->module->getService(\Mollie\Service\Content\TemplateParserInterface::class);

$isSubmitted = (bool) Tools::isSubmit("submit{$this->module->name}");

/* @phpstan-ignore-next-line */
Expand Down Expand Up @@ -149,17 +161,11 @@ public function postProcess()
$this->context->controller->addCSS($this->module->getPathUri() . 'views/css/mollie.css');
$this->context->controller->addCSS($this->module->getPathUri() . 'views/css/admin/logo_input.css');

$html = $templateParser->parseTemplate(
$this->context->smarty,
$this->module->getService(\Mollie\Builder\Content\LogoInfoBlock::class),
$this->module->getLocalPath() . 'views/templates/admin/logo.tpl'
);

/** @var \Mollie\Builder\Content\UpdateMessageInfoBlock $updateMessageInfoBlock */
$updateMessageInfoBlock = $this->module->getService(\Mollie\Builder\Content\UpdateMessageInfoBlock::class);
$updateMessageInfoBlockData = $updateMessageInfoBlock->setAddons(false);

$html .= $templateParser->parseTemplate(
$html = $templateParser->parseTemplate(
$this->context->smarty,
$updateMessageInfoBlockData,
$this->module->getLocalPath() . 'views/templates/admin/updateMessage.tpl'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @codingStandardsIgnoreStart
*#}

{% import '@PrestaShop/Admin/macros.html.twig' as ps %}

{% set subscriptionOptions = subscriptionOptionsForm %}

{% if subscriptionOptionsForm.subscription_options is defined and subscriptionOptionsForm.subscription_options %}
Expand Down
2 changes: 1 addition & 1 deletion views/templates/admin/logo.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @see https://github.com/mollie/PrestaShop
* @codingStandardsIgnoreStart
*}
<div style="width: 263px; align-content: center; text-align: left; padding-bottom: 12px;">
<div style="width: 263px; align-content: center; text-align: left; padding-bottom: 12px; margin-top: 10px;">
<img src="{$logo_url|escape:'htmlall':'UTF-8'}" style="max-width:100%; height:auto; margin: 0 auto">
</div>

0 comments on commit 780e572

Please sign in to comment.