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

refactor(admin/datatable): use correct translation keys and crud overview #962

Merged
merged 17 commits into from
Jul 25, 2024

Conversation

Davidmattei
Copy link
Member

@Davidmattei Davidmattei commented Jul 23, 2024

Q A
Bug fix?
New feature?
BC breaks?
Deprecations?
Fixed tickets?
Documentation?

Replaced the index templates for the following:

  • Overview forms (structure forms)
  • Overview channels
  • Overview dashboards
  • Overview logs
  • Overview query searches
  • Overview uploaded file logs (admin)
  • Overview uploaded files (publisher)

Extra:

  • Toolbar actions can now be defined in the dataTableType.

  • For the uploaded asset/file controller, I refactored the route naming using constants. The publisher and admin route actions are in the same controller, but now the action name is prefix (publisherOverview, adminOverview)

  • Reused the uploadedFileDataTable for wysiwyg modals, file pick modal and publisher overview. On all 3 places we a group by sha1. Only on the admin datatable (Uploaded file logs) we do not group by sha1.

  • Added a new DashboardDefinition enum

@@ -32,7 +33,9 @@ public function index(Request $request): Response
{
$table = $this->dataTableFactory->create(ChannelDataTableType::class);

$form = $this->createForm(TableType::class, $table);
$form = $this->createForm(TableType::class, $table, [
'reorder_label' => t('type.reorder', ['type' => 'channel'],'emsco-core')
Copy link
Member

Choose a reason for hiding this comment

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

Then the pattern 'channel' is not translatable ?

Copy link
Member Author

@Davidmattei Davidmattei Jul 23, 2024

Choose a reason for hiding this comment

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

channel is just the type for the translation key and is translated

type:
    reorder: |-
        {type, select,
            channel {Reorder channels}
            other   {Reorder}
        }

More info about this format https://symfony.com/doc/current/reference/formats/message_format.html#selecting-different-messages-based-on-a-condition

);
$table->addItemPostAction(
route: 'ems_core_channel_delete',
labelKey: t('action.delete', [], 'emsco-core'),
Copy link
Member

Choose a reason for hiding this comment

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

I think there is a constant for 'emsco-core'

Copy link
Member Author

Choose a reason for hiding this comment

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

Using the t() function with a constant makes that the crawler will not detect the key. To make our translations automatically build with php build/translations en EMSCoreBundle --write --format=yml -d emsco-core we can not use constants as translation domain.

Toolbar can now be defined in the dataTableType
@Davidmattei Davidmattei force-pushed the refactor/datatables-part2 branch from 8b57c32 to ae853cf Compare July 23, 2024 08:46
@Davidmattei Davidmattei force-pushed the refactor/datatables-part2 branch from cdc1a45 to aed4e07 Compare July 23, 2024 12:09
@Davidmattei Davidmattei force-pushed the refactor/datatables-part2 branch from 2d068c4 to 903246e Compare July 23, 2024 13:01
@Davidmattei Davidmattei force-pushed the refactor/datatables-part2 branch from b2fa6ff to 9ab745f Compare July 23, 2024 14:19
It is the overview of the uploaded asset for publishers
Use UploadedAssetDataTableType for:
- pick file from server (file field)
- browser file (from wysiwyg ckeditor modal)
- publisher overview.

Because the uploadedAsset query should be same, grouped by hash.
- Improved routing actions and using constants.
- /publisher checked by security.yaml
- Renamed UploadedAssetLogDatatable to UploadedAssetAdminDataTableType.php
level_name should be entity property levelName
and remove index.html.twig for crud/index.html.twig
@Davidmattei Davidmattei marked this pull request as ready for review July 25, 2024 13:20
@Davidmattei Davidmattei requested a review from a team as a code owner July 25, 2024 13:20
@Davidmattei Davidmattei requested a review from theus77 July 25, 2024 13:20
@Davidmattei Davidmattei merged commit 629911e into ems-project:5.x Jul 25, 2024
2 checks passed
@Davidmattei Davidmattei changed the title refactor(datatable): use correct translation keys and crud overview refactor(admin/datatable): use correct translation keys and crud overview Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants