microblog/app/templates/base.html

71 lines
2.8 KiB
HTML
Raw Normal View History

2017-09-27 06:43:28 +00:00
{% extends 'bootstrap/base.html' %}
{% block title %}
2017-09-30 07:21:17 +00:00
{% if title %}{{ title }} - Microblog{% else %}{{ _('Welcome to Microblog') }}{% endif %}
2017-09-27 06:43:28 +00:00
{% endblock %}
{% block navbar %}
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ url_for('index') }}">Microblog</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
2017-09-30 07:21:17 +00:00
<li><a href="{{ url_for('index') }}">{{ _('Home') }}</a></li>
<li><a href="{{ url_for('explore') }}">{{ _('Explore') }}</a></li>
2017-09-27 06:43:28 +00:00
</ul>
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_anonymous %}
2017-09-30 07:21:17 +00:00
<li><a href="{{ url_for('login') }}">{{ _('Login') }}</a></li>
2017-09-27 06:43:28 +00:00
{% else %}
2017-09-30 07:21:17 +00:00
<li><a href="{{ url_for('user', username=current_user.username) }}">{{ _('Profile') }}</a></li>
<li><a href="{{ url_for('logout') }}">{{ _('Logout') }}</a></li>
2017-09-27 06:43:28 +00:00
{% endif %}
</ul>
</div>
2017-09-05 07:04:56 +00:00
</div>
2017-09-27 06:43:28 +00:00
</nav>
{% endblock %}
{% block content %}
<div class="container">
2017-09-05 07:04:56 +00:00
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
2017-09-27 06:43:28 +00:00
<div class="alert alert-info" role="alert">{{ message }}</div>
2017-09-05 07:04:56 +00:00
{% endfor %}
{% endif %}
{% endwith %}
2017-09-27 06:43:28 +00:00
{# application content needs to be provided in the app_content block #}
{% block app_content %}{% endblock %}
</div>
{% endblock %}
2017-09-29 05:28:20 +00:00
{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
2017-09-30 07:21:17 +00:00
{{ moment.lang(g.locale) }}
2017-10-05 22:34:15 +00:00
<script>
function translate(sourceElem, destElem, sourceLang, destLang) {
$(destElem).html('<img src="{{ url_for('static', filename='loading.gif') }}">');
$.post('/translate', {
text: $(sourceElem).text(),
source_language: sourceLang,
dest_language: destLang
}).done(function(response) {
$(destElem).text(response['text'])
}).fail(function() {
$(destElem).text("{{ _('Error: Could not contact server.') }}");
});
}
</script>
2017-09-29 05:28:20 +00:00
{% endblock %}