Fix trailing slash for cost reports

pull/8484/head
Oliver Günther 4 years ago
parent f767e11a28
commit 696981e8e0
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 4
      frontend/src/app/modules/reporting/openproject-reporting.module.ts
  2. 14
      frontend/src/app/modules/reporting/openproject-reporting.routes.ts

@ -30,7 +30,6 @@ import {NgModule} from '@angular/core';
import {UIRouterModule} from "@uirouter/angular";
import {
REPORTING_ROUTES,
uiRouterReportingConfiguration
} from "core-app/modules/reporting/openproject-reporting.routes";
import {ReportingPageComponent} from "core-app/modules/reporting/reporting-page/reporting-page.component";
@ -38,8 +37,7 @@ import {ReportingPageComponent} from "core-app/modules/reporting/reporting-page/
imports: [
// Routes for /cost_reports
UIRouterModule.forChild({
states: REPORTING_ROUTES,
config: uiRouterReportingConfiguration
states: REPORTING_ROUTES
}),
],
declarations: [

@ -33,19 +33,7 @@ export const REPORTING_ROUTES:Ng2StateDeclaration[] = [
{
name: 'reporting',
parent: 'root',
// The trailing slash is important
// cf., https://community.openproject.com/wp/29754
url: '/cost_reports/',
url: '/cost_reports',
component: ReportingPageComponent
},
];
export function uiRouterReportingConfiguration(uiRouter:UIRouter) {
// Ensure backlogs/ are being redirected correctly
// cf., https://community.openproject.com/wp/29754
uiRouter.urlService.rules
.when(
new RegExp("^/projects/(.*)/cost_reports$"),
match => `/projects/${match[1]}/cost_reports/`
);
}

Loading…
Cancel
Save