diff options
author | Priit Laes <plaes@plaes.org> | 2010-08-06 13:05:33 +0300 |
---|---|---|
committer | Priit Laes <plaes@plaes.org> | 2010-08-06 13:05:33 +0300 |
commit | 3e77643cc4624f94f3011f6311aad354f9a47eb6 (patch) | |
tree | c66a977dc5eed788777679db328390b926e811c1 | |
parent | Added version check plugin (diff) | |
download | gsoc2010-grumpy-3e77643cc4624f94f3011f6311aad354f9a47eb6.tar.gz gsoc2010-grumpy-3e77643cc4624f94f3011f6311aad354f9a47eb6.tar.bz2 gsoc2010-grumpy-3e77643cc4624f94f3011f6311aad354f9a47eb6.zip |
Move some account related info into its own separate macro
-rw-r--r-- | grumpy/templates/_userinfo.html | 15 | ||||
-rw-r--r-- | grumpy/templates/layout.html | 14 |
2 files changed, 18 insertions, 11 deletions
diff --git a/grumpy/templates/_userinfo.html b/grumpy/templates/_userinfo.html new file mode 100644 index 0000000..a9827e7 --- /dev/null +++ b/grumpy/templates/_userinfo.html @@ -0,0 +1,15 @@ +{% macro show_box(g) -%} +{% if g.user -%} +<ul> +<li>{{ g.user.email.split('@')[0] | e }} +<li><a href="{{ url_for('logout') }}">Log out</a> +{% if g.user.regtoken -%} +<span class="warning"> +Warning: this user account has not yet been confirmed.<br /> +Until the account has been confirmed, You won't receive +notifications and cannot add packages to your watch list. +{# TODO: provide link to "request new token" #} +</span> +{% endif -%}{# g.user.regtoken #} +{% endif -%}{# g.user #} +{% endmacro -%} diff --git a/grumpy/templates/layout.html b/grumpy/templates/layout.html index 273a5d3..381e32c 100644 --- a/grumpy/templates/layout.html +++ b/grumpy/templates/layout.html @@ -1,20 +1,12 @@ +{% import '_userinfo.html' as userinfo -%} <!doctype html> <head> <title>{% block title %}Welcome{% endblock %} | Grumpy</title> </head> -{% if g.user and g.user.regtoken %} -<span class="warning"> -Warning: this user account has not yet been confirmed.<br /> -Until the account has been confirmed, You won't receive -notifications and cannot add packages to your watch list. -{# TODO: provide link to "request new token" #} -</span> -{% endif %} +{{ userinfo.show_box(g) }} <div class=menu> <ul> - {% if g.user %} - <li><a href="{{ url_for('logout') }}">Log out</a></li> - {% else %} + {% if not g.user %} <li><a href="{{ url_for('login') }}">Login</a></li> {% endif %} </ul> |