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

BZ#1644250 - Added ability for documentation to be dynamically configured #1505

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions client/app/core/navigation/navigation-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function NavigationController (Text, Navigation, Session, API_BASE, Shopp
user: Session.currentUser,
API_BASE: API_BASE,
switchGroup: switchGroup,
documentation: '/support/index?support_tab=about',
items: [],
notificationsDrawerShown: false,
newNotifications: false,
Expand All @@ -86,6 +87,14 @@ export function NavigationController (Text, Navigation, Session, API_BASE, Shopp
about: about(),
sites: sites()
})

CollectionsApi.query('settings/help_menu/documentation').then((data) => {
const documentation = data.help_menu.documentation
const matches = documentation.href.match(/http.*(http.*)/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this ends up being https? still work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should continue to work fine because .* accounts for any character after http. I wrote it intentionally so it would accept http:// or https:// .

if (matches[1]) {
vm.documentation = matches[1]
}
})
vm.items = Navigation.init()
refresh()
if (ShoppingCart.allowed()) {
Expand Down
2 changes: 1 addition & 1 deletion client/app/layouts/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</a>
<ul uib-dropdown-menu aria-labelledby="aboutModal">
<li ng-if="vm.permissions.help.documentation">
<a href="/support/index?support_tab=about" target="_blank">
<a href="{{vm.documentation}}" target="_blank">
{{ 'Documentation' | translate}}
</a>
</li>
Expand Down