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

Fix custom nav links #4387

Merged
merged 7 commits into from
Feb 25, 2018
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 4 additions & 2 deletions admin/client/App/components/Navigation/Primary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ var PrimaryNavigation = React.createClass({

return this.props.sections.map((section) => {
// Get the link and the class name
const href = section.lists[0].external ? section.lists[0].path : `${Keystone.adminPath}/${section.lists[0].path}`;
const to = !section.lists[0].external && `${Keystone.adminPath}/${section.lists[0].path}`;
const href = section.lists[0].external && section.lists[0].path;
const isActive = this.props.currentSectionKey && this.props.currentSectionKey === section.key;
const className = isActive ? 'primary-navbar__item--active' : null;

Expand All @@ -101,7 +102,8 @@ var PrimaryNavigation = React.createClass({
key={section.key}
label={section.label}
className={className}
to={href}
to={to}
href={href}
>
{section.label}
</PrimaryNavItem>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lib/middleware/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('language', function () {
});
var expected = 'zh-CN';
var req = mockRequest({
acceptLanguage: 'zh-CN;1,en-US;q=0.8'
acceptLanguage: 'zh-CN;q=1,en-US;q=0.8'
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @frapan, sorry for the delay in getting back to you. The only thing I don't understand in your PR is the change to this file. Could you let me know what this is doing for us? I'd be happy to merge the other changes, just want to make sure I understand what's happening here.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you @blargity for your reply and I'm sorry as well for being late.
I had an error during tests because of that line, and I couldn't go on with the tests.
In fact, the syntax of acceptLanguage expects the weights of the languages to be written with ";q=", not simply ";".
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language as a reference.

});
var res = mockResponse();
var middleware = language(keystone);
Expand Down