Skip to content

Add 'active' class to current page in rustbook table of contents #25551

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

Merged
merged 1 commit into from
May 19, 2015

Conversation

cllns
Copy link
Contributor

@cllns cllns commented May 17, 2015

Currently the table of contents for rustbook doesn't signify which page you are on.

This PR adds an 'active' class to the link for the current page, and defines the CSS rule for that class to make the link underlined and bold.

Not sure about two things:

  1. Is current_page is a good name for the function parameter? At first I thought current_item would be good, but then in the walk_item function, you'd have item and current_item.

  2. For the CSS, is both bold and underline too much? At first I had it just be underlined, but that's also how the links look when they're hovered over.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@killercup
Copy link
Member

Nice! I've been meaning to add something like this as well. I'm no authority, but current_page sounds good (maybe current_chapter?). I'd also just set it to bold, without adding an underline.

@alexcrichton
Copy link
Member

Thanks! Would it be possible to upload a preview of these docs as well?

@cllns
Copy link
Contributor Author

cllns commented May 18, 2015

Here you go @alexcrichton: http://cllns.com/rustbook/ (this link will not work once this PR is closed)

@killercup thanks for the suggestion! If someone else also prefers to not have the current page underlined, I'll change it :)

@steveklabnik
Copy link
Member

I like it 👍

@alexcrichton
Copy link
Member

@bors: r+ 99868f6 rollup

Awesome, thanks!

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 18, 2015
…toc, r=alexcrichton

Currently the table of contents for `rustbook` doesn't signify which page you are on.

This PR adds an 'active' class to the link for the current page, and defines the CSS rule for that class to make the link underlined and bold.

Not sure about two things:
1) Is `current_page` is a good name for the function parameter? At first I thought `current_item` would be good, but then in the `walk_item` function, you'd have `item` and `current_item`.

2) For the CSS, is both bold and underline too much? At first I had it just be underlined, but that's also how the links look when they're hovered over.
Manishearth added a commit to Manishearth/rust that referenced this pull request May 19, 2015
…toc, r=alexcrichton

Currently the table of contents for `rustbook` doesn't signify which page you are on.

This PR adds an 'active' class to the link for the current page, and defines the CSS rule for that class to make the link underlined and bold.

Not sure about two things:
1) Is `current_page` is a good name for the function parameter? At first I thought `current_item` would be good, but then in the `walk_item` function, you'd have `item` and `current_item`.

2) For the CSS, is both bold and underline too much? At first I had it just be underlined, but that's also how the links look when they're hovered over.
bors added a commit that referenced this pull request May 19, 2015
@bors bors merged commit 99868f6 into rust-lang:master May 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants