diff --git a/schmeckels/serve.py b/schmeckels/serve.py index 44c768c..34c762b 100644 --- a/schmeckels/serve.py +++ b/schmeckels/serve.py @@ -24,7 +24,7 @@ def index(): tags = session.query(Tag).filter_by(reporting=True).all() # Get start and end of timerange - months = 12 + months = 3 today = datetime.now() start_month = today - relativedelta(months=months) start_date = date(start_month.year, start_month.month, 1) diff --git a/schmeckels/templates/base.html b/schmeckels/templates/base.html index 8bc721c..2680087 100644 --- a/schmeckels/templates/base.html +++ b/schmeckels/templates/base.html @@ -8,6 +8,9 @@ Schmeckels + @@ -29,23 +32,26 @@ Upload - +
{% with messages = get_flashed_messages() %} - {% if messages %} - {% for message in messages %} - - {% endfor %} - {% endif %} + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} {% endwith %} - {% block main %} {% endblock %} + {% block main %} {% endblock %}
- {% block script %} {% endblock %} + + diff --git a/schmeckels/templates/transactions.html b/schmeckels/templates/transactions.html index 5fad594..6c55d69 100644 --- a/schmeckels/templates/transactions.html +++ b/schmeckels/templates/transactions.html @@ -1,43 +1,103 @@ {% extends "base.html" %} + +{% block style %} +#navbar { +overflow: hidden; +background-color: lightcyan; +padding: 10px; +} + +/* Navbar links */ +#navbar a { +float: left; +display: block; +color: #f2f2f2; +text-align: center; +padding: 14px; +text-decoration: none; +} + +/* Page content */ +.content { +padding: 16px; +} + +/* The sticky class is added to the navbar with JS when it reaches its scroll position */ +.sticky { +position: fixed; +top: 0; +width: 100%; +} + +/* Add some top padding to the page content to prevent sudden quick movement (as the navigation bar gets a new position +at the top of the page (position:fixed and top:0) */ +.sticky + .content { +padding-top: 60px; +} +{% endblock %} + {% block main %} -
- - - - - - - - - - - - - - - {% for t in transactions %} - - - - - - - - -{% endfor %} - -
DateSender/EmpfängerVerwendungszweckBetragKategorie
{{ t.get_date("de") }}{{ t.name }}
{{t.iban}}
{{ t.description }}{{ t.pretty_amount() }} € - {% for tag in t.tags %} - {{ tag.name }} - {% endfor %} -
+ + + + + + + + + + + + + + + {% for t in transactions %} + + + + + + + + + {% endfor %} + +
DateSender/EmpfängerVerwendungszweckBetragKategorie
{{ t.get_date("de") }}{{ t.name }}
{{t.iban}}
{{ t.description }}{{ + t.pretty_amount() }} € + {% for tag in t.tags %} + {{ tag.name }} + {% endfor %} +
{% endblock %} + +{% block script %} +// When the user scrolls the page, execute myFunction +window.onscroll = function() {myFunction()}; + +// Get the navbar +var navbar = document.getElementById("navbar"); + +// Get the offset position of the navbar +var sticky = navbar.offsetTop; + +// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position +function myFunction() { +if (window.pageYOffset >= sticky) { +navbar.classList.add("sticky") +} else { +navbar.classList.remove("sticky"); +} +} +{% endblock %}