Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Extending Comments Component (Issue with customizing comments.hbs)

Avatar

Community Advisor

Hello All,

I have been able to use the extended comments component based on Extend Comments Component. The changes I made locally was to rename it to 'my_comments' instead of 'comments' and replace it in referenced paths. Also I updated the 'slingResourceSuperType' to "social/commons/components/hbs/comments" instead of "social/commons/components/comments" because it wasn't displaying the component at all.

Once I extended it and being able to make comments, I tried next to edit some basic behaviors like for example in my 'comments.hbs' I tried to add a text "custom" before the main div. It should display it but I donot see the change. It seems nothing I change in the extended component's hbs is picked up.

To actually see any change I tried to overlay the comments component and then I was able to edit my overlayed component and see the changes. If someone has tried the sample zip for extending the comments component is the behavior common?

 

Thanks...

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Thanks JK,

I apologize for confusion regarding slingResourceSuperType. I see I have same custom package that you have mentioned. Not sure how I eneded up there but probably was after trying different things. The property is set fine now. 

I tried using the custom component from fresh and see that I can see the text (say 'test') in my comments component display. But as I mentioned in initial post the changes I made locally i.e. Renamed the custom component path from "/apps/custom/components/comments" to "/apps/custom/components/my_comments" and updated the references in comments.hbs and comment.hbs. (While writing this I realized it should be my_comments.hbs instead of comments.hbs) Sorry for not realizing that earlier. The package is all good it was just me making changes to fit as per my requirement.

However I am looking to make more customizations like some front end changes, so I will try to add here hoping thats fine. I remember trying to add toolbar.hbs under my "/apps/custom/components/my_comments/comment" but didn't proceed much, will continue on that..(The purpose was hiding the edit button I think coz the edit button is shown for all users including non-admins and non-moderators. Have put another post regarding that)

Thanks a lot for quick response, I was encouraged to look deeper in the issue and find the cause..

View solution in original post

3 Replies

Avatar

Level 9

Hi,

I downloaded the same sample code, and the sling:ResourceSuperType was already set to "social/commons/components/hbs/comments", so I'm unsure what sample package it is you have.  Was it named "sample-comment-extension-6-1-fp3.zip" (it's not been modified for 6.2, and I don't think it needs to be).

Have you tried following the tutorial in order to create the extension instead of using the sample package?  There are some edits necessary for the hbs scripts as well.  These scripts may have changed from 6.1 FP3 to the most recent 6.1 FP6 / 6.2 FP2.  It would be more appropriate to use the comments.hbs/comment.hbs script from your release.

- JK

Avatar

Correct answer by
Community Advisor

Thanks JK,

I apologize for confusion regarding slingResourceSuperType. I see I have same custom package that you have mentioned. Not sure how I eneded up there but probably was after trying different things. The property is set fine now. 

I tried using the custom component from fresh and see that I can see the text (say 'test') in my comments component display. But as I mentioned in initial post the changes I made locally i.e. Renamed the custom component path from "/apps/custom/components/comments" to "/apps/custom/components/my_comments" and updated the references in comments.hbs and comment.hbs. (While writing this I realized it should be my_comments.hbs instead of comments.hbs) Sorry for not realizing that earlier. The package is all good it was just me making changes to fit as per my requirement.

However I am looking to make more customizations like some front end changes, so I will try to add here hoping thats fine. I remember trying to add toolbar.hbs under my "/apps/custom/components/my_comments/comment" but didn't proceed much, will continue on that..(The purpose was hiding the edit button I think coz the edit button is shown for all users including non-admins and non-moderators. Have put another post regarding that)

Thanks a lot for quick response, I was encouraged to look deeper in the issue and find the cause..

Avatar

Level 9

Hi Shubham,

No worries.  I do know understand how confusing it can be at first.

We really appreciate your thoughtful questions and the effort you put into learning.

It is more helpful to the community, I think, if you mark one of these answers as correct and create a new question for your next issue.  Otherwise, this becomes long and the new questions are less visible.  A more specific title is also helpful.

- JK