Skip to content

Commit

Permalink
Merge pull request PrestaShop#1050 from tblivet/feat/wording-check
Browse files Browse the repository at this point in the history
[NEW UI] Check wording parts 1
  • Loading branch information
Quetzacoalt91 authored Dec 4, 2024
2 parents 78416b8 + 45e7064 commit 0c8863e
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 48 deletions.
12 changes: 11 additions & 1 deletion _dev/src/scss/layouts/_error.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ $e: ".error-page";
}

&__desc {
margin-block-end: 2rem;
font-size: 1rem;
font-weight: 500;
}

&__buttons {
display: flex;
gap: 1rem 2rem;
}

&__button {
padding: 0.875rem 1rem;
margin-block-start: 2rem;
font-size: 0.875rem;
font-weight: 400;
white-space: initial;
Expand All @@ -56,6 +61,11 @@ $e: ".error-page";

&__infos {
justify-self: center;
width: 100%;
}

&__buttons {
flex-direction: column;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Parameters/LocalChannelConfigurationValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private function validateVersionsMatch(): ?array
{
if ($this->xmlVersion !== null && $this->xmlVersion !== $this->targetVersion) {
return [
'message' => $this->translator->trans('The PrestaShop version in your archive doesnt match the one in XML file. Please fix this issue and try again.'),
'message' => $this->translator->trans('The PrestaShop version in your archive doesn\'t match the one in XML file. Please fix this issue and try again.'),
];
}

Expand Down
2 changes: 1 addition & 1 deletion classes/Twig/UpdateSteps.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function setSteps(): void
'title' => $this->translator->trans('Update options'),
],
self::STEP_BACKUP => [
'title' => $this->translator->trans('Back up your store'),
'title' => $this->translator->trans('Backup'),
],
self::STEP_UPDATE => [
'title' => $this->translator->trans('Update'),
Expand Down
59 changes: 50 additions & 9 deletions classes/UpgradeSelfCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,26 @@ public function getRequirementWording(int $requirement, bool $isWebVersion = fal
case self::PHP_COMPATIBILITY_INVALID:
return [
'message' => $this->translator->trans(
'Your current PHP version isn\'t compatible with your PrestaShop version. (Expected: %s - %s | Current: %s)',
[$phpCompatibilityRange['php_min_version'], $phpCompatibilityRange['php_max_version'], $phpCompatibilityRange['php_current_version']]
'Your current PHP version isn\'t compatible with PrestaShop %s. (Expected: %s - %s | Current: %s)',
[$version, $phpCompatibilityRange['php_min_version'], $phpCompatibilityRange['php_max_version'], $phpCompatibilityRange['php_current_version']]
),
];

case self::ROOT_DIRECTORY_NOT_WRITABLE:
return [
'message' => $this->translator->trans('Your store\'s root directory isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'),
'message' => $this->translator->trans(
'Your store\'s root directory %s isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.',
[$this->prodRootPath]
),
];

case self::ADMIN_UPGRADE_DIRECTORY_NOT_WRITABLE:
return [
'message' => $this->translator->trans('The "/admin/autoupgrade" directory isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'),
// TODO: sanitize autoUpgradePath or add generic placeholder for path
'message' => $this->translator->trans(
'The %s directory isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.',
[$this->autoUpgradePath]
),
];

case self::SAFE_MODE_ENABLED:
Expand All @@ -236,10 +244,12 @@ public function getRequirementWording(int $requirement, bool $isWebVersion = fal
return [
'message' => $this->translator->trans('Files can\'t be downloaded. Enable PHP\'s "allow_url_fopen" option or install PHP extension "cURL".'),
];

case self::ZIP_DISABLED:
return [
'message' => $this->translator->trans('Missing PHP extension "zip".'),
];

case self::MAINTENANCE_MODE_DISABLED:
if ($isWebVersion) {
$maintenanceLink = Context::getContext()->link->getAdminLink('AdminMaintenance');
Expand All @@ -257,15 +267,29 @@ public function getRequirementWording(int $requirement, bool $isWebVersion = fal
return [
'message' => $this->translator->trans('Maintenance mode needs to be enabled. Enable maintenance mode and add your maintenance IP in [1]Shop parameters > General > Maintenance[/1].', $params),
];

case self::CACHE_ENABLED:
if ($isWebVersion) {
$cacheLink = Context::getContext()->link->getAdminLink('AdminPerformance');
$params = [
'[1]' => '<a class="link" href=' . $cacheLink . ' target="_blank">',
'[/1]' => '</a>',
];
} else {
$params = [
'[1]' => '',
'[/1]' => '',
];
}

return [
'message' => $this->translator->trans('PrestaShop\'s caching features needs to be disabled.'),
'message' => $this->translator->trans('PrestaShop\'s caching features needs to be disabled. Disable caching features in [1]Advanced parameters > Performance > Caching[/1].', $params),
];

case self::MAX_EXECUTION_TIME_VALUE_INCORRECT:
return [
'message' => $this->translator->trans(
'PHP\'s max_execution_time setting needs to have a high value or needs to be disabled entirely (current value: %s seconds)',
'PHP\'s max_execution_time setting needs to have a high value or needs to be disabled entirely (current value: %s seconds).',
[$this->getMaxExecutionTime()]
),
];
Expand Down Expand Up @@ -296,14 +320,15 @@ public function getRequirementWording(int $requirement, bool $isWebVersion = fal
return [
'message' => $this->translator->trans('PHP file_uploads configuration needs to be enabled.'),
];

case self::KEY_GENERATION_INVALID:
return [
'message' => $this->translator->trans('Unable to generate private keys using openssl_pkey_new. Check your OpenSSL configuration, especially the path to openssl.cafile.'),
];

case self::NOT_WRITING_DIRECTORY_LIST_NOT_EMPTY:
return [
'message' => $this->translator->trans('It\'s not possible to write in the following folders, please provide write access to the user running PHP with appropriate permission & ownership: '),
'message' => $this->translator->trans('It\'s not possible to write in the following folders. Provide write access to the user running PHP with appropriate permission & ownership: '),
'list' => $this->getNotWritingDirectories(),
];

Expand All @@ -313,13 +338,29 @@ public function getRequirementWording(int $requirement, bool $isWebVersion = fal
];

case self::MODULE_VERSION_IS_OUT_OF_DATE:
if ($isWebVersion) {
$moduleUpdateLink = Context::getContext()->link->getAdminLink('AdminModulesUpdates');
$params = [
'[1]' => '<a class="link" href=' . $moduleUpdateLink . ' target="_blank">',
'[/1]' => '</a>',
];
} else {
$params = [
'[1]' => '',
'[/1]' => '',
];
}

return [
'message' => $this->translator->trans('Your current version of the module is outdated.'),
'message' => $this->translator->trans('Your current version of the module is out of date. Update now [1]Modules > Module Manager > Updates[/1]', $params),
];

case self::PHP_COMPATIBILITY_UNKNOWN:
return [
'message' => $this->translator->trans('We were unable to check your PHP compatibility with the destination PrestaShop version.'),
'message' => $this->translator->trans(
'We were unable to check your PHP compatibility with PrestaShop %s.',
[$version]
),
];

case self::TEMPERED_FILES_LIST_NOT_EMPTY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function testValidateReturnsErrorIfVersionsDoNotMatch()
$result = $this->validator->validate($data);

$this->assertSame([
'message' => 'The PrestaShop version in your archive doesnt match the one in XML file. Please fix this issue and try again.',
'message' => 'The PrestaShop version in your archive doesn\'t match the one in XML file. Please fix this issue and try again.',
], $result[0]);
}

Expand Down
10 changes: 7 additions & 3 deletions views/templates/components/check-requirements.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
</div>
{% else %}
<div class="check-requirements check-requirements--success">
<div class="alert alert-success">
{{ 'The requirements check is complete, you can update your store to this version of PrestaShop.'|trans({}) }}
</div>
{% include "@ModuleAutoUpgrade/components/alert.html.twig" with {
title: '',
message: 'The requirements check is complete, you can update your store to this version of PrestaShop.'|trans({}),
alertStatus: 'success',
buttonLabel: '',
buttonUrl: '',
} %}
</div>
{% endif %}
18 changes: 11 additions & 7 deletions views/templates/components/local-archive.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="local-archive">
<div class="form-group">
<label for="{{ form_fields.archive_zip }}">
{{ 'Archive to use:'|trans({}) }}
{{ 'Archive to use'|trans({}) }}
<span class="require-star">*</span>
</label>

Expand All @@ -12,7 +12,7 @@
name="{{ form_fields.archive_zip }}"
required
>
<option value="">{{ 'Choose an archive'|trans({}) }}</option>
<option value="">{{ 'Select an archive'|trans({}) }}</option>
{% for fileName in archiveFiles %}
<option
{% if current_values is defined and current_values.archive_zip == fileName %}
Expand All @@ -35,7 +35,7 @@

<div class="form-group">
<label for="{{ form_fields.archive_xml }}">
{{ 'XML file to use:'|trans({}) }}
{{ 'XML file to use'|trans({}) }}
<span class="require-star">*</span>
</label>

Expand All @@ -45,7 +45,7 @@
name="{{ form_fields.archive_xml }}"
required
>
<option value="">{{ 'Choose an XML file'|trans({}) }}</option>
<option value="">{{ 'Select a file'|trans({}) }}</option>
{% for fileName in xmlFiles %}
<option
{% if current_values is defined and current_values.archive_xml == fileName %}
Expand Down Expand Up @@ -79,7 +79,11 @@
</div>
</div>
{% else %}
<div class="alert alert-warning">
{{ 'No archive found in your admin/autoupgrade/download directory'|trans({}) }}
</div>
{% include "@ModuleAutoUpgrade/components/alert.html.twig" with {
title: '',
message: 'No archive found in the following directory: /your-admin-directory/autoupgrade/download/'|trans({}),
alertStatus: 'warning',
buttonLabel: '',
buttonUrl: '',
} %}
{% endif %}
2 changes: 1 addition & 1 deletion views/templates/components/radio-card-local.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
radioValue: form_options.local_value,
checked: current_values.channel == form_options.local_value,
title: "Local archive"|trans({}),
message: "Save the archive file of the version you want to update to in the following directory: /admin/autoupgrade/download/"|trans({}),
message: "Save the archive file of the version you want to update to in the following directory: /your-admin-directory/autoupgrade/download/"|trans({}),
archiveCard: true,
enableRequirementsCheck: true,
archiveFiles: local_archives.zip,
Expand Down
2 changes: 1 addition & 1 deletion views/templates/components/radio-card.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
target="_blank"
rel="noopener"
>
Release note
{{ 'Release note'|trans({}) }}
<i class="material-icons">open_in_new</i>
</a>
{% endif %}
Expand Down
4 changes: 4 additions & 0 deletions views/templates/errors/500.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
{% endblock %}

{% block button %}
<a class="error-page__button btn btn-default btn-lg" href="#">
{{ 'Send error report'|trans({}) }}
</a>

<a class="error-page__button btn btn-primary btn-lg" href="#">
{{ 'Go back to Update assistant'|trans({}) }}
</a>
Expand Down
8 changes: 5 additions & 3 deletions views/templates/layouts/error.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
{# Default description can go here, or it can be left empty so that children can override it #}
{% endblock %}

{% block button %}
{# Default button can go here, or it can be left empty so that children can override it #}
{% endblock %}
<div class="error-page__buttons">
{% block button %}
{# Default button can go here, or it can be left empty so that children can override it #}
{% endblock %}
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion views/templates/steps/backup.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block page_class %}backup-page{% endblock %}

{% block title %}
<h2>{{ step.title }}</h2>
<h2>{{ 'Back up your store'|trans({}) }}</h2>
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion views/templates/steps/home.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% include "@ModuleAutoUpgrade/components/radio-card.html.twig" with {
checked: false,
title: 'Restore from a backup'|trans({}),
message: 'Use this feature if the update failed or if your store or a module is no longer working properly.'|trans({}),
message: 'Use this feature if the update failed or if your store or a module is no longer working properly.'|trans({}),
disabled: false,
radioName: form_fields.route_choice,
radioValue: form_options.restore_value,
Expand Down
2 changes: 1 addition & 1 deletion views/templates/steps/post-restore.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block page_class %}post-restore-checklist-page{% endblock %}

{% block title %}
<h2>{{ step.title }}</h2>
<h2>{{ 'Post-restore checklist'|trans({}) }}</h2>
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion views/templates/steps/post-update.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block page_class %}post-update-checklist-page{% endblock %}

{% block title %}
<h2>{{ step.title }}</h2>
<h2>{{ 'Post-update checklist'|trans({}) }}</h2>
{% endblock %}

{% block content %}
Expand Down
7 changes: 2 additions & 5 deletions views/templates/steps/update-options.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
id: form_fields.deactive_non_native_modules.field,
name: form_fields.deactive_non_native_modules.field,
title: "Deactivate non-native modules"|trans({}),
description: "All the modules installed after creating your store are considered non-native modules. They might be " ~
"incompatible with the new version of PrestaShop. We recommend deactivating them during the update."|trans({}),
description: "All the modules installed after creating your store are considered non-native modules. They might be incompatible with the new version of PrestaShop. We recommend deactivating them during the update."|trans({}),
value: form_fields.deactive_non_native_modules.value,
error_message: errors[form_fields.deactive_non_native_modules.field] is defined ? errors[form_fields.deactive_non_native_modules.field] : null,
} %}
Expand All @@ -38,9 +37,7 @@
id: form_fields.disable_all_overrides.field,
name: form_fields.disable_all_overrides.field,
title: "Disable all overrides"|trans({}),
description: "Overriding is a way to replace business behaviors (class files and controller files) to target only " ~
"one method or as many as you need. This option disables all classes & controllers overrides, allowing " ~
"you to avoid conflicts during and after updates."|trans({}),
description: "Overriding is a way to replace business behaviors (class files and controller files) to target only one method or as many as you need. This option disables all classes & controllers overrides, allowing you to avoid conflicts during and after updates."|trans({}),
value: form_fields.disable_all_overrides.value,
error_message: errors[form_fields.disable_all_overrides.field] is defined ? errors[form_fields.disable_all_overrides.field] : null,
} %}
Expand Down
Loading

0 comments on commit 0c8863e

Please sign in to comment.