Skip to content

Commit

Permalink
Merge pull request #507 from BitBagCommerce/feature/OP-329
Browse files Browse the repository at this point in the history
OP-329: Forms/elements consistency
  • Loading branch information
jkindly authored Jul 15, 2024
2 parents c84b85d + ce2eef1 commit 47106fa
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 40 deletions.
5 changes: 5 additions & 0 deletions src/Form/Type/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'multiple' => true,
'expanded' => true,
])
->add('path', TextType::class, [
'label' => 'bitbag_sylius_cms_plugin.ui.path',
'disabled' => true,
'required' => false,
])
->add('translations', ResourceTranslationsType::class, [
'entry_type' => MediaTranslationType::class,
])
Expand Down
32 changes: 16 additions & 16 deletions src/Menu/ContentManagementMenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
;

$cmsRootMenuItem
->addChild('blocks', [
'route' => 'bitbag_sylius_cms_plugin_admin_block_index',
])
->setLabel('bitbag_sylius_cms_plugin.ui.blocks')
->setLabelAttribute('icon', 'block layout')
;

$cmsRootMenuItem
->addChild('media', [
'route' => 'bitbag_sylius_cms_plugin_admin_media_index',
->addChild('collections', [
'route' => 'bitbag_sylius_cms_plugin_admin_collection_index',
])
->setLabel('bitbag_sylius_cms_plugin.ui.media')
->setLabelAttribute('icon', 'file')
->setLabel('bitbag_sylius_cms_plugin.ui.collections')
->setLabelAttribute('icon', 'grid layout')
;

$cmsRootMenuItem
Expand All @@ -48,11 +40,19 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
;

$cmsRootMenuItem
->addChild('collections', [
'route' => 'bitbag_sylius_cms_plugin_admin_collection_index',
->addChild('blocks', [
'route' => 'bitbag_sylius_cms_plugin_admin_block_index',
])
->setLabel('bitbag_sylius_cms_plugin.ui.collections')
->setLabelAttribute('icon', 'grid layout')
->setLabel('bitbag_sylius_cms_plugin.ui.blocks')
->setLabelAttribute('icon', 'block layout')
;

$cmsRootMenuItem
->addChild('media', [
'route' => 'bitbag_sylius_cms_plugin_admin_media_index',
])
->setLabel('bitbag_sylius_cms_plugin.ui.media')
->setLabelAttribute('icon', 'file')
;
}
}
10 changes: 10 additions & 0 deletions src/Resources/config/grids/admin/block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ sylius_grid:
code: asc
limits: [10, 25, 50]
fields:
name:
type: string
label: bitbag_sylius_cms_plugin.ui.name
sortable: name
code:
type: string
label: sylius.ui.code
Expand All @@ -26,6 +30,12 @@ sylius_grid:
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/collections.html.twig"
channels:
type: twig
label: bitbag_sylius_cms_plugin.ui.channels
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/channels.html.twig"
filters:
search:
type: string
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/grids/admin/collection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ sylius_grid:
code: asc
limits: [10, 25, 50]
fields:
name:
type: string
label: bitbag_sylius_cms_plugin.ui.name
sortable: translation.name
code:
type: string
label: bitbag_sylius_cms_plugin.ui.code
Expand All @@ -17,10 +21,6 @@ sylius_grid:
type: string
label: bitbag_sylius_cms_plugin.ui.type
sortable: ~
name:
type: string
label: bitbag_sylius_cms_plugin.ui.name
sortable: translation.name
filters:
search:
type: string
Expand Down
23 changes: 17 additions & 6 deletions src/Resources/config/grids/admin/media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,23 @@ sylius_grid:
type: string
label: bitbag_sylius_cms_plugin.ui.code
sortable: ~
path:
type: string
label: bitbag_sylius_cms_plugin.ui.path
type:
type: string
label: bitbag_sylius_cms_plugin.ui.type
enabled:
type: twig
label: sylius.ui.enabled
options:
template: "@SyliusUi/Grid/Field/enabled.html.twig"
collections:
type: twig
label: bitbag_sylius_cms_plugin.ui.collections
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/collections.html.twig"
channels:
type: twig
label: bitbag_sylius_cms_plugin.ui.channels
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/channels.html.twig"
filters:
search:
type: string
Expand Down
21 changes: 14 additions & 7 deletions src/Resources/config/grids/admin/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,31 @@ sylius_grid:
code: asc
limits: [10, 25, 50]
fields:
code:
type: string
label: bitbag_sylius_cms_plugin.ui.code
sortable: ~
name:
type: string
label: bitbag_sylius_cms_plugin.ui.name
sortable: name
slug:
code:
type: string
label: bitbag_sylius_cms_plugin.ui.slug
sortable: translation.slug
label: bitbag_sylius_cms_plugin.ui.code
sortable: ~
enabled:
type: twig
label: sylius.ui.enabled
options:
template: "@SyliusUi/Grid/Field/enabled.html.twig"
collections:
type: twig
label: bitbag_sylius_cms_plugin.ui.collections
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/collections.html.twig"
channels:
type: twig
label: bitbag_sylius_cms_plugin.ui.channels
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/channels.html.twig"
filters:
search:
type: string
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Block/Crud/_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<div class="column">
<div class="ui segment">
{{ form_errors(form) }}
{{ form_row(form.code) }}
{{ form_row(form.name) }}
{{ form_row(form.code) }}
{{ form_row(form.enabled) }}
{{ form_row(form.channels) }}
{{ form_row(form.locales) }}
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/views/Grid/Field/channels.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for channel in data.channels %}
<span class="ui label">{{ channel.code }}</span>
{% endfor %}
9 changes: 5 additions & 4 deletions src/Resources/views/Media/Crud/_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
<div class="ui two column stackable grid" data-bb-target="cms-handle-preview">
<div class="column">
<div class="ui segment">
{{ form_row(form.code) }}
{{ form_row(form.name) }}
{{ form_row(form.code) }}
{{ form_row(form.enabled) }}
{{ form_row(form.channels) }}
{{ form_row(form.collections) }}
{{ form_row(form.type) }}
{{ form_row(form.file) }}
{{ form_row(form.enabled) }}
{{ form_row(form.saveWithOriginalName) }}
{{ form_row(form.collections) }}
{{ form_row(form.channels) }}
{{ form_row(form.path) }}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/views/Page/Crud/_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<div class="ui two column stackable grid" data-bb-target="cms-handle-preview">
<div class="column">
<div class="ui segment" data-bb-cms-wrapper>
{{ form_row(form.name) }}
{{ form_row(form.code) }}
{{ form_row(form.enabled) }}
{{ form_row(form.name) }}
{{ form_row(form.collections) }}
{{ form_row(form.channels) }}
{{ form_row(form.locales) }}
{{ form_row(form.collections) }}
{{ form_row(form.publishAt) }}
</div>
<div class="ui segment">
Expand Down

0 comments on commit 47106fa

Please sign in to comment.