-
Notifications
You must be signed in to change notification settings - Fork 56
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
As an Editor, I want to be able to copy the content type in admin interface #1449
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 👍 |
@@ -55,6 +55,7 @@ | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to add a new column
@inakijv no problem, I can adjust that. |
@@ -83,6 +84,11 @@ | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
href="{{ copy_url }}" | ||
{% if class_name %}class="{{ class_name }}"{% endif %}> | ||
<svg class="ez-icon ez-icon-copy"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
src/bundle/Resources/views/themes/admin/content_type/macros.html.twig
Outdated
Show resolved
Hide resolved
* | ||
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException | ||
*/ | ||
public function copyAction(ContentTypeGroup $group, ContentType $contentType): Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I'm missing here CSRF protection....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamwojs do you have an example of handling the CSRF in the ezplatform-admin-ui?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can create a simple form in controller to create and validate a CSRF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -86,6 +86,10 @@ | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this exception can occur? Is $this->denyAccessUnlessGranted(new Attribute('class', 'create'));
not enough?
@@ -346,6 +346,16 @@ ezplatform.content_type.edit: | |||
requirements: | |||
contentTypeGroupId: \d+ | |||
|
|||
ezplatform.content_type.copy: | |||
path: /contenttypegroup/{contentTypeGroupId}/contenttype/{contentTypeId}/copy | |||
methods: ['GET', 'POST'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would stick with POST only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 besides @ViniTou comments 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
)