beeware.github.io/templates/layout.html
2023-04-14 08:38:52 +08:00

218 lines
10 KiB
HTML

{%- from "macros/translation.html" import transbag -%}
{%- macro menu_item(identifier) -%}
{%- set identifier_url = '/' + identifier -%}
{%- set trans_url = identifier_url|url(alt=this.alt) -%}
{%- set this_is_child = this.is_child_of(identifier_url) -%}
<li class="nav-item{% if this_is_child %} active{% endif %}">
<a class="nav-link" href="{{ trans_url }}">{{- transbag('menu', this.alt, identifier) -}}{%- if this_is_child -%}<span class="sr-only">(current)</span>{%- endif -%}</a>
</li>
{%- endmacro -%}
{%- set t_languages = transbag('menu', this.alt, 'languages') -%}
{%- set t_sitemap = transbag('translate', this.alt, 'sitemap') -%}
{%- set t_welcome = transbag('translate', this.alt, 'welcome') -%}
{%- set t_edit_on_github = transbag('translate', this.alt, 'edit_on_github') -%}
{%- set t_create_on_github = transbag('translate', this.alt, 'create_on_github') -%}
{%- set t_translation_out_of_date = transbag('translate', this.alt, 'translation_out_of_date') -%}
{%- set t_see_original_content = transbag('translate', this.alt, 'see_original_content') -%}
{%- set t_update_translation = transbag('translate', this.alt, 'update_translation') -%}
{%- set diff = alt_outdated_diff(this) -%}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{%- block title %}{{- t_welcome -}}{% endblock -%} — BeeWare</title>
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/images/brutus-144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/images/brutus-114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/images/brutus-72.png">
<link rel="apple-touch-icon-precomposed" href="/static/images/brutus-57.png">
<link rel="shortcut icon" href="/static/images/brutus-32.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap-grid.min.css">
<!-- Project CSS -->
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Cutive">
<link rel="stylesheet" type="text/css" href="/static/beeware.css">
{%- if diff -%}
<!-- Project CSS -->
{{- get_pygments_css_styles('default')|safe -}}
{%- endif -%}
{%- if this.alt == 'ar' -%}
<link rel="stylesheet" type="text/css" href="/static/rtl.css">
{%- endif -%}
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/078c86a30a.js" crossorigin="anonymous"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-2943925-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-2943925-4');
</script>
{%- block extra_head -%}{%- endblock -%}
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="nav-top">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsDefault" aria-controls="navbarsDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-brand-block">
<a class="navbar-brand" href="{{ '/'|url(alt=this.alt) }}"><img class="mx-2" src="{{ '/static/images/brutus-32.png'|asseturl }}">BeeWare</a>
</div>
</div>
<div class="collapse navbar-collapse" id="navbarsDefault">
<ul class="navbar-nav mr-auto">
{{ menu_item('project') }}
{{ menu_item('news') }}
{{ menu_item('community') }}
{{ menu_item('contributing') }}
{{ menu_item('contact') }}
<li class="nav-item">
<a class="nav-link" href="/contributing/membership/">
{{ transbag('menu', this.alt, 'donate') }}
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
{%- set extra_slash = '/' if this.path[-1] != '/' else '' -%}
{%- set alt_path = '%2B' + this.alt if this.alt and this.alt != 'en' else '' -%}
<li class="nav-item">
{%- if this.alt in get_alts(source=this, fallback=False) -%}
{%- set edit_link = 'https://github.com/beeware/beeware.github.io/edit/lektor/content' + this.path.split('@')[0] + extra_slash + 'contents' + alt_path + '.lr' -%}
<a class="nav-link" href="{{ edit_link }}" rel="noopener noreferrer" target="_blank">
<i class="fa fa-github "></i><small>&nbsp;{{ t_edit_on_github }}</small>
</a>
{%- else -%}
{# This method is provided by a custom plugin found in /packages/lektor_beeware_plugin/ #}
{%- set content_value = urlencode_limit(site.get(this.path, alt='_primary').contents.as_text(), limit=5000) -%}
{%- if content_value and '@' not in this.path -%}
<a class="nav-link" href="https://github.com/beeware/beeware.github.io/new/lektor/content{{ this.path }}/contents{{ alt_path }}.lr?filename=contents{{ alt_path }}.lr&value={{ content_value }}" target="_blank">
<i class="fa fa-github "></i><small>&nbsp;{{ t_create_on_github }}</small>
</a>
{%- endif -%}
{%- endif -%}
</li>
<li class="nav-item dropdown dropdown-pull-right">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-globe" aria-hidden="true"></i> <span class="caret"></span>
</a>
<div class="dropdown-menu" aria-labelledby="dropdown01">
{%- set eng_active = this.alt == 'en' %}
<a class="dropdown-item {% if eng_active %}active{% endif %}" href="{{ '.'|url(alt='en') }}">
English
</a>
{%- for alt, alternative in config.ALTERNATIVES.items()|sort -%}
{%- set alt_active = alt == this.alt -%}
{%- if alt != config.primary_alternative -%}
<a class="dropdown-item {% if alt_active %}active{% endif %}" href="{{ '.'|url(alt=alt) }}">
{{ transbag('translate', alt, alternative.name.en.lower()) }}
</a>
{%- endif -%}
{%- endfor -%}
</div>
</li>
</ul>
</div>
</nav>
<div class="content">
{%- block preamble -%}
{%- endblock -%}
<div class="container">
{%- if this.alt in get_alts(source=this, fallback=False) and diff -%}
<div class="alert alert-warning">
<i class="fa fa-warning"></i>&nbsp;{{ t_translation_out_of_date }}&nbsp;&nbsp;
<a href="{{ site.get(this.path, alt='_primary')|url }}" data-toggle="modal" data-target="#myModal">{{ t_see_original_content }}</a>
</div>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<a href="{{ edit_link }}" target="_blank">
<i class="fa fa-github "></i>&nbsp;{{ t_update_translation }}
</a>
</h4>
</div>
<div class="modal-body">
<small>
{{- diff|safe -}}
</small>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- End Modal content -->
</div>
</div>
<!-- End Modal -->
{%- endif -%}
{%- block body -%}{%- endblock -%}
</div>
</div>
<footer class="footer">
<div class="container text-muted">
<div class="d-block d-sm-none copyright">&copy; Russell Keith-Magee {{ none|dateformat('Y') }}</div>
<div class="float-right clearfix d-sm-block d-none">&copy; Russell Keith-Magee {{ none|dateformat('Y') }}</div>
<p class="d-sm-block d-none">
<a href="https://github.com/beeware/"><i class="fa fa-github fa-lg" aria-hidden="true"></i> GitHub</a> |
<a href="https://beeware.org/bee/chat/"><i class="fa-brands fa-discord fa-lg" aria-hidden="true"></i> Discord</a> |
<a href="https://fosstodon.org/@beeware"><i class="fa-brands fa-mastodon fa-lg" aria-hidden="true"></i> Mastodon</a> |
<a href="{{ '/sitemap'|url(alt=this.alt) }}"><i class="fa fa-sitemap fa-lg" aria-hidden="true"></i> {{ t_sitemap }}</a>
</p>
<p class="d-block d-sm-none footer-social">
<a href="https://github.com/beeware/"><i class="fa fa-github fa-lg" aria-hidden="true"></i> GitHub</a> |
<a href="https://beeware.org/bee/chat/"><i class="fa-brands fa-discord fa-lg" aria-hidden="true"></i> Discord</a> |
<a rel="me" href="https://fosstodon.org/@beeware"><i class="fa-brands fa-mastodon fa-lg" aria-hidden="true"></i> Mastodon</a>
</p>
<p class="d-block d-sm-none footer-sitemap">
<a href="{{ '/sitemap'|url(alt=this.alt) }}"><i class="fa fa-sitemap fa-lg" aria-hidden="true"></i> {{ t_sitemap }}</a>
</p>
{% set team = site.query('/community/team', alt=this.alt).all() %}
{% for member in team %}
{% if member.mastodon_handle %}
<a rel="me" href="https://{{ member.mastodon_handle.split('@')[2] }}/@{{ member.mastodon_handle.split('@')[1] }}" style="display:none" ></a>
{% endif %}
{% endfor %}
</div>
</footer>
<!-- jQuery first, then Bootstrap JS. -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="/static/tether-1.3.3/js/tether.min.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
{%- block extra_script -%}{%- endblock -%}
</body>
</html>