With the Navigation anchors, you can use the following: www.example.com/type#type-page-1

This works well; however, the problem is if you add more content that is sorted above this item, your #[content-type]-page-1 will link to a different expanded field than you intended.

I would love to see a way to use www.example.com/type#type-node-380 as another way of doing an anchor. This way it is linked to the actual node you want expanded in the view, rather than the position of the node that is to be expanded.

Thanks.

CommentFileSizeAuthor
#17 deep-linking-anchors-1127224-6-rel7.x-1.0.patch2.91 KBAnonymous (not verified)
#6 deep-linking-anchors-1127224-6.patch2.63 KBjantoine
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Manuel Garcia’s picture

First, this would be extremely complicated to implement, as views can list any entity type, and you'd have to pass this to the JS and have it do a lot of work on this. Not desireable just for that case... at least in my opinion.

The only way to do this would be to rework how the anchors are built, and do it outside of js. Also a lot of work, and we'd be entering very muddy watters, stepping into how views normaly renders itself. This means a lot of potential for bugs, and much more code to maintain, just for this case.

So I'm setting this to won't fix, this module focuses on integrating views with jquery ui accordion, let's keep it clean and fast.

Jej’s picture

Status: Active » Closed (won't fix)

Hi,

I agree with Ryan. This feature is quite unusable as the row id can change anytime depending on the accordion content. It should rely on a drupal indexing (ex. node id) rather than a simple row count.

J.

jantoine’s picture

I also agree that anchors are not very useful when they can change as the view is populated with more content. With everything moving towards entities, I think one approach could be to use "#type-id" of the entity as the anchor text.

Manuel Garcia’s picture

I'd be willing to consider this feature if someone comes up with a reasonable patch that addresses the concerns I mention in #1.

jantoine’s picture

Assigned: Unassigned » jantoine
Status: Closed (won't fix) » Active

I just got 8 hours to work on this project and will be tackling it Monday morning.

jantoine’s picture

Assigned: jantoine » Unassigned
Status: Active » Needs review
FileSize
2.63 KB

The attached patched creates a unique anchor for every result of a view in the form of "view_machine_name-view_display_name-result_entity_type-results_entity_id". It has been tested with users, nodes and terms. It has been tested with paged output, although this doesn't make sense for deep linking as the "page" URL parameter could change.

An unsupported case was found with views that do not include any fields from the base table in the query. In this case we default to the current functionality. If deep linking is enabled an error message is displayed alerting the user to the issue and how to fix it.

ibot’s picture

Thank you for this patch, i was about to lose some teeth about the accordion-linking
- it is working fine here!

GHaddon’s picture

Thanks, this was exactly what i needed, i would also recommend adding and id with the same value after the hash so the browser will scroll down in the same way the anchor attribute works.

We managed to get this functionality by adding a rewrite in the nid field of the view
<div id="services-page-node-[nid]">[title]</div>.

Which works in the same way but it would be nice if this was default functionality.

It would be great if this patch could be committed as future updates will now mean having to reapply the patch every time we have to update.

Dustin Bons’s picture

Great patch. Could we integrate a view setting to select a field to use as anchor?

kirkofalltrades’s picture

I just wanted to throw this out there. I've implemented patch from #6 and field rewrite from #8. Works great! However, in IE7 it fails to expand the specified header. I installed the latest version (7.x-1.0-rc2) and the latest version of Views and reapplied the patch and same result; all looks well but IE7 doesn't work properly.

Not a huge deal, I've styled it so all is expanded for IE7. Just wanting to confirm if others see this behavior and can come up with a reason why, perhaps.

Thanks,
Kirk

JordanMagnuson’s picture

Status: Needs review » Reviewed & tested by the community

Great patch. Just applied it against 7.x-1.x-rc2.

Would be great to get this rolled into the latest release.

jackhutton’s picture

This turned into a hassle for me;

The views accordion leaves off the closing tag in Internet explorer 8 & 7; took me a while to figure that out ;
your post above gave me the idea to cut bait. expand them all for ie 7&8 w a custom ie style sheet.

thanks put me on the right path to get it done.

ippy’s picture

Issue summary: View changes

Hi

Thanks to everyone who contributed on this issue. We benefited from your sharing - using the patch in #6 plus GHaddon's suggestion in #8, plus a bit of jquery in the footer to make the "click".

So we added a little blog post/recipe to help anyone else faced with this problem.
It can be read here: http://netuxo.co.uk/blog/ippy-gray/linking-specific-views-accordion-rows...

Ippy

mastoll’s picture

Superb work, @ippy and all contributors.

@ippy, where can I ask you about your theming of the Views Accordion on http://tescopoly.org/faq?

Manuel Garcia’s picture

Status: Reviewed & tested by the community » Needs work

Navigation and navigationFilter options have been removed from jquery.ui.accordion 1.10, in favour of active, which as a setter only takes a integrer as argument, to open a certain accordion row.

So this means that even if we get this working properly, it will not work with newer versions of the plugin.

I'm setting the status to Needs work to leave the door opened for someone that knows the proper way of working with the (current) plugin (if at all possible), but I doubt this will get in.... sorry!

seanenroute’s picture

@mastoll one of the best stylesheet for cleaning up the accordion page (and other jquery items) comes from the Seven administrative theme.

Check out jquery.ui.theme.css in the seven theme that comes with Drupal 7.

Anonymous’s picture

Patch at https://drupal.org/node/1127224#comment-5919394 does not apply to release 7.x-1.0

Updated patch attached.

JordanMagnuson’s picture

Here's a post discussing linking to a specific accordion link using 'active': http://stackoverflow.com/questions/588030/link-to-open-jquery-accordion

It seems like something like that could be adopted to work with this module.

ippy’s picture

For anyone arriving here long after the last comments were made...

The patch (updated 11 months ago and posted at #comment-8848837 by Andreas) will also just about apply to the latest Views Accordion (7.x-1.1) - though its a few lines adrift it will succeed. Also, the recipe at http://netuxo.co.uk/blog/ippy-gray/linking-specific-views-accordion-rows... has been updated with a brief postscript inc a link to a live implementation

laryn’s picture

In case it's helpful, this same issue was opened in the Backdrop version's queue, and a PR submitted which is largely based on the patch here, I understand. It's working and committed there, functioning with jQuery UI 1.12.x.

https://github.com/backdrop-contrib/views_accordion/issues/2

Manuel Garcia’s picture

Thanks for the heads up @laryn - its been a while since I looked at this issue, but my guess is that the concerns I raised on #15 probably still stand.

That said, I'd be willing to have another look if someone ported the patch here - Not sure if people are still interested, but could be.

crutch’s picture

I worked on this issue for quite a while today and found a working solution for my case posted here.