-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
support section variable in manual url #8494
base: main
Are you sure you want to change the base?
Changes from 5 commits
9901ada
0b000ce
2e55b57
455dba0
d50d853
9075839
a3b22a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -152,20 +152,30 @@ | |||||
if (gnGlobalSettings.lang !== "en") { | ||||||
baseUrl = scope.helpBaseUrl.replace("{{lang}}", gnGlobalSettings.lang); | ||||||
} else { | ||||||
baseUrl = scope.helpBaseUrl.replace("/{{lang}}", ""); | ||||||
baseUrl = scope.helpBaseUrl.replace("{{lang}}", ""); | ||||||
} | ||||||
|
||||||
baseUrl = baseUrl.replace("{{version}}", scope.applicationVersion); | ||||||
|
||||||
var helpPageUrl = baseUrl + "/" + page; | ||||||
var helpPageUrl; | ||||||
if (baseUrl.includes("{{section}}")) { | ||||||
helpPageUrl = baseUrl.replace("{{section}}", page); | ||||||
} else { | ||||||
helpPageUrl = baseUrl + "/" + page; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add the "/"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the default original code. core-geonetwork/web-ui/src/main/resources/catalog/components/common/needhelp/NeedHelpDirective.js Line 160 in 97bdd7b
The default manual.json of each section contains was appended at the end of the url and they contain no such "/". So the Javascript has to add them core-geonetwork/web/src/main/webapp/WEB-INF/data/data/resources/config/manual.json Line 2 in 97bdd7b
|
||||||
} | ||||||
|
||||||
testAndOpen(helpPageUrl).then( | ||||||
function () {}, | ||||||
function () { | ||||||
var baseUrl = scope.helpBaseUrl | ||||||
.replace("/{{lang}}", "") | ||||||
.replace("{{lang}}", "") | ||||||
.replace("{{version}}", scope.applicationVersion); | ||||||
var helpPageUrl = baseUrl + "/" + page; | ||||||
var helpPageUrl; | ||||||
if (baseUrl.includes("{{section}}")) { | ||||||
helpPageUrl = baseUrl.replace("{{section}}", page); | ||||||
} else { | ||||||
helpPageUrl = baseUrl + "/" + page; | ||||||
} | ||||||
|
||||||
testAndOpen(helpPageUrl); | ||||||
} | ||||||
|
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.
I think this should be "."
i.e. there are 2 urls.
lang !== "en"
i.e. frwill be changed to
will be changed to
which does not look as pretty but still works. The double // in the url remains but if you put it as a "." then you get
and the browser will replace this with
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.
Now that I think about it, it does not make sense to user
"."
either because someone could use?lang={{lang}}
and it would be odd to add "." and?lang=.
would not make sense!So I guess "" is better in this case.
Maybe there could be another replace on the url after the replace to remove all the double
"//"
As for why there is a odd case where lang = ""
What if it treated
gnGlobalSettings.lang !== "en"
as ifgnGlobalSettings.lang = null
?Then
{{lang?en}}
could mean that if lang is null then default toen
So you could add another replacement for the following.
baseUrl = scope.helpBaseUrl.replace("{{lang?en}}", "");
So gn could use
https://docs.geonetwork-opensource.org/4.2/{{lang}}/api/search/
And other sites that always want to have a language value for language could use
https://example.com/{{lang?en}}/api/search/?lang={{lang?en}}
and it would result to en value.But this would still be odd logic.