Problem/Motivation

There are some cases where I don't want quicktabs to remember the last clicked tab on page reload.

Proposed resolution

Add a configuration checkbox on the tab settings page to remember the last clicked tab per quicktabs instance.

Issue fork quicktabs-3189439

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

loze created an issue. See original summary.

loze’s picture

Status: Active » Needs review
StatusFileSize
new6.39 KB

Here is a patch that provides a setting on the quicktabs instance config page for "Remember list clicked tab" which determines if the cookie is used in the js.

thanks.

loze’s picture

StatusFileSize
new6.39 KB

Just correcting spelling mistakes in the last patch.

loze’s picture

I forgot that I had submitted a similar patch a while back. #3177587: Better default tab behavior

So I've closed that issue in favor of this one which I think is a better.

lubwn’s picture

Patch from #3 works like a charm! Thank you a lot.

I suggest we push this to production, applied cleanly and works nicely.

loze’s picture

Status: Needs review » Reviewed & tested by the community
loze’s picture

Status: Reviewed & tested by the community » Needs review

This is broken now that we are using the core/js-cookie library instead of jquery cookie. Will provide a new patch shortly

loze’s picture

Status: Needs review » Needs work
loze’s picture

Related issues: +#3298649: Replace jquery.cookie with js-cookie
StatusFileSize
new7.19 KB

This patch gets the cookies working with js-cookie. Thanks.

loze’s picture

Status: Needs work » Needs review
niklp’s picture

Would I be correct in saying that this is the part of the patch that fixes the "$.cookie is not a function" error?

-(function ($, Drupal, drupalSettings, once) {
+(function ($, Drupal, drupalSettings, once, cookies) {
loze’s picture

its part of it but not all of it.
see: https://www.drupal.org/node/3104677

floydm’s picture

The config change and javascript from comment 9 work great but AFAICT the QuickTabsInstanceEditForm does not save or reflect the remember_last_clicked_tab value from the config.

The attached patch makes explicit the saving of that value.

floydm’s picture

keshavv made their first commit to this issue’s fork.

keshavv’s picture

The patch given in #9 and #14 failed to apply due to some recent code changes.
The patch #9 also combines the Cookie issue, Which is already fixed on latest 8.x-3.x Branch.
So I have created the MR that will only add the configuration to toggle the remember last clicked tab.
Please review the MR
Thank you.

sahil.goyal’s picture

StatusFileSize
new307.25 KB
new265.32 KB

Thanks @keshavv as described #9 and #14 are now getting failed and some changes already been committed.
MR!14 is working correctly and tab history should be configurable and cookie can now and confirming its working fine and no any issue has been observed, attaching screenshots for the references.
RTBC+1

indrapatil’s picture

StatusFileSize
new96.1 KB

Hi
I have tested the patch it working I attached the screenshot for reference.

keshavv’s picture

Status: Needs review » Reviewed & tested by the community
kburakozdemir’s picture

patch#14 works for me. thanks. RTBC+1...

smustgrave’s picture

Version: 8.x-3.x-dev » 4.0.x-dev
Status: Reviewed & tested by the community » Needs work

Will need an upgrade hook + test coverage

loze’s picture

MR 37 is against 4.0.x
Still needs update hook and test coverage.

loze changed the visibility of the branch 3189439-last-clicked-tab to hidden.

loze changed the visibility of the branch 3189439-last-clicked-tab to active.

loze’s picture

StatusFileSize
new7.28 KB

Ignore MR14, that is no longer valid and I am unable to close it.

MR37 is the latest, against 4.0.x

Here is a patch for composer that should work with the 4.0.x dev branch

loze’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

There’s no upgrade hook or test coverage

loze’s picture

Ive added an update hook which sets the new default value on all existing QT instances.

Added the config variable to QuicktabsConfigSchemaTest but I am unsure how to go about testing the actual functionality and could use some help, thanks.

smustgrave’s picture

So the update hook will need to be in a post update hook and use a ConfigImporter of some kind to do in batches.

loze’s picture

Status: Needs work » Needs review

Ive added quicktabs.post_update.php. Is this more along the line of what you are asking for?