I am using javascript to add default text to the heartbeat comment form text area (i.e. "Add a comment"). It would be nice if it was added again after the form is submitted. Adding:
Drupal.attachBehaviors('.heartbeat-comments');
at the end of Drupal.heartbeat.comments.submitted in heartbeat_comments.js would allow this to happen along with any other js that gets applied to the comments section.
Drupal.heartbeat.comments.submitted = function(data) {
if (data.id != undefined) {
if (!$('#heartbeat-comments-list-' + data.id).length) {
if (Drupal.settings.heartbeat_comments_position == 'up') {
$('#heartbeat-comments-wrapper-' + data.id).append(data.data);
}
else {
$('#heartbeat-comments-wrapper-' + data.id).prepend(data.data);
}
}
else {
if (Drupal.settings.heartbeat_comments_order == 'oldest_on_top') {
$('#heartbeat-comments-list-' + data.id).append(data.data);
}
else {
$('#heartbeat-comments-list-' + data.id).prepend(data.data);
}
$('#heartbeat-comments-list-' + data.id).parents('.heartbeat-comments').find('.heartbeat-message-comment').val('');
}
Drupal.heartbeat.doneWaiting();
Drupal.heartbeat.comments.button.removeAttr("disabled");
Drupal.attachBehaviors('.heartbeat-comments');
}
}
Small change but I can roll a patch if that makes it easier.
Comments
Comment #1
aether commentedOoops. Form was submitting multiple times. Unbinding the submit button prior to attaching behaviors seems to fix this.
Comment #2
Stalski commentedWell, I think it's too late in the process now to change such a big thing.
first of all, it would mean a new PHP configuration so that is disabled by default so it does not change any production sites.
Second this is something that I notices of the years now, that is very custom how every UI expert sees these things.
As it is really easy to pick in at behavior time in a custom module, I won't do this in heartbeat itself for d6. For drupal7 there is already been chosen a different (facebook) approach.