How can I override the javascript or whatever who toggle the comment to be open by default in the stream. I would like to have all the comments close by default and let the users click on more comment by themself.

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

muschpusch’s picture

I did that in a bad way but it works:

    /**
     * Toggle the comment box and hide comment element                                                                                                                                     
     */
    $('.heartbeat-comments-nocomments .heartbeat-attachment-button a').click();
    $('.heartbeat-comments-nocomments').parents('.og_test').find('.heartbeat-attachment-button a').click();
    $('.heartbeat-comments-nocomments').parents('.og_test').children('.heartbeat-attachment-button').hide();            
sw3b’s picture

OK thanks i will take a look this week...

7wonders’s picture

Where would I put the code above to get the comments closed by default?

7wonders’s picture

Status: Active » Needs review
FileSize
2.48 KB

The attached patch adds an option to the comments plugin page to hide or show comments by default (they can still be opened by clicking the number of comments). I stayed away from the js and made the changes in activitycomments.inc. Please review.

Stalski’s picture

There are two problems with this patch:
- you skip the feature where commented activity starts open and others closed
- the patch has redundant code in the else. the result is "none" in the ternary operator

7wonders’s picture

@Stalski - my apologies, its my first patch ever (yes, sad but true). Can you explain what you mean with the first of the problems and give me some pointers on fixing it as the patch works exactly as intended for me = all comments are closed until the comment count is clicked. I see what you mean with the second problem, that was a bit of a brain fart.

7wonders’s picture

Here is the updated version removing the brain fart but you will have to explain the first problem for me.

Stalski’s picture

Status: Needs review » Closed (fixed)

Problems are gone. Fixed and pushed to git.

sw3b’s picture

Great work ! Thanks !