-
Notifications
You must be signed in to change notification settings - Fork 16
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
ENH Allow URLs without trailing slashes #253
ENH Allow URLs without trailing slashes #253
Conversation
1898a3e
to
cb0a868
Compare
|
||
// Set root breadcrumb | ||
const breadcrumbs = [{ | ||
text: i18n._t('CampaignAdmin.CAMPAIGN', 'Campaigns'), | ||
href: url, | ||
href: `/${reactRoutePath}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we always guarantee that reactRoutePath won't have a leading slash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically yes but realistically there's the remote chance someone will do something really weird lol. I'll apply joinUrlPaths
to it as you recommended in another comment, that's a really elegant way to handle it that I hadn't considered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -119,7 +120,8 @@ class CampaignAdmin extends Component { | |||
* @return {string} | |||
*/ | |||
getActionRoute(id, view) { | |||
return `/${this.props.sectionConfig.reactRoutePath}/set/${id}/${view}`; | |||
const { reactRoutePath } = this.props.sectionConfig; | |||
return joinUrlPaths(`/${reactRoutePath}`, `/set/${id}/${view}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is possibly better done as
return joinUrlPaths('/', reactRoutePath, `/set/${id}/${view}`);
I'm not sure if reactRouthPath could have a leading slash or not
Same applies for all the other cases of /${reactRoutePath}
in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cb0a868
to
4a9bf33
Compare
webpack-config changes are now included in this PR. |
4a9bf33
to
f3b933b
Compare
f3b933b
to
a2a95ae
Compare
Rebased to resolve conflicts |
silverstripe/silverstripe-framework#10538 allows us to have a URLs which can be configured to have or omit trailing slashes. This PR updates the campaign-admin javascript to stop explicitly expecting one to be/not be there.
Note that this PR will need to be modified once silverstripe/webpack-config#57 has been merged and released in NPM.
Parent issue