Problem

After invoke command ctools_modal_form_wrapper() on ajax response, Drupal attaches js behaviors for the whole document, instead of modal dialog. This causes duplicetes of ajax events for all selectors that uses context variable.

Example

$('.my-button', context).click(function() {
  console.log('I am invoked');
});

When page is loaded, click on this button will log only one message. But after modal dialog was invoked, the same click event will write in console two debug messages. After one more ajax response with modal dialog we will see three messages in console, etc.

Proposed solution

Add correct context for Drupal.attachBehaviors after modal context was invoked. Patch is attached.

Files: 
CommentFileSizeAuthor
#1 ctools-modal-dialog-invokes-drupal-attachBehaviors-with-wrong-params-2001370-1.patch522 bytesSpleshka
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]
ctools-modal-dialog-invokes-drupal-attachBehaviors-with-wrong-params.patch519 bytesSpleshka
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

Comments

StatusFileSize
new522 bytes
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

Removed extra spaces.

Status:Needs review» Reviewed & tested by the community

Yup, looks pretty clear and straight forward fix to me.

Any progress here? Patch is almost obvious.

Still no progress? :(

Assigned:Unassigned» merlinofchaos

#1 looks good for me
let`s make it pushed

Issue summary:View changes
Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

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