I'd like to use the Ajax Comments form via a views field. I will create a Views 'AJAX add comment' field and will post a patch.

Comments

grasmash’s picture

Status: Active » Needs review
StatusFileSize
new6.4 KB

More specifically, this will add a new Views field with an 'add comment' link. When clicked, the link will be replaced with the Ajaxified comment form. After submitting, it will replace the form with a message.

A few ideas for improvement:
- Allow the message to be customized either via the ajax comment settings page or on the views field settings form.
- Create an additional field for loading the current comments into a views field. i.e., ajax 'view comments' link.

Let me know if you'd like an modifications.

Thanks.

grasmash’s picture

Issue summary: View changes

clarity

druplerjr’s picture

Would love to see the view comments link functionality added.

nikkubhai’s picture

Status: Needs review » Closed (duplicate)

Please check this issue: http://drupal.org/node/743040

grasmash’s picture

Status: Closed (duplicate) » Needs review

This may address the same issue, but it's a completely different approach than the one taken in #743040: Ajax comments and views. My patch does not modify the module's javascript.

Maybe it's worth comparing the patches and choosing a path forward for this feature?

drupalgarm’s picture

Heyho.

I tried to integrate your patch and it seems to be successful.
But I got a "broken/missing Handler"-Message when I added the "Add AJAX Comment"-Field.

An idea?

grasmash’s picture

I've actually made a number of changes on my local installation since posting this patch. So, I've rerolled the patch. Please try this one out, I'll help troubleshoot if there's an issue.

simon georges’s picture

@madmatter23, isn't Inline Ajax Comments what you want?

(Although, IMHO, merging both modules could be great, especially since Inline Ajax Comments doesn't seem to be maintained any more)

grasmash’s picture

@Simon Georges

I found Inline Ajax Comments to be a mess. I worked with it for a while, and eventually gave up.

It was much easier to implement the feature with this module.

simon georges’s picture

@madmatter Agreed (I think my team still has 4 or 5 patches in the issue queue), I look forward to have this working in a maintained module, good job!

gtn_john’s picture

@madmatter This is a very useful patch. I really like your idea to:

Create an additional field for loading the current comments into a views field. i.e., ajax 'view comments' link.

I'm running into an issue where I've applied custom CSS to the form elements (which I am displaying in a block view, underneath the actual comments), but upon clicking "save" the form simply reverts back to the original styling, plus I need to do a manual page refresh to show the new comment in the list and get the custom styling back. Would integrating your proposed additional comments field get around this issue? Perhaps some sort of auto reload of that particular view to refresh the CSS and update the comments list. If not in a forthcoming patch, is there another way around this issue?

Thanks for the great work!

drupalgarm’s picture

Heyho.

I want to try your last patch, but i can´t find the "ajax_comments.js".
Where I can get these file?

Using 7.x-1.0-alpha1.

cya

*edit*
ajax_comments.js is in the dev-version.
Should I use dev for patching? Or should I integrate only this file into alpha1?

drupalgarm’s picture

Ahoi.

I´ve tried to run the 6-patch with the dev-version: no success.
I´ve tried to run the 1-patch with dev and afterwards 6-patch: no success.

Error-msg for patching:

File to patch: ajax_comments_nodejs.info
patching file ajax_comments_nodejs.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file ajax_comments_nodejs.info.rej

other files was patched successfully.
----------------

Pls help me *g*

mvlabat’s picture

Try to apply this patch manually: just add a new line "files[] = views_handler_field_ajax_add_comment.inc" after "configure = admin/config/content/ajax_comments" into the .info file.

drupalgarm’s picture

Heyho.

I integrated two lines manually, first one in ajax_comments.info (look at #13) and second in ajax_comments_nodejs.info (delete one empty line as shown in .rej-file).

But I get a notice if I load comment-control-page (admin/content/comment).

Notice: Undefined property: stdClass::$comment_body in comment_admin_overview() (Zeile 107 von drupal\modules\comment\comment.admin.inc).

It works well, but I can´t see the created comment without loading the single node. I want to avoid this behavior ;)
Is there a solution planned?

But the "Add Comment"-Link works fine :)

cya

tostinni’s picture

@Garm try to patch it using git apply ajax_comments-views_integration-1711476-6.patch versus the traditionnal method patch -p1 < ajax_comments-views_integration-1711476-6.patch.
Using the former works for me while the latter display the error you mention.
This patch needs to be applied to the dev version.

@madmatter23 I created a patch (#1837468: [views integration] add a field to list all comments of a node) to display the list of comments. I look forward to receiving some feedback.

muschpusch’s picture

Could you please reroll the patch? I used the current dev but it doesn't apply...

$ git apply ajax_comments-views_integration-1711476-6.patch
error: patch failed: ajax_comments.info:3
error: ajax_comments.info: patch does not apply
error: ajax_comments.js: No such file or directory
error: patch failed: ajax_comments_nodejs/ajax_comments_nodejs.info:2
error: ajax_comments_nodejs/ajax_comments_nodejs.info: patch does not apply

muschpusch’s picture

aaah! no sorry the dev release isn't up to date. If you checkout by git (7.x) the patch applies! When downloading the release on the project page it doesn't. I think the master branch should be updated or even better deleted!

muschpusch’s picture

One more remark to get this working: you need to choose a content type at: admin/config/content/ajax_comments

Even though it says that:

Select node types you want to activate ajax comments on. If you select nothing, AJAX Comments will be enabled everywhere.

Not sure if it's related to this patch...

madmatter23++ this is nice!

muschpusch’s picture

Status: Needs review » Closed (fixed)

ok this is committed! Thanks madmatter23

muschpusch’s picture

Issue summary: View changes

again