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

Replace "View source" with "Improve this page" #676

Merged
merged 1 commit into from
Dec 11, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/_static/theme_override.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ div[class^="highlight"] a:hover {
.wy-nav-content {
max-width: 100%
}

/* For the link to edit the page on Github */
.source-link {
float: right;
}

/* Don't let the edit link disappear on mobile. */
@media screen and (max-width: 480px) {
.wy-breadcrumbs li.source-link {
float:none;
display: block;
margin-top: 20px;
}
}
20 changes: 20 additions & 0 deletions docs/_templates/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{# Extend the RTD template to include links to Github instead of "View page
source" #}
{% extends "!breadcrumbs.html" %}


{% block breadcrumbs_aside %}
<li class="source-link">
{% if hasdoc(pagename) %}
{% if pagename.startswith("api/") or pagename.startswith("tutorials/") or pagename.startswith("examples/")%}
{% set title = "Suggested improvement for " + pagename %}
{% set body = "Please describe what could be improved about this page or the typo/mistake that you found:" %}
<a href="https://github.com/{{ github_repo }}/issues/new?title={{ title|urlencode }}&body={{ body|urlencode }}"
class="fa fa-github"> Improve this page</a>
{% else %}
<a href="https://github.com/{{ github_repo }}/edit/{{ github_version }}/{{ doc_path }}/{{ pagename }}{{ suffix }}"
class="fa fa-github"> Improve this page</a>
{% endif %}
{% endif %}
</li>
{% endblock %}
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ def setup(app):
if 'sphinx_rtd_theme' in vars() and sphinx_rtd_theme.__version__ == '0.2.5b1.post1':
html_theme_options['versions'] = {'latest': '../latest', 'dev': '../dev'}

# Extra variables that will be available to the templates. Used to create the
# links to the Github repository sources and issues
html_context = {
'doc_path': 'docs',
'github_repo': 'Unidata/MetPy',
'github_version': 'master', # Make changes to the master branch
}

# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []

Expand Down