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

Move menuitem from list to tabs #41

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/etc/build/*
!/etc/build/.gitignore
/.idea
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be specified in your global gitignore, not in the project's.
Please remove it


/tests/Application/yarn.lock

Expand Down
12 changes: 3 additions & 9 deletions config/routing/shop_routing.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
speardevs_push_notifications_section:
path: /account/push-notifications
defaults:
_controller: 'SpearDevs\SyliusPushNotificationsPlugin\Controller\Shop\PushNotificationAction'
template: '@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification.html.twig'

speardevs_push_notifications_history_index:
path: /account/push-notifications-history
speardevs_push_notifications:
path: /account/push-notifications-section
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/account/push-notifications?

methods: [ GET ]
defaults:
_controller: speardevs_sylius_push_notifications_plugin.controller.push_notification_history::indexAction
Expand All @@ -16,7 +10,7 @@ speardevs_push_notifications_history_index:
grid: speardevs_push_notification_history
section: shop_account
permission: true
template: '@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification_history.html.twig'
template: '@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/index.html.twig'
repository:
method: findByCustomer
arguments:
Expand Down
7 changes: 1 addition & 6 deletions src/Menu/Shop/AccountMenuListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ public function addAccountMenuItems(MenuBuilderEvent $event): void
$menu = $event->getMenu();

$menu
->addChild('push_notification_section', ['route' => 'speardevs_push_notifications_section'])
->addChild('push_notification_section', ['route' => 'speardevs_push_notifications'])
->setLabel('speardevs_sylius_push_notifications_plugin.ui.my_account.push_notifications')
->setLabelAttribute('icon', 'star');

$menu
->addChild('push_notification_history', ['route' => 'speardevs_push_notifications_history_index'])
->setLabel('speardevs_sylius_push_notifications_plugin.ui.my_account.push_notification_history')
->setLabelAttribute('icon', 'history');
}
}
37 changes: 37 additions & 0 deletions templates/Shop/Account/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% extends '@SyliusShop/Account/RefundationDocument/layout.html.twig' %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we shouldn't have a project-specific stuff in the plugin's codebase.
Please do the changes based on the default Sylius templates, to make it work correctly with the default Sylius.
If you need anything project-specific, then you need to extend or override templates directly in the project codebase.
But then you would need to make sure, that everything works correctly with the default Sylius


{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %}
{% import '@SyliusShop/Common/Macro/headers.html.twig' as headers %}
{% import "@SyliusShop/Common/Macro/icons.html.twig" as icons %}

{% block turbo_frame_content %}

{{ block('grid_navigation') }}

<div class="tab-content mt-4">
<div class="tab-pane fade show active" id="active-tab-pane" role="tabpanel" aria-labelledby="active-tab" tabindex="0">
{{ include('@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification.html.twig') }}
</div>
<div class="tab-pane fade" id="realized-tab-pane" role="tabpanel" aria-labelledby="realized-tab" tabindex="1">
{{ include('@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification_history.html.twig') }}
</div>
</div>
{% endblock %}

{% block grid_navigation %}
{% set verified = resources.parameters.get('criteria').verified|default(null) %}

<ul class="nav nav-tabs refundations-documents-tabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="active-tab" data-bs-toggle="tab" data-bs-target="#active-tab-pane" type="button" role="tab" aria-controls="active-tab-pane" aria-selected="true">
{{ 'speardevs_sylius_push_notifications_plugin.ui.my_account.push_notifications'|trans }}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="realized-tab" data-bs-toggle="tab" data-bs-target="#realized-tab-pane" type="button" role="tab" aria-controls="realized-tab-pane" aria-selected="false">
{{ 'speardevs_sylius_push_notifications_plugin.ui.my_account.push_notification_history'|trans }}
</button>
</li>
</ul>
{% endblock %}