It would be nice to be able to choose a Page Layout of "Clicking on question opens/hides answer under question" and have the FAQ module give each question an anchor link as it does when "Clicking on question takes user to answer further down the page" is chosen. This would allow FAQ items to be directly linked to. The current faq.js already is already setup to detect the URL fragment and expand the referenced answer.

We've modified includes/faq.hide_answer.inc to support this, however the anchors generated are just "n" followed by the FAQ node's NID. This could possibly be adjusted to use the same anchor naming system which is used elsewhere - for my purposes NIDs were unique enough.

Please consider the attached patch which implements this feature.

CommentFileSizeAuthor
#1 anchor-everywhere-1023468-1.patch1.49 KBjcisio
faq.patch528 bytesmsielski

Comments

jcisio’s picture

StatusFileSize
new1.49 KB

+1 for this feature. Tested without any problem.

I also add more thing into faq.js so that the URL fragment changes when an answer is open. It makes an answer bookmarkable. Tested with IE 8/Fx 3.5/Safari 5 (Windows) and Fx 4/Chrome 11 (Linux).

jcisio’s picture

Version: 6.x-1.12 » 6.x-1.x-dev
Status: Active » Needs review
stella’s picture

Status: Needs review » Fixed

Your patch wasn't quite extensive enough - only dealt with one possible layout and none of the categorized layouts. Though it looks like the anchors were already added to the dev version as part of #829368: Link directly to faq questions on the faq page when linking to question nodes is disabled in any case.

However the js change wasn't present and is quite useful, so have added that to the D6 and D7 branches, thanks!

Thanks for the patches!

jcisio’s picture

I saw that #829368: Link directly to faq questions on the faq page when linking to question nodes is disabled is marked "won't fix" and there is nothing else since Nov 2010. I was quite surprise because my patch in May was against the latest git. In fact there is a commit http://drupalcode.org/project/faq.git/commit/fe0753dacc53a8d79d83f94b3af... for that issue.

Anyway, it's great that this issue is fixed ;)

stella’s picture

Yep, that commit was for categorized layouts, which neither issue actually provided a patch for :(

Status: Fixed » Closed (fixed)

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