Hi,

I hope that's the good place to post this.
I've change a little bit the activity_comment.js file to make a better use of JQuery effects.

My aim was to make the comment box appear in a slide when clicking on 'comments' and disappear the same way when clicking again.

Here is the simple code :

Drupal.behaviors.activityComments = function(context) {
  $('.activity-comments-click-to-show').toggle(
    function() {
      $(this).parent().siblings('.activity-comments-form-hidden').slideDown("fast");
    },
    function() {
      $(this).parent().siblings('.activity-comments-form-hidden').slideUp("fast");
    }
  );
};

I believe it's greater like this, what about you?

Comments

sirkitree’s picture

Status: Active » Postponed (maintainer needs more info)

Can you explain why this is any better? .slideToggle() does in one line what yours is doing in 6. Is it any faster performance-wise?

Pierre_G’s picture

Well, sorry about this, I didn't know about slideToggle.

This part of the original JS file :
toggleClass('activity-comments-form-shown');
could so be replaced by :
slideToggle("fast");

The point is that it's more beautiful with some slide than with a toggleClass, no?

jaydub’s picture

@Pierre_G actually the JS was changed in -dev already to use slideToggle but since you are looking at 6.1.1 you would not have seen that. There are a few more things to test out and/or add in before making a 6.1.2 release but for now you should feel confident in taking a look at a -dev snapshot for updated functionality.

jaydub’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
sirkitree’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

Oh, I'm sorry. You have this marked as version 6.x-1-1 and I was looking at what we have in 6.x-1.x-dev which is where we have the .slideToggle('fast') going on, and yes, it is much more beautiful. Take a look, I think it accomplishes the same effect you are talking about:

// $Id: activity_comments.js,v 1.1.2.2 2009/03/16 01:01:44 jaydub Exp $

/**
 * Drupal.jsEnabled is a generic wrapper for all Drupal JavaScript.
 */
Drupal.behaviors.activityComments = function(context) {
  $('.activity-comments-click-to-show', context).bind('click', function() {
    $(this).parent().siblings('.activity-comments-form-hidden').slideToggle('fast');
  });
};

Please try this out and let me know if it is giving you the desired result.

Pierre_G’s picture

Ok, that's perfect in the js file of 6.x-1.x-dev.

The only thing is that the js file is not included in my page !! So it doesn't work... (click on 'comment' = no effect)
Same issue in the activity page or in a block anywhere else.

Am I the only one with that issue or is it something normal in the dev snapshot ?

sirkitree’s picture

This is loaded in the theme function theme_activity() - so as long as you have the required permission: 'create activity comment' - the file should be loading.

sirkitree’s picture

Oh, duh. typo - that should be 'create activity comments' - with an s. fixed in CVS.

sirkitree’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.