The module does not handle a fallback for browsers that have disabled javascript. And I can see why. The module alters the URLs to refer to /ajax_comments/* from the normal /comment/*. And the page callbacks always deliver ajax responses.

Am I missing something? If not, then I see two ways to go.

First, I think the module could implement the standard ajax/nojs convention in the url path, e.g. /ajax_comments/nojs/reply/*/* And the module could handle the nojs path by redirecting to the standard comment module url, e.g. /comment/reply/*/*

The second way is to change the generated html to use the standard href urls, but have the javascript handle changing the URLs to /ajax_comments/blah. I've tried this and it works!

I'm willing to do the work to make a patch to fix this if we can agree on the problem and best approach to fix it.

Thanks,
Mike Gering

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

muschpusch’s picture

First, I think the module could implement the standard ajax/nojs convention in the url path, e.g. /ajax_comments/nojs/reply/*/* And the module could handle the nojs path by redirecting to the standard comment module url, e.g. /comment/reply/*/*

For me this seems to be the way to go. I took over maintainership of the module and this was on my todo list. It would be great if you could provide a patch. I would review and commit it.

mfgering’s picture

FileSize
12.8 KB

I agree this is the best approach. I created a patch and have done some testing. Please review.

muschpusch’s picture

Status: Active » Needs work

wow that was quick! I'm sorry but your patch doesn't apply anymore. :/ I pushed lot's of changes this morning and i think you downloaded the current development release or not? Please fetch from git: Drupal infrastructure only builds releases once or twice a day...

https://drupal.org/project/ajax_comments/git-instructions

mfgering’s picture

FileSize
12.31 KB

I cloned the git repo and merged my code into it. Please see the patch file for details.

thebruce’s picture

Issue summary: View changes
FileSize
14.33 KB

I re-rolled this patch against the current dev branch to address any differences as well as the removing the delivery callback from #4 for the comment edit menu callback (probably snuck in during the merge resolutions).

I couldn't find where the now 4th and 5th args for the menu item for reply are set. They don't seem to be set anywhere in the .module code. I had consistent issues with the menu router failing as a result - since they have defaults of (NULL and 'node') and they work as optional items for the menu item and there were no failures I pulled them per the original patch.

muschpusch’s picture

Thanks a lot! This looks good! Could somebody test this please then i will commit it asap....

muschpusch’s picture

Status: Needs work » Needs review
SocialNicheGuru’s picture

deleted: wrong queue.

SocialNicheGuru’s picture

after looking at the other patch I found that this line in ajax_comments/views might have to be altered also:

views/ajax_comments_handler_field_ajax_add_comment.inc:50:      $path = 'ajax_comments/reply/' . $node->nid."/NULL/views";

Edit 6/26/14:
the line should be:

views/ajax_comments_handler_field_ajax_add_comment.inc:50:      $path = 'ajax_comments/nojs/reply/' . $node->nid;
thebruce’s picture

SocialNicheGuru - hmm, it looks like that it is already pointed to the correct menu router - ln 66 of ajax_comments.module, am I missing something? Happy to address whatever helps the nojs fallback here, I think I just am not following.

In other news, muschpusch - we've been running this without issue, but it would be good to have another eye on it.

SocialNicheGuru’s picture

@theBruce, it was suggested that adding to your solution might fix this issue: https://drupal.org/node/2266673

muschpusch’s picture

@thebruce it seems like the views plugin is still referencing the old handler. Could you please add that to the patch? Then i'm happy to commit it and create a new release

muschpusch’s picture

Status: Needs review » Needs work
SocialNicheGuru’s picture

The fix gets the comment form to show up in a view
but I get the following error with linkit which is used with wysiwyg as part of panopoly distribution:

TypeError: Drupal.linkit is undefined
Drupal.linkit.dialog = Drupal.linkit.dialog || {};

/modules/contrib/linkit/js/linkit.dialog.js?v=7.2&_=1404796095185

also none of the wysiwyg editor paths are included so I get a 404 error for every plugin to the wysiwyg editor.

SocialNicheGuru’s picture

this no longer applies to beta1

formatC'vt’s picture

i think we still need this

kporras07’s picture

Re-rolled patch against last dev version.

kporras07’s picture

Status: Needs work » Needs review
formatC'vt’s picture

You also replace same code in dev version.
For example $commands[] = ajax_command_prepend('.comment-wrapper-' . $pid . ' + .indented', $form) by $commands[] = ajax_command_before('.comment-wrapper-nid-' . $node->nid . '> .ajax-comment-wrapper:first', $form).
Why you did this?

formatC'vt’s picture

Status: Needs review » Needs work
formatC'vt’s picture

Assigned: Unassigned » formatC'vt

I see a easy solution - use own javascript code for binding Ajax behaviors.
I'm working on this

  • formatC'vt committed 4bc9480 on 7.x-1.x
    Issue #2108557 by formatC'vt: Support for no-javascript fallback
    
formatC'vt’s picture

Status: Needs work » Fixed

wow, this solution are described in this issue as second way =)
Implemented and committed to latest dev. Important: clear cache after upgrade (menu links are changed to drupal core comment module style)

formatC'vt’s picture

committed to 7.x-1.2

Status: Fixed » Closed (fixed)

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