-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Render comments outside of resource show #3327
Comments
I think this should work: ActiveAdmin::Comments::Views::Comments.active_admin_comments_for(@your_resource) |
I tried that in both view, and controller methods, and got an |
Arbre components can only be rendered within an Arbre context. The blocks for # custom_action.html.arb
active_admin_comments_for(resource) A second method is to create an <h2>Custom Action ERB</h2>
<%=
Arbre::Context.new({}, self) do
active_admin_comments_for(resource)
end
%> This method works for all Arbre components provided by ActiveAdmin. See |
Thanks @zorab47, that was able to solve my issue 👍 |
Thank you very much for this hint! I've tried to use this advice and finally comments are shown just once on the page, but at the same time comments addition form is missing. Could you advice me, how to fix this? |
@BRZInc I assume you try to add the comments form to the edit view. That will not work since you cant put a form into a form. The edit view looks like this with (not working) the comments form:
You will see the comments and the form but not the comments form will be submitted but the whole resource form. If you just want to see the comments, you can recreate the comments by yourself without creating a form:
You could also take the result from EDIT: see the next two comments ... |
@andywenk I think don't need the |
@timoschilling yup you are right - that was still the code when I debugged the values without creating any HTML. Updated my comment. Thanks! |
I can't seem to find a way to render the ActiveAdmin comments outside of the
show
action. Is this even possible?I've tried calling the
active_admin_comments
method directly onActiveAdmin::Comments::ShowPageHelper
, but can't seem to get it to work.What I'm trying to do is render the comments in the view from a
member_action
method. Is there perhaps a better way to do this?The text was updated successfully, but these errors were encountered: