Skip to content

Commit

Permalink
fix: dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
tblivet committed Jan 9, 2025
1 parent f4add9e commit 95a9bdf
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 110 deletions.
9 changes: 7 additions & 2 deletions storybook/stories/components/DialogBackupDelete.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

import DialogBackupDelete from "../../../views/templates/dialogs/dialog-backup-delete.html.twig";
import DialogBackupDelete from "../../../views/templates/dialogs/dialog-delete-backup.html.twig";

export default {
title: "Components/Dialog",
Expand All @@ -34,7 +34,12 @@ export const BackupDelete = {
args: {
backup_name: "autoupgrade_save_8.1.6",
backup_date: "15/07/2024 8:00",
is_only_backup: true,
only_backup: true,
form_name: "delete-backup",
form_route_to_confirm_delete: "/",
form_fields: {
BACKUP_NAME: "backup_name",
},
},
play: async () => {
const dialog = document.querySelector('.dialog');
Expand Down
48 changes: 48 additions & 0 deletions storybook/stories/components/DialogRestoreFromBackup.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

import DialogRestoreFromBackup from "../../../views/templates/dialogs/dialog-restore-from-backup.html.twig";

export default {
title: "Components/Dialog",
component: DialogRestoreFromBackup,
args: {
backup_version: "1.7.8.1",
backup_name: "backup-name",
backup_date: "2024-01-01",
form_name: "backup_to_restore",
form_route_to_confirm_restore: "/",
form_fields: {
BACKUP_NAME: "backup_name",
},
},
};

export const RestoreFromBackup = {
play: async () => {
const dialog = document.querySelector('.dialog');
dialog.showModal();
},
};
2 changes: 1 addition & 1 deletion storybook/stories/pages/BackupSelection.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

import BackupSelectionPage from "../../../views/templates/pages/rollback.html.twig";
import BackupSelectionPage from "../../../views/templates/pages/restore.html.twig";
import { Default as BackupSelectionComponent } from "../components/BackupSelection.stories";
import { BackupSelection as Stepper } from "../components/Stepper.stories";

Expand Down
2 changes: 1 addition & 1 deletion storybook/stories/pages/PostRestore.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

import PostRestorePage from "../../../views/templates/pages/rollback.html.twig";
import PostRestorePage from "../../../views/templates/pages/restore.html.twig";
import { PostRestore as Stepper } from "../components/Stepper.stories";

export default {
Expand Down
2 changes: 1 addition & 1 deletion storybook/stories/pages/Restore.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

import RestorePage from "../../../views/templates/pages/rollback.html.twig";
import RestorePage from "../../../views/templates/pages/restore.html.twig";
import { RestoreLogsProgress as LogsProgress } from "../components/LogsProgress.stories";
import { RestoreLogsViewer as LogsViewer } from "../components/LogsViewer.stories";
import { Restore as Stepper } from "../components/Stepper.stories";
Expand Down
31 changes: 0 additions & 31 deletions views/templates/dialogs/dialog-backup-delete.html.twig

This file was deleted.

20 changes: 8 additions & 12 deletions views/templates/dialogs/dialog-backup.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@

{% block dialog_extra_content %}{% endblock %}

{% block dialog_footer %}
<div class="dialog__footer">
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>

<button type="button" class="btn btn-primary">
<i class="material-icons">settings_backup_restore</i>
{{ 'Start backup'|trans({}) }}
</button>
{% endblock %}
</div>
<button type="button" class="btn btn-primary">
<i class="material-icons">settings_backup_restore</i>
{{ 'Start backup'|trans({}) }}
</button>
{% endblock %}
24 changes: 10 additions & 14 deletions views/templates/dialogs/dialog-delete-backup.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@

{% block dialog_extra_content %}{% endblock %}

{% block dialog_footer %}
<div class="dialog__footer">
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>

<form id="{{ form_name }}" name="{{ form_name }}" data-route-to-confirm-delete="{{ form_route_to_confirm_delete }}">
<input type="hidden" name="{{ form_fields.BACKUP_NAME }}" value="{{ backup_name }}">
<button type="submit" class="btn btn-danger">
{{ 'Delete '|trans({}) }}
</button>
</form>
{% endblock %}
</div>
<form id="{{ form_name }}" name="{{ form_name }}" data-route-to-confirm-delete="{{ form_route_to_confirm_delete }}">
<input type="hidden" name="{{ form_fields.BACKUP_NAME }}" value="{{ backup_name }}">
<button type="submit" class="btn btn-danger">
{{ 'Delete'|trans({}) }}
</button>
</form>
{% endblock %}
20 changes: 8 additions & 12 deletions views/templates/dialogs/dialog-error-report.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@
</form>
{% endblock %}

{% block dialog_footer %}
<div class="dialog__footer">
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>

<button type="submit" form="form-error-feedback" class="btn btn-primary">
<i class="material-icons">send</i>
{{ 'Send error report'|trans({}) }}
</button>
{% endblock %}
</div>
<button type="submit" form="form-error-feedback" class="btn btn-primary">
<i class="material-icons">send</i>
{{ 'Send error report'|trans({}) }}
</button>
{% endblock %}
24 changes: 10 additions & 14 deletions views/templates/dialogs/dialog-restore-from-backup.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@

{% block dialog_extra_content %}{% endblock %}

{% block dialog_footer %}
<div class="dialog__footer">
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>

<form id="{{ form_name }}" name="{{ form_name }}" data-route-to-confirm-restore="{{ form_route_to_confirm_restore }}">
<input type="hidden" name="{{ form_fields.BACKUP_NAME }}" value="{{ backup_name }}" />
<button type="submit" class="btn btn-primary">
{{ 'Restore'|trans({}) }}
</button>
</form>
{% endblock %}
</div>
<form id="{{ form_name }}" name="{{ form_name }}" data-route-to-confirm-restore="{{ form_route_to_confirm_restore }}">
<input type="hidden" name="{{ form_fields.BACKUP_NAME }}" value="{{ backup_name }}" />
<button type="submit" class="btn btn-primary">
{{ 'Restore'|trans({}) }}
</button>
</form>
{% endblock %}
40 changes: 18 additions & 22 deletions views/templates/dialogs/dialog-update.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,23 @@
{% endif %}
{% endblock %}

{% block dialog_footer %}
<div class="dialog__footer">
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>
{% block dialog_footer_inner %}
<button type="button" class="btn btn-link" data-dismiss="dialog">
{{ 'Cancel'|trans({}) }}
</button>

<button
type="submit"
class="btn btn-primary"
form="form-confirm-update"
>
<img
class="dialog__rocket-icon rocket-icon"
src="{{ assets_base_path }}/img/rocket_white.svg"
width="20"
height="20"
alt=""
/>
{{ 'Start update'|trans({}) }}
</button>
{% endblock %}
</div>
<button
type="submit"
class="btn btn-primary"
form="form-confirm-update"
>
<img
class="dialog__rocket-icon rocket-icon"
src="{{ assets_base_path }}/img/rocket_white.svg"
width="20"
height="20"
alt=""
/>
{{ 'Start update'|trans({}) }}
</button>
{% endblock %}

0 comments on commit 95a9bdf

Please sign in to comment.