Permalink
Browse files

Add a link to `/usertraffic` instead of gauge

Refs #395
  • Loading branch information...
lukasjuhrich committed Jan 22, 2019
1 parent 53f0201 commit 33a3f1fec80686d32aa8c6b7e2bd82dbad7f100c
Showing with 16 additions and 0 deletions.
  1. +2 −0 sipa/initialization.py
  2. +9 −0 sipa/model/misc.py
  3. +5 −0 sipa/templates/base.html
@@ -17,6 +17,7 @@
from sipa.defaults import DEFAULT_CONFIG
from sipa.flatpages import CategorizedFlatPages
from sipa.model import build_backends_ext
from sipa.model.misc import should_display_traffic_data
from sipa.session import SeparateLocaleCookieSessionInterface
from sipa.utils import replace_empty_handler_callables, url_self
from sipa.utils.babel_utils import get_weekday
@@ -75,6 +76,7 @@ def init_app(app, **kwargs):
get_weekday=get_weekday,
possible_locales=possible_locales,
get_attribute_endpoint=get_attribute_endpoint,
should_display_traffic_data=should_display_traffic_data,
traffic_chart=provide_render_function(generate_traffic_chart),
current_datasource=backends.current_datasource,
form_label_width_class="col-sm-{}".format(form_label_width),
@@ -1,6 +1,15 @@
from collections import namedtuple

from flask import request
from flask_login import current_user

from sipa.backends import backends

TransactionTuple = namedtuple('Transaction', ['datum', 'value'])

PaymentDetails = namedtuple('PaymentDetails', 'recipient bank iban bic purpose')


def should_display_traffic_data():
return ((current_user.is_authenticated and current_user.has_connection)
or backends.user_from_ip(request.remote_addr) is not None)
@@ -229,6 +229,11 @@ <h1>AG DSN</h1>
<div id="sidebar" class="col-sm-3">
{% block sidebar %}
<div>
{% if should_display_traffic_data() -%}
<div class="module"><h2>
<a href="{{ url_for('generic.usertraffic') }}"><span class="glyphicon glyphicon-stats"></span> Traffic</a>
</h2></div>
{%- endif %}
<div id="row-contact">
<div class="module">
<h2>{{ _("Kontakt") }} </h2>

0 comments on commit 33a3f1f

Please sign in to comment.