Jump to content

Recommended Posts

Posted

This behavior has been integrated in current nightly build of PW 2.2. It can be configured via WireTabs module settings.

StayOnTab (Module for Processwire2+)

This new module remembers the active tab you are on and opens it after saving, or reloading page.

https://github.com/somatonic/StayOnTab

This is still in progress. Just wanted to share and recieve some feedback.

Posted

This is great Soma. I've actually been meaning to have this capability built into WireTabs for quite awhile (it was in PW1 and just never made it over yet). Perhaps we could combine efforts and make this part of the core, as I think it's always better for it to return to the tab it was on when you click save.

Posted

Great to hear! Yeah I started few weeks ago already and then put it away a little. It's only kinda proof of concept, but works well so far. Just some things to consider.

Currently it's just saved as session, so it opens the last "saved" tab, even if you go to another page or close, repopen it.

I wanted it to try to make it so, that it would only save tab when saving page. So when reopen the page it would first be on content tab again. But maybe it would be cool to always have the last selected open. I'm still not sure how it would be best.

How was it in PW1?

Posted

Here's how I was thinking it could work (also the way it worked in PW1). The WireTabs class would auto-select a tab when the URL had a # in it. For instance, /processwire/page/edit/?id=1#children would automatically select the 'children' tab when the page was loaded. Then, every time a tab was clicked, some JS would modify the <form> action attribute to change the # property in the URL. It's a simple concept, but makes sense with the purpose of the '#' properties in a URL to be what auto-selects a tab, much like it would jump to a place in another HTML document.

Posted

I think I saw some evidence of this in the source code :)

Yeah that would be a good concept. Though does the hash # stay in the address even after save? I don't think so. Isn't there a redirect in the edit page?

Posted

You are right, in this case the redirect would have to include the hash. In PW1 there was no redirect, so that wasn't a consideration. Still, that won't be a problem.

Posted

I'm currently using my version with saving it in session, and I really love it how it makes creating fields and repeating changed to fields. Like doing now with the repeater. :rolleyes: It saves quite some time and interuption.

Posted

Testing out here, I agree this is really nice. Perhaps we should just implement it at the session level in the core rather than in the URL. I'm still not totally sure I like deleting a page, and then getting put into the delete tab of the next page I edit (for example) but most of the time the change in behavior is welcome.

  • 1 month later...
Posted

Soma I hope you don't mind, but I took this functionality and brought it into the core. After using your module for several days, I got used to the behavior and found I couldn't live without it. So it had to go in the core. :) Rather than integrating it in the session, it is now part of the JqueryWireTabs module (all JS) and uses cookies to remember tab positions. I figured I might as well let that WireTabs plugin be responsible for remembering the tab states.

I wasn't sure if everyone would want the behavior or not, so it is configurable under Modules > Jquery > Wire Tabs. By default, it only remembers tab positions between form posts (which I think is the most natural behavior). But you can set it to remember all tab positions between pages, or disable the behavior entirely.

  • Like 1
Posted

I already tested it and it's great addition! Also got used to it fast. The options are perfect and makes sense. Thanks!

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...