-
Notifications
You must be signed in to change notification settings - Fork 51
Unpublish UI #1892
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
Unpublish UI #1892
Conversation
|
I built a docker on this branch, and if I log in and then try to add any content type I get: The website encountered an unexpected error. Try again later. Drupal\Core\Entity\EntityMalformedException: The "tripal_entity" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of core/lib/Drupal/Core/Entity/EntityBase.php). |
tripal/src/Form/TripalEntityForm.php
Outdated
| */ | ||
| protected function actions(array $form, FormStateInterface $form_state) { | ||
| $actions = parent::actions($form, $form_state); | ||
| $route_info = $this->entity->toUrl('unpublish-form'); |
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.
This line (68) is what is generating the error - apparently at this point $this->entity->id() is NULL.
So if I wrap the remainder of this function in
if ($this->entity->id()) {
$route_info = ...
...
}
then I can add content. But I don't understand enough to know if this is something that would be correct to add
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.
Thanks @dsenalik for hitting on this problem! When I overwrote the actions() function I failed to include a check if the entity was new (similar to the parent function that adds the "edit" and "delete" actions). I've updated the code and tested a brand new installation and it's working now. Please feel free to try again.
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.
Testing with the latest changes works as expected.
I have a request, though. Save is right next to unpublish and delete.
In Tripal 3 we had the "dangerous" buttons on the far right side.
I request similar placement. And do we want similarly "Update" and "Cancel" when editing?
Tripal 3 button placement was discussed in PR #1061
|
Thanks @dsenalik for the review. Regarding the button floating on the right like it did in Tripal 3. Something like this is required in the form element: I specifially decided not to do that because it requires a hard coding of a style that floats the button on the right. In Tripal 3 we did some forcing of style which didn't always play nice with different themes. It should be easy enough to do, I was trying to avoid forcing any style. |
|
As an idea, what if we just add a "Cancel" button, and have it between the "Save" and "Unpublish" buttons, It can act as a less-harmful buffer, and then you don't have to mess with placement and messing with themes. But just an idea. |
… the save and the unupblish
|
@dsenalik I think a Cancel button is reasonable. I added one. The 'Cancel' won't show up in the dropdown actions, it's only on the form. |
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.
Awesome!
Verified that the cancel button works as expected.
|
It agree that it would be best floated to the right but also that there is definitely a balance with the overriding theme 🙈 With both in mind, I like this solution (the cancel button to provide some buffer) :-) |
Tripal 4 Core Dev Task
Issue #1350
Tripal Version: 4.x
Description
In order to implement the
ChadoStorage::deleteValues()function we need to differentiate between an "unpublish" and "delete". This PR simply adds that functionality to the UI. It doesn't' fully implement a delete. or thedeleteValues()function. I separted this as a separte PR to simplify the number of files that have to be checked in a full PR for this issue.Testing?