Expand my Community achievements bar.

SOLVED

Problem with default settings for comments component.

Avatar

Level 2

Hello, I have next problem:

I need to set some default settings for comments component and I tried to do it in next way - I added node with name "comments" under the jcr:content of template of me page. When I create page, this "comments" node appears in /conent/mypagename/jcr:content/ but comments component does not work. If I delete this "comments" node, then set the same settings via edit dialog, node with the same properties appears and component works!

 

Also, as I found here - help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__srsa-hi_i_raisedane.html , node with name comments will not be replicated during page activation, and as I see it, it's done to prevent problem that I got with my properties.

Can anyone suggest me the way, how I can set some default setting for comments component?

Thank you.

 

UPD: when I put me comments component into the parsys it's properties were successfuly replicated with page. But why it was not working without parsys?

Also I want to add, that I overlayed basic component with my own (there some rendering changes), when I change resourceType to default one - it works ok, but when I change back to mine, when I am trying to post new comment in developers console I see "Uncaught Error: success"  from the code:

CQ.soco.comments.attachToComposer = function(targetForm, appendTarget, templateName) { var success = function(data, status, jqxhr) { CQ.soco.filterHTMLFragment(data, function(node) { var newNode = node.appendTo(appendTarget); newNode.on(CQ.soco.comments.events.DELETE, CQ.soco.comments.removeHandler); newNode.on(CQ.soco.comments.events.ADDED, CQ.soco.comments.addHandler); }); targetForm.trigger(CQ.soco.comments.events.ADDED); targetForm.find("textarea").blur(); }; var failure = function(jqXHR, textStatus) { throw new Error(textStatus);  // HERE the error was thrown }; CQ.soco.commons.clientSideComposer(targetForm, templateName, success, failure, {}); };

 

Any ideas?

 
1 Accepted Solution

Avatar

Correct answer by
Level 10

Alukardo wrote...

 

Also I found that when you modify link to next - "http://localhost:4702/content/path/to/page/_jcr_content/comments-section-par/comments/comments.social.createcomment.html" it successfuly posts the comment. So what can be wrong there?

 

 

In initial post you mentioned added extra node comments  and hence you need to add while posting so that right script is picked up based on resource type.

View solution in original post

3 Replies

Avatar

Level 2

One more update: it looks like it save new comemnt into the comments node uder my page instead of /content/usergenerated. The link for POST request looks like -

"http://localhost:4702/content/path/to/page/_jcr_content/comments-section-par/comments.social.createc...". I checked the same link in geometrix-media - "http://localhost:4702/content/geometrixx-media/en/events/andrew-novokov/_jcr_content/article-content..." so they looks just the same, but component works in geometrix-media.

 

Also I found that when you modify link to next - "http://localhost:4702/content/path/to/page/_jcr_content/comments-section-par/comments/comments.social.createcomment.html" it successfuly posts the comment. So what can be wrong there?

 

Avatar

Level 2

One more update: it looks like it save new comemnt into the comments node uder my page instead of /content/usergenerated. The link for POST request looks like -

"http://localhost:4702/content/path/to/page/_jcr_content/comments-section-par/comments.social.createc...". I checked the same link in geometrix-media - "http://localhost:4702/content/geometrixx-media/en/events/andrew-novokov/_jcr_content/article-content..." so they looks just the same, but component works in geometrix-media.

 

Also I found that when you modify link to next - "http://localhost:4702/content/path/to/page/_jcr_content/comments-section-par/comments/comments.social.createcomment.html" it successfuly posts the comment. So what can be wrong there?

 

Avatar

Correct answer by
Level 10

Alukardo wrote...

 

Also I found that when you modify link to next - "http://localhost:4702/content/path/to/page/_jcr_content/comments-section-par/comments/comments.social.createcomment.html" it successfuly posts the comment. So what can be wrong there?

 

 

In initial post you mentioned added extra node comments  and hence you need to add while posting so that right script is picked up based on resource type.