Closed guillecro closed 6 years ago
I failed.
Naaaa jk. Ok so the problem with this idea of redirecting the admin to create a reaction instance, won't be possible. According to the admin-on-rest documentation for the redirect
prop for
Possible values are “edit”, “show”, “list”, and false to disable redirection.
Which, are CRUD verbs.. and according to the documentation on
allows you to define a component for each CRUD operation, using the following prop names: - list - create - edit - show - remove
So.. looks like i cannot leave from those options. I will think in a workaround. One way is to redirect the user to the Show component of the Post and add a field that if there is no reaction instance for the post, show a notification asking if the user is interested to do it.
Another possibility is to just add the field in the Content creation form.
I am tagging @florlafuente @luarar @franciclo cause why not c;
Oops! i'm thinking in a custom action button at the end of the post form. Any other opinion?
Psst. The redirect
prop accepts a path inside admin-on-rest.
So thats cool!
The strategy is:
/reaction-instance/create?fromCreation=true
<Create>
component has a "custom field" that checks if the query has a param called fromCreation
After creating a Post, ask if the user wants to create a Reaction Instance. If the users agrees, show the reaction rules available for the post (show only those reactions that fits with the settings of the post). Let the user choose if he wants to create a new reaction rule for the post.