Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted cloudsync beta #892

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>

Loading