Skip to content

Commit

Permalink
feat: Add preview banner also for branches (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Ribeiro authored May 16, 2023
1 parent 326cc64 commit bbcdd39
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions material/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,16 @@
<div class="md-main__inner">
<div class="md-content">
<article class="md-content__inner md-typeset">
{% if config.extra.pull_request_preview %}
{% if config.extra.preview_pull_request or config.extra.preview_branch %}
<div class="admonition important" style="margin-top:0">
<div class="admonition-title">This documentation is a preview of the pull request
<a href="{{ config.repo_url }}/pull/{{ config.extra.pull_request_preview }}">#{{ config.extra.pull_request_preview }}</a>
<div class="admonition-title">
{% if config.extra.preview_pull_request %}
This documentation is a preview of the pull request
<a href="{{ config.repo_url }}/pull/{{ config.extra.preview_pull_request }}">#{{ config.extra.preview_pull_request }}</a>
{% else %}
This documentation is a preview of the branch
<code><a href="{{ config.repo_url }}/tree/{{ config.extra.preview_branch }}">{{ config.extra.preview_branch }}</a></code>
{% endif %}
</div>
<p>
For the latest updates and improvements in production,
Expand Down
12 changes: 9 additions & 3 deletions src/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,16 @@
<article class="md-content__inner md-typeset">

<!-- Pull request preview notice -->
{% if config.extra.pull_request_preview %}
{% if config.extra.preview_pull_request or config.extra.preview_branch %}
<div class="admonition important" style="margin-top: 0">
<div class="admonition-title">This documentation is a preview of the pull request
<a href="{{ config.repo_url }}/pull/{{ config.extra.pull_request_preview }}">#{{ config.extra.pull_request_preview }}</a>
<div class="admonition-title">
{% if config.extra.preview_pull_request %}
This documentation is a preview of the pull request
<a href="{{ config.repo_url }}/pull/{{ config.extra.preview_pull_request }}">#{{ config.extra.preview_pull_request }}</a>
{% else %}
This documentation is a preview of the branch
<code><a href="{{ config.repo_url }}/tree/{{ config.extra.preview_branch }}">{{ config.extra.preview_branch }}</a></code>
{% endif %}
</div>
<p>
For the latest updates and improvements in production,
Expand Down

0 comments on commit bbcdd39

Please sign in to comment.