microblog2/app/templates/base.html

70 lines
2.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
{% if title %}
<title>{{title}} - microblog</title>
{% else %}
<title>microblog</title>
{% endif %}
<link href="{{ url_for('.static', filename = 'css/bootstrap.min.css') }}" rel="stylesheet" media="screen">
<link href="{{ url_for('.static', filename = 'css/bootstrap-responsive.min.css') }}" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="{{ url_for('.static', filename = 'js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('.static', filename = 'js/moment.min.js') }}"></script>
{% if g.locale != 'en' %}
<script src="{{ url_for('.static', filename = 'js/moment-' + g.locale + '.min.js') }}"></script>
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
function translate(sourceLang, destLang, sourceId, destId, loadingId) {
$(destId).hide();
$(loadingId).show();
$.post('/translate', {
text: $(sourceId).text(),
sourceLang: sourceLang,
destLang: destLang
}).done(function(translated) {
$(destId).text(translated['text'])
$(loadingId).hide();
$(destId).show();
}).fail(function() {
$(destId).text("{{ _('Error: Could not contact server.') }}");
$(loadingId).hide();
$(destId).show();
});
}
</script>
</head>
<body>
<div class="container">
<div class="navbar">
<div class="navbar-inner">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="{{ url_for('index') }}">microblog</a>
<ul class="nav">
<li><a href="{{ url_for('index') }}">{{ _('Home') }}</a></li>
{% if g.user.is_authenticated() %}
<li><a href="{{ url_for('user', nickname = g.user.nickname) }}">{{ _('Your Profile') }}</a></li>
<li><a href="{{ url_for('logout') }}">{{ _('Logout') }}</a></li>
{% endif %}
</ul>
<div class="nav-collapse collapse">
{% if g.user.is_authenticated() %}
<form class="navbar-search pull-right" action="{{url_for('search')}}" method="post" name="search">{{g.search_form.hidden_tag()}}{{g.search_form.search(size=20,placeholder=_('Search'),class="search-query")}}</form>
{% endif %}
</div>
</div>
</div>
<div class="row">
<div class="span12">
{% block content %}{% endblock %}
</div>
</div>
</div>
</body>
</html>