I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 4c5f6f1b authored by str4d's avatar str4d
Browse files

Enable themes to have different I2P logos, with a default fallback

parent dcf058d7
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<body> <body>
<div class="hide"><a href="#content" title="Skip navigation" accesskey="2">{{ _('Skip navigation') }}</a></div> <div class="hide"><a href="#content" title="Skip navigation" accesskey="2">{{ _('Skip navigation') }}</a></div>
<div id="topbar"> <div id="topbar">
<a id="logo" href="{{ site_url() }}"><img src="{{ url_for('static', filename='styles/' + g.theme + '/images/i2plogo.png') }}" alt="I2P Logo" title="Invisible Internet Project (I2P)" /></a> <a id="logo" href="{{ site_url() }}"><img src="{{ url_for('static', filename=logo_url()) }}" alt="I2P Logo" title="Invisible Internet Project (I2P)" /></a>
<div class="title"> <div class="title">
<h1>{{ self.title() }}</h1> <h1>{{ self.title() }}</h1>
{% include "global/lang.html" %} {% include "global/lang.html" %}
......
from flask import g, request, url_for from flask import g, request, safe_join, url_for
import os.path
from i2p2www import CANONICAL_DOMAIN, CURRENT_I2P_VERSION, app from i2p2www import CANONICAL_DOMAIN, CURRENT_I2P_VERSION, STATIC_DIR, app
I2P_TO_CLEAR = { I2P_TO_CLEAR = {
'www.i2p2.i2p': 'www.i2p2.de', 'www.i2p2.i2p': 'www.i2p2.de',
...@@ -79,6 +80,15 @@ def utility_processor(): ...@@ -79,6 +80,15 @@ def utility_processor():
# Probably a 404 error page # Probably a 404 error page
return url_for('main_index', **args) return url_for('main_index', **args)
# Shorthand for getting the logo for the current theme
def get_logo_for_theme():
logo = 'styles/' + g.theme + '/images/i2plogo.png'
print logo
print safe_join(STATIC_DIR, logo)
if not os.path.isfile(safe_join(STATIC_DIR, logo)):
logo = 'images/i2plogo.png'
return logo
def get_current_version(string=None): def get_current_version(string=None):
if string: if string:
return string % CURRENT_I2P_VERSION return string % CURRENT_I2P_VERSION
...@@ -87,6 +97,7 @@ def utility_processor(): ...@@ -87,6 +97,7 @@ def utility_processor():
return dict(i2pconv=convert_url_to_clearnet, return dict(i2pconv=convert_url_to_clearnet,
url_for_other_page=url_for_other_page, url_for_other_page=url_for_other_page,
change_theme=change_theme, change_theme=change_theme,
logo_url=get_logo_for_theme,
site_url=get_site_url, site_url=get_site_url,
get_url=get_url_with_lang, get_url=get_url_with_lang,
get_flag=get_flag, get_flag=get_flag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment