As an Editor, I want to be able to copy the content type in admin interface#1449
Conversation
|
PR depends on this ezsystems/ezplatform-kernel#97 as persistence cache doesn't get clear after |
|
Thanks @MarioBlazek for this contribution. |
|
Thanks @MarioBlazek |
|
Hi @MarioBlazek thank you for this PR, it is a requested feature that will improve the experience of our users 👍 |
| <th class="ez-table__header-cell">{{ 'content_type.view.list.column.id'|trans|desc('ID') }}</th> | ||
| <th class="ez-table__header-cell">{{ 'content_type.view.list.column.modification_date'|trans|desc('Modification date') }}</th> | ||
| <th class="ez-table__header-cell"></th> | ||
| <th class="ez-table__header-cell"></th> |
There was a problem hiding this comment.
Not sure if we need to add a new column
|
@inakijv no problem, I can adjust that. |
| <td class="ez-table__cell">{{ content_type.identifier }}</td> | ||
| <td class="ez-table__cell">{{ content_type.id }}</td> | ||
| <td class="ez-table__cell">{{ content_type.modificationDate|ez_full_datetime }}</td> | ||
| <td class="ez-table__cell ez-table__cell--has-action-btns text-right"> |
There was a problem hiding this comment.
Wouldn't be possible to have the new button within the same column? That way it would look more consitent with other tables in the app
| <a title="{{ 'content_type.action.copy'|trans|desc('Copy') }}" | ||
| href="{{ copy_url }}" | ||
| {% if class_name %}class="{{ class_name }}"{% endif %}> | ||
| <svg class="ez-icon ez-icon-copy"> |
There was a problem hiding this comment.
I would suggest to add also ez-icon--secondary, given that it is not a primary action. That way it would look more consistent with other tables in the app.
|
@inakijv @SylvainGuittard adjusted. |
| * | ||
| * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException | ||
| */ | ||
| public function copyAction(ContentTypeGroup $group, ContentType $contentType): Response |
There was a problem hiding this comment.
Hmmm I'm missing here CSRF protection....
There was a problem hiding this comment.
@adamwojs do you have an example of handling the CSRF in the ezplatform-admin-ui?
There was a problem hiding this comment.
I can create a simple form in controller to create and validate a CSRF.
There was a problem hiding this comment.
Yup, that's what we do too. You could also drop GET action in routing then.
|
@MarioBlazek Thanks for adjusting the design. 👍 |
|
@MarioBlazek we would like to include this feature in 3.2. Do you have time to finish it and address changes after code review? Rebase is needed as well. |
|
Sorry, the last few days I was in a rush. Will update this PR tomorrow, the latest. |
|
@MarioBlazek thank you, this is great contribution, we should use 3.2 window and release it. |
|
You don't need to fix design, we will take over, as we are in the middle of changing look & feel. |
2edd51e to
bdf3c59
Compare
|
@lserwatka @ViniTou PR updated. |
|
I removed the duplicated table cell. //cc @lserwatka The new design was already there. |
|
I have just realized that form handling is not working properly. There is already one form for bulk delete out there, so multiple copy forms are added inside it. What do you guys suggest? |
|
But were those forms are added? I can see there is only added the link to the copy route, and in fact, it doesn't work because it redirects to the content types list. |
52b3797 to
1bb5d16
Compare
|
@dew326 I have update the PR with forms. Everything should be ok now. Please review. |
| <td class="ez-table__cell">{{ content_type.id }}</td> | ||
| <td class="ez-table__cell">{{ content_type.modificationDate|ez_full_datetime }}</td> | ||
| <td class="ez-table__cell ez-table__cell--has-action-btns"> | ||
| <td class="ez-table__cell ez-table__cell--has-action-btns text-right"> |
There was a problem hiding this comment.
| <td class="ez-table__cell ez-table__cell--has-action-btns text-right"> |
|
What is the status here? We are 1 week away from 3.2-rc. If we won't merge it this week, we will need it push it back till December. |
5da1ca5 to
8f7a4e2
Compare
| ['%name%' => $contentType->getName()], | ||
| 'content_type' | ||
| ); | ||
| } catch (UnauthorizedException $exception) { |
There was a problem hiding this comment.
When this exception can occur? Is $this->denyAccessUnlessGranted(new Attribute('class', 'create')); not enough?
|
|
||
| ezplatform.content_type.copy: | ||
| path: /contenttypegroup/{contentTypeGroupId}/contenttype/{contentTypeId}/copy | ||
| methods: ['GET', 'POST'] |
There was a problem hiding this comment.
I would stick with POST only.
Nattfarinn
left a comment
There was a problem hiding this comment.
Hmm, user will end up with two Content Types with the very same name. Even if we prefix the name with "Copy" or something, the name will most likely be up to immediate change to something more meaningful. Wouldn't it be better to make it consistent with what we already have in ie. role Copy?
This way would avoid making JS changes to form action and other workarounds for "Form inside Form" issue as well.
|
@Nattfarinn we will address it after RC. |





This PR implements ContentType copy feature in the admin.
Checklist:
$ composer fix-cs)