Right now all links that start with '/' are handled by RefreshLess. While this usually probably fine some modules may want exclude certain links from this behavior.

I am creating a new module Config QuickEdit. That will load certain configuration forms on the front. It depends on Refreshless to reload the page after configuration has been saved(thanks for that!). But I want the links to load the configuration to be exclude from Refreshless because I doing my own ajax.

Here is a patch that simply excludes links that have the class "refreshless-exclude" by changing the relativeLinksSelector variable.

BTW here is screen capture of the configuration changing and then being reloaded by Refreshless. This has the patch applied.

Thanks for this great module!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow created an issue. See original summary.

Wim Leers’s picture

Glad to see it being used already :)

+1 for this principle, not sure about the exact naming yet. I'll add this once I've addressed more pressing concerns.

Wim Leers’s picture

FileSize
483 bytes

Rerolled against HEAD, where another selector was added to support fragment links.

Wim Leers’s picture

FileSize
509 bytes

Oops, rerolled wrong, lol. Apparently I still don't know the difference between cut and copy :P

Wim Leers’s picture

FileSize
1.18 KB

With that done, I started actually looking at the patch.

Two observations:

  1. My changes don't make sense, because that additional selector for fragment navigation doesn't make sense to let the browser handle: that won't trigger a full reload anyway.
  2. I think a data- attribute would be more appropriate: data-refreshless-exclude.

Patch attached. Includes documentation.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Rather than waiting for feedback, I'm going to commit this. This module is still in alpha stage anyway, so if it turns out changes are needed, API breaks are not a problem.

Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

  • Wim Leers committed b9be9a8 on 8.x-1.x authored by tedbow
    Issue #2699497 by tedbow, Wim Leers: Allow modules to exclude links from...
tedbow’s picture

Thanks for making this change!

Yeah I figured "data-" makes more sense. I guess core just uses classes like "ajax-submit" for legacy reasons

Wim Leers’s picture

I guess core just uses classes like "ajax-submit" for legacy reasons

Yep, all those are being transitioned to data- attributes. Most have already been converted.

Status: Fixed » Closed (fixed)

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