-
Notifications
You must be signed in to change notification settings - Fork 63
OP-551: Wishlist index view #288
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
Open
hmfilar
wants to merge
13
commits into
feature/OP-551-Sylius-2.0-support
Choose a base branch
from
OP-551-wishlist-index-view
base: feature/OP-551-Sylius-2.0-support
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
615f7e8
OP-551: Render wishlist index using twig hooks
hmfilar 17ae3cc
OP-551: Render form with hooks
hmfilar d11a0af
OP-551: Adjust form styles
hmfilar 745ac81
OP-551: Adjust displaying price
hmfilar e14c1d9
OP-551: Fix flashes
hmfilar 8e19d98
OP-551: Fix macro import
hmfilar 1664db3
OP-551: Add hookable templates
hmfilar f287214
OP-551: Move hooks setup to main app config
hmfilar 370d060
OP-551: Align with Sylius standards
hmfilar 831610b
OP-551: Adjust item list styling
hmfilar 67aa4c6
OP-551: Split header into hookables, adjust styling
hmfilar 87ccb23
OP-551: Tweak global actions styles
hmfilar 0435d4a
OP-551: Add hookables for actions and tweak styles
hmfilar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,11 +76,5 @@ | |
| align-items: center; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| > * { | ||
| span { | ||
| color: $lightgray; | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| imports: | ||
| - { resource: "@BitBagSyliusWishlistPlugin/Resources/config/services.xml" } | ||
| - { resource: "@BitBagSyliusWishlistPlugin/Resources/config/twig_hooks/**/*.yaml" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| sylius_twig_hooks: | ||
| hooks: | ||
| 'bitbag_sylius_wishlist_plugin.wishlist.index': | ||
| content: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content.html.twig" | ||
| priority: 0 | ||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content': | ||
| header: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/header.html.twig" | ||
| priority: 100 | ||
| form: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form.html.twig" | ||
| priority: 90 | ||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content.form': | ||
| form: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections.html.twig" | ||
| priority: 0 | ||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections': | ||
| items: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items.html.twig" | ||
| priority: 100 | ||
| actions: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/actions.html.twig" | ||
| priority: 90 | ||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.actions': | ||
| collective_actions: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/actions/collectiveActions.html.twig" | ||
| priority: 100 | ||
| global_actions: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/actions/globalActions.html.twig" | ||
| priority: 90 | ||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.items': | ||
| head: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/head.html.twig" | ||
| priority: 100 | ||
| body: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body.html.twig" | ||
| priority: 90 | ||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.items.head': | ||
| select_all: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/head/selectAll.html.twig" | ||
hmfilar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| priority: 100 | ||
| image: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/head/image.html.twig" | ||
| priority: 90 | ||
| price: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/head/price.html.twig" | ||
| priority: 80 | ||
| quantity: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/head/quantity.html.twig" | ||
| priority: 70 | ||
| actions: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/head/actions.html.twig" | ||
| priority: 60 | ||
hmfilar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.items.body': | ||
| checkbox: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/checkbox.html.twig" | ||
| priority: 100 | ||
| image: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/image.html.twig" | ||
| priority: 90 | ||
| name: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/name.html.twig" | ||
| priority: 80 | ||
| variant: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/variant.html.twig" | ||
| priority: 80 | ||
| price: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/price.html.twig" | ||
| priority: 70 | ||
| quantity: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/quantity.html.twig" | ||
| priority: 60 | ||
| remove: | ||
| template: "@BitBagSyliusWishlistPlugin/WishlistDetails/index/content/form/sections/items/body/remove.html.twig" | ||
| priority: 50 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| sylius_twig_hooks: | ||
| hooks: | ||
| 'sylius_shop.base.header.content': | ||
| wishlist_header: | ||
| template: "@BitBagSyliusWishlistPlugin/_wishlist_header.html.twig" | ||
hmfilar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| priority: 150 | ||
|
|
||
| # TODO find the right way to extend product box's content | ||
| #sylius.shop.product.index.box: | ||
| # blocks: | ||
| # content: | ||
| # template: "@BitBagSyliusWishlistPlugin/Product/Box/_content.html.twig" | ||
| # priority: 10 | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/Resources/views/WishlistDetails/_variantPrice.html.twig
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,96 +1,9 @@ | ||
| {% extends '@SyliusShop/shared/layout/base.html.twig' %} | ||
|
|
||
| {% import '@SyliusShop/shared/messages.html.twig' as messages %} | ||
| {% set prefixes = ['bitbag_sylius_wishlist_plugin.wishlist'] %} | ||
|
|
||
| {% block title %}{{ 'bitbag_sylius_wishlist_plugin.ui.your_wishlist'|trans }} | {{ parent() }}{% endblock %} | ||
|
|
||
| {% block content %} | ||
| <h1 class="ui header"> | ||
| <i class="circular heart icon"></i> | ||
| <div class="content bb-wishlist-header"> | ||
| {{ wishlist.name }} | ||
| </div> | ||
| </h1> | ||
| {% if sylius.channel is not null %} | ||
| {% set wishlists = findAllByAnonymousAndChannel(sylius.channel) %} | ||
| {% else %} | ||
| {% set wishlists = findAllByAnonymous() %} | ||
| {% endif %} | ||
| {% if wishlists|length > 1 %} | ||
| {% else %} | ||
| <div class="middle aligned column"> | ||
| <button id="create_new_wishlist_button" class="ui right floated primary button" | ||
| data-bb-wishlist-add="add-another-wishlist" | ||
| data-bb-wishlist-add-url="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_create_new_wishlist') }}" | ||
| data-bb-wishlist-add-title="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_add_title'|trans }}" | ||
| data-bb-wishlist-add-perform="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_add_perform'|trans }}" | ||
| data-bb-wishlist-add-cancel="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_add_cancel'|trans }}" | ||
| data-bb-wishlist-add-error="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_add_error'|trans }}" | ||
| > | ||
| {{ 'bitbag_sylius_wishlist_plugin.ui.add_another_wishlist'|trans }} | ||
| </button> | ||
| <input type="hidden" data-bb-csrf="{{ csrf_token('some-name') }}"/> | ||
| </div> | ||
| {% endif %} | ||
| <div class="ui hidden divider"></div> | ||
|
|
||
| {% if wishlist.wishlistProducts.count > 0 %} | ||
| <div class="middle aligned column"> | ||
| <a href="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_clean', {'wishlistId': wishlist.id}) }}" class="bitbag-clean-wishlist"> | ||
| <i class="icon remove"></i>{{ 'bitbag_sylius_wishlist_plugin.ui.clear_wishlist'|trans }} | ||
| </a> | ||
| </div> | ||
|
|
||
| <div class="ui hidden divider"></div> | ||
|
|
||
| {{ form_start(form, { attr: { class: 'bb-wishlist ui form', id: "wishlist_form" } }) }} | ||
|
|
||
| <div class="ui stackable" id="wishlist"> | ||
|
|
||
| <div class="bb-wishlist-item"> | ||
| <div class="bb-wishlist-item-select"> | ||
| <input type="checkbox" id="toggle-checkboxes" class="bb-wishlist-item-select-checkbox"> | ||
| </div> | ||
| <div class="bb-wishlist-item-image"> | ||
| <span>{{ 'sylius.ui.item'|trans }}</span> | ||
| </div> | ||
| <div class="bb-wishlist-item-price"> | ||
| <span>{{ 'sylius.ui.unit_price'|trans }}</span> | ||
| </div> | ||
| <div class="bb-wishlist-item-quantity"> | ||
| <span>{{ 'sylius.ui.qty'|trans }}</span> | ||
| </div> | ||
| <div class="bb-wishlist-item-actions"> | ||
| <span>{{ 'sylius.ui.actions'|trans }}</span> | ||
| </div> | ||
| </div> | ||
|
|
||
| {% for itemForm in form.items %} | ||
| {% include "@BitBagSyliusWishlistPlugin/WishlistDetails/_item.html.twig" %} | ||
| <input type="hidden" name="wishlist_collection[items][{{ loop.index - 1 }}][variant]" value="{{ itemForm.vars.data.wishlistProduct.variant.id }}"/> | ||
| {% endfor %} | ||
|
|
||
| <div class="bb-wishlist-actions"> | ||
| {% include "@BitBagSyliusWishlistPlugin/WishlistDetails/_collectiveActions.html.twig" %} | ||
| {% include "@BitBagSyliusWishlistPlugin/WishlistDetails/_globalActions.html.twig" %} | ||
| </div> | ||
| <input type="hidden" data-bb-csrf="{{ csrf_token('some-name') }}"/> | ||
| </div> | ||
|
|
||
| {{ form_row(form._token) }} | ||
| {{ form_end(form, {'render_rest': false} ) }} | ||
| {% else %} | ||
| <div class="ui one column stackable grid"> | ||
| <div class="column"> | ||
| {{ messages.info('bitbag_sylius_wishlist_plugin.ui.your_wishlist_is_empty'|trans) }} | ||
| </div> | ||
| <a href="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_import_from_csv') }}"> | ||
| <button type="button" class="ui secondary button bb-wishlist-actions-import-button" {{ sylius_test_html_attribute('wishlist-import-from-csv') }}> | ||
| <i class="cart icon"></i> | ||
| {{ 'bitbag_sylius_wishlist_plugin.ui.import_from_csv'|trans }} | ||
| </button> | ||
| </a> | ||
| </div> | ||
| {% endif %} | ||
|
|
||
| {% hook 'index' with { _prefixes: prefixes, wishlist, form } %} | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {% set wishlist = hookable_metadata.context.wishlist %} | ||
| {% set form = hookable_metadata.context.form %} | ||
|
|
||
| <div class="container mt-4 mb-5"> | ||
| {% hook 'content' with { wishlist, form } %} | ||
| </div> |
28 changes: 28 additions & 0 deletions
28
src/Resources/views/WishlistDetails/index/content/form.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| {% import '@SyliusShop/shared/messages.html.twig' as messages %} | ||
|
|
||
| {% set wishlist = hookable_metadata.context.wishlist %} | ||
| {% set form = hookable_metadata.context.form %} | ||
|
|
||
| {% if wishlist.wishlistProducts.count > 0 %} | ||
| <div class="middle aligned column"> | ||
| <a href="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_clean', {'wishlistId': wishlist.id}) }}" class="bitbag-clean-wishlist"> | ||
| <i class="icon remove"></i>{{ 'bitbag_sylius_wishlist_plugin.ui.clear_wishlist'|trans }} | ||
| </a> | ||
| </div> | ||
|
|
||
| <div class="ui hidden divider"></div> | ||
|
|
||
| {% hook 'form' with { wishlist, form } %} | ||
| {% else %} | ||
| <div class="ui one column stackable grid"> | ||
| <div class="column"> | ||
| {{ messages.info('bitbag_sylius_wishlist_plugin.ui.your_wishlist_is_empty'|trans) }} | ||
| </div> | ||
| <a href="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_import_from_csv') }}"> | ||
| <button type="button" class="ui secondary button bb-wishlist-actions-import-button" {{ sylius_test_html_attribute('wishlist-import-from-csv') }}> | ||
| <i class="cart icon"></i> | ||
| {{ 'bitbag_sylius_wishlist_plugin.ui.import_from_csv'|trans }} | ||
| </button> | ||
| </a> | ||
| </div> | ||
| {% endif %} |
15 changes: 15 additions & 0 deletions
15
src/Resources/views/WishlistDetails/index/content/form/sections.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {% set wishlist = hookable_metadata.context.wishlist %} | ||
| {% set form = hookable_metadata.context.form %} | ||
|
|
||
| {% form_theme form '@SyliusShop/form/theme.html.twig' %} | ||
|
|
||
| {{ form_start(form, { attr: { class: 'bb-wishlist ui form', id: "wishlist_form" } }) }} | ||
|
|
||
| <div class="ui stackable" id="wishlist"> | ||
| {% hook 'sections' with { form, wishlist } %} | ||
|
|
||
| <input type="hidden" data-bb-csrf="{{ csrf_token('some-name') }}"/> | ||
| </div> | ||
|
|
||
| {{ form_row(form._token) }} | ||
| {{ form_end(form, {'render_rest': false} ) }} |
6 changes: 6 additions & 0 deletions
6
src/Resources/views/WishlistDetails/index/content/form/sections/actions.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {% set wishlist = hookable_metadata.context.wishlist %} | ||
| {% set form = hookable_metadata.context.form %} | ||
|
|
||
| <div class="bb-wishlist-actions"> | ||
| {% hook 'actions' with { form, wishlist } %} | ||
| </div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.