Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to a specific tab #54

Open
LorenzoSapora opened this issue Feb 22, 2023 · 3 comments
Open

Link to a specific tab #54

LorenzoSapora opened this issue Feb 22, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@LorenzoSapora
Copy link
Contributor

Hey,

Using the tab package, the currently selected tab is reflected into the url ( /resources/users/123/#Campaign=sent ).

Is it currently possible to link to that in this version? If so, point it out and I'll write a PR for the README. If not, tag this with a feature-request.

Thanks

@anderly anderly added the enhancement New feature or request label Feb 22, 2023
@anderly
Copy link
Member

anderly commented Feb 22, 2023

@LorenzoSapora, will take a look at this. We're using the Link element from Inertia (which Nova uses internally) but it doesn't automatically include the currently selected tab (or any URL hash for that matter) in all routes. That's probably something that would could allow for as an explicit opt-in vs. default behavior as there are cases where it wouldn't make sense.

Maybe something like ->appendHash() or ->includeHash() that would allow you to include any URL hash present in the current URL in the generated metric URL.

@LorenzoSapora
Copy link
Contributor Author

Yeah, I've been digging, too

                ->route('nova.pages.detail', 
                    [
                        'resource' => 'users', 
                        'resourceId' => $request->resourceId,
                        'Campaign' => 'sent'
                    ])

is close with /resources/users/123/?Campaign=sent but can't seem to get it to use the hashtag.

@anderly
Copy link
Member

anderly commented Feb 22, 2023

Yeah, the route method is just using the Laravel route helper under the covers which won't include URL hashes. So, most likely, we'd either need to wrap the Link component with a custom component and then provide a method to opt-in to hash inclusion off the Linkable metric api, which we'd then consume in the component to retrieve the current hash and append to the generated URL.

The other possibility is simply use the url() method instead of the route method and then you have full control over the generated URL.

Example: ->url('/resources/users/123/#Campaign=sent')

However, you'd still have the challenge of knowing the current URL hash on the PHP side.

You might be able do some trickery with detecting the current hash and sticking it in session or something and then retrieving prior to using the url method, but just thinking of possibilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants