I'm not sure if this is a bug, but it looks like it.
Go to http://79.170.40.231/thedocsmanchester.co.uk/?q=node/272 . You should get three groups of collapsed embedded links. If things are working as they should, you can expand and collapse the groups as normal.
Now navigate away from the page to another page on the site. Return to the original page (choose 'Sexual Health' in the left sidebar). If you are seeing what I'm seeing, the groups are no longer expandable. This remains true for any other pages with embedded links.
However, if you go to the main links page:
http://79.170.40.231/thedocsmanchester.co.uk/?q=weblinks the groups are still expandable.
Is this an issue with my theme or a conflicting module? Or is the link-embed contrib not loading the JS correctly?
Site caching is currently disabled if that's any help.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 618192_14.embedded_link_fieldset_use_drupal_add_library.patch | 631 bytes | jonathan1055 |
| #7 | 618192_7.embedded_link_fieldset_wont_expand.patch | 516 bytes | jonathan1055 |
| #5 | javascript files added.txt | 6.34 KB | jonathan1055 |
Comments
Comment #1
jamesbisset commentedUpdate: I've downgraded to 6.x-2.3, disabled all except core modules (plus Devel) and switched to Garland: still the same result.
The source code for a collapsed fieldset look like this:
If the JS has done its job this is rewritten as:
What's happening is that if I revisit a page with an embedded link, the
<a href="#">My links</a>doesn't get written, thus disabling the expandability. Using Devel to clear the cache restores the functionality until I navigate away and then come back to the page.However, the collapsed fieldsets on the weblinks main links page always remain expandable. I can see the fieldsets load and then the group titles get activated as links - the wee arrows appear last.
Any tips on how I can pin down what's happening here? I notice that links-embed requires Menu. Any way of troubleshooting that relationship?
Comment #2
jonathan1055 commentedI've tested this in Drupal6 and the collapsing/expanding works correctly in general, and as it has been nearly six since this issue was raised I was going to close it as 'cannot reproduce'.
However, on testing in Drupal7 the jquery does not activate and the fieldset legend does not become a clickable links. Which means that the fieldsets are currently collapsed with no way to expand them. It might be due to how D7 treats javascript files but it seems that we need to explicitly add:
at the top of weblinks_embed.module, then it works OK. I'll make a patch for this.
I have also discovered that the filter settings in weblinks_embed_filter_info and weblinks_embed_settings have not been coverted correctly from the D6 code, so the values cannot be saved or acted on. That is a new issue which I will raise separately.
Comment #3
GStegemann commentedI tested embedded link groups but it works on my test site. The fieldset legends are clickable any time the page is displayed or revisited. How did you test embedded links?
I will wait for your issue.
Comment #4
jonathan1055 commentedI just created a new page and added the syntax for embedding a group. When the legend was not clickable I checked the console log in Firefox to try to see what files and javascript was active. That's when I found out that collapse.js was not loaded. However, it does get loaded on the main Web Links page and we do not explicitly include those files. Maybe because the page includes a form then they are automatically added. My test page had no form (even though we add the fieldset) so maybe that was the difference. I will try to replicate it with a clean minimal D7 install.
Comment #5
jonathan1055 commentedI've just replicated the problem, would be good to see if you can too:
Now, depending on the 'collapse' setting of the group, the fieldset will either be shown expanded or not, but in both cases the legend is not converted to a clickable link because collapse.js is not added to the page. I have uploaded a text file showing the javascript files added on that page. Compare this with the files added on the main Web Links page which include form.js and collapse.js
Comment #6
GStegemann commentedI can replicate the problem as well. I have a second test site which shows exactly the same behaviour as you described in #5.
So in fact Web Links Embed needs to be fixed.
Comment #7
jonathan1055 commentedHere's a patch which fixes the problem. I am not sure how these files get added on our main weblinks page without our module code explicitly doing these lines. I tried adding a form around the test embed page from #5 and that does not trigger the files. It would be nice to fully understand this, because it may have implications on the rest of the module. However, that should not stop us fixing the problem in embed here. I've mentioned this issue in the fix, so that in future we can track back to why the lines were added.
Comment #8
GStegemann commentedThanks. I have tested it and it works.
Maybe by Views.
Yes. But I have no idea yet.
Comment #10
jonathan1055 commentedThanks for the testing. Setting this to fixed as D6 works OK.
The new issue for the settings is #2564473: Weblinks-embed filter settings cannot be saved
Comment #12
jonathan1055 commentedFrom #7:
I found the answer:
Do you think we should change the fix committed above, and do it the same as this for both module? It looks like 'drupal.collapse' adds the same two .js files, but it might be more future-proof to call this rather than add the two files directly from our code.
Comment #13
GStegemann commentedEven not knowning all the details about Javascript support by Drupal core I would say yes.
Comment #14
jonathan1055 commentedYes, it seems the more proper drupal way to do it. Here's a patch, testing worked fine on my local site, but always worth checking on D.O. aswell.
Comment #16
jonathan1055 commentedGood to see 394 passes.
Comment #17
GStegemann commentedTested and still works.