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

Allow routing to apps installed in subfolders #302

Merged
merged 8 commits into from
Jun 26, 2020

Conversation

bakerkretzmar
Copy link
Collaborator

This PR tweaks how Ziggy parses the pathname of the current URL so that it's possible to use Ziggy with Laravel apps installed in subfolders. Fixes #295.

Rather than just using window.location.pathname directly, and calling .slice(1) to remove the leading slash, I'm now getting the pathname, getting Ziggy's baseUrl and parsing out anything after the domain name, and then comparing these to see if we need to trim the subfolder segment off the beginning of the pathname.

@bakerkretzmar bakerkretzmar added this to the v1.0 milestone Jun 16, 2020
@bakerkretzmar bakerkretzmar merged commit a995306 into master Jun 26, 2020
@bakerkretzmar bakerkretzmar deleted the jbk/subfolder-issue-295 branch June 26, 2020 13:24
bakerkretzmar added a commit that referenced this pull request Jun 26, 2020
bakerkretzmar added a commit that referenced this pull request Jul 31, 2020
* Formatting

* Clarify and shorten test names

* Fix assertion parameter order – `assert.equal` wants actual first, then expected

* Run tests with AVA instead of Mocha

* Move tests related to checking the current route into their own file

* Add test for regex bux

* Update port test

* Remove unnecessary setup

* Rename test.route.js to route.spec.js

* Extract common setup steps

* Move axios tests into their own file

* Move check tests into their own file

* Wip

* Consolidate setup

* Update PHP testing configuration

* Remove unused methods and imports

* Require phpunit explicitly

* Add test from #263

* Naming and formatting, and splitting more tests out into their own files

* Load test routes from fixture file

* Make assertions stricter

* Make assertions stricter and clean up formatting

* Define routes in setUp again

* Formatting

* Formatting

* Formatting

* Wip

* Finish converting JS tests

* Add tests from #302 for subfolder routing

* Add tests from #301 for parsing the id key out of an object

* Remove arrow functions for compatibility with PHP < 7.4

* Update dependencies

* Clean up repetitive assertions

* Formatting

* Stub out tests for open PRs

* Stub out test for matching current route *with parameters*

* Remove babel Object.assign transform

* Simplify Ava config

* Update deps and format babel config

* Clean up setup a bit

* Clean up PHP test formatting

* Simplify filtering

* Correctly set latest tag during `npm publish` even if it isn't annotated

* Move all tests back into one file

* Remove axios tests

* Use power-assert

* Rename back to route.test.js

* Use Jest

* Update Contributing and test workflow

* Formatting

* Remove build:watch

* Formatting

* Formatting

* Fix globals

* Fix middleware test on Laravel <7

* Update changelog

* PHPUnit and PHP version

* Remove dumps

* Don't test PHP 7.2

* Wip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue on getting parameters if project is under a subfolder
1 participant