Hello,
I found an old question on the same topic (https://answers.atlassian.com/questions/28999/is-it-possible-to-reverse-the-order-in-which-comments-appear) but the solution that was proposed there was for 3.5 and I don't seems to manage o have it work to work on Confluece 5.
Can someone suggest a way to make comments showing in the reverse order on the latest version?
Thanks for the help
Community moderators have prevented the ability to post new answers.
The answer is as given on the related question https://answers.atlassian.com/questions/28999/is-it-possible-to-reverse-the-order-in-which-comments-appear<br< a="">>
It works perfectly with :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<script> function reverseCommentOrder(){ if (AJS.$( 'meta[name=ajs-form-name]' ).attr( "content" ) != "editcommentform" ){ // Only reverse comments if you're not editing one of them $comments = AJS.$( '#page-comments' ); $comments.children().each( function (i,li){$comments.prepend(li)}); } } AJS.toInit( function (){ reverseCommentOrder(); AJS.$( '#comments-section-title' ).append( '<a id="page-comments-reverse" href="#">(Reverse Order)</a>' ); AJS.$( '#page-comments-reverse' ).css({ 'color' : '#999' , 'font-size' : '0.65em' }).click( function (e){ reverseCommentOrder(); e.preventDefault(); }); }); < /script > |
I figured out a way to add this feature as a user macro. See this related post:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
thanks for the nice script. We do not have HTML enabled, however, a user macro can also be used and inserted in the Navigation box of the Dcoumentation Theme. At least you have toggle sorting per space then.
I wrote the user macro with the above code but it throws an error "Error occurred rendering template content". I nailed it down to this line:
$comments.children().each(function(i,li){$comments.prepend(li)});
Everything else goes through, but the above line causes the macro to fail rendering. Any idea on how to make it work?
Best regards,
George
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI there,
Can I know is your confluence freshly installed?
When you put the suggested customization in your confluence, is that any specific error shows ?
Could you please check if your HTML macro enabled? It's disbaled by default for conflence 5.
https://confluence.atlassian.com/display/DOC/Enabling+the+html-include+Macro
Thank you.
Regards,
Wayne Wong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Wayne,
no it is not freshly installed, it runs since a few months.
I don't have a specific error, just the comments are not showing in the reverse order...
Html macro is active.
There are quiet a lot of "solutions" on the linked Answer. I gather that the "right" one should be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<script> function reverseCommentOrder(){ if (AJS.$( 'meta[name=ajs-form-name]' ).attr( "content" ) != "editcommentform" ){ // Only reverse comments if you're not editing one of them $comments = AJS.$( '#page-comments' ); $comments.children().each( function (i,li){$comments.prepend(li)}); } } AJS.toInit( function (){ reverseCommentOrder(); AJS.$( '#comments-section-title' ).append( '<a id="page-comments-reverse" href="#">(Reverse Order)</a>' ); AJS.$( '#page-comments-reverse' ).css({ 'color' : '#999' , 'font-size' : '0.65em' }).click( function (e){ reverseCommentOrder(); e.preventDefault(); }); }); < /script > Am I right?
|
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tested the above js code and it is working however there are some issues:
When the comments have been reverse ordered and you right another comment,the new comment which essentially should be at the top is at the bottom and you have to reload the page so that it is displayed up. @Consu did you experience the same?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Ian I'm having the same issue. May I know if you have already found out the way to get the new comments to be displayed on top without refreshing the page too?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI there,
Can I know is your confluence fresh installed?
When you put the suggested customization in your confluence, is that any specific error shows ?
Could you please check if your HTML macro enabled? It's disbaled by default for conflence 5.
https://confluence.atlassian.com/display/DOC/Enabling+the+html-include+Macro
Thank you.
Regards,
Wayne Wong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.