diff --git a/app/rollerverbrauch/__init__.py b/app/rollerverbrauch/__init__.py index 3581461..19a6f99 100644 --- a/app/rollerverbrauch/__init__.py +++ b/app/rollerverbrauch/__init__.py @@ -9,6 +9,7 @@ from flask.ext.security import Security, SQLAlchemyUserDatastore, \ from flask.ext.security import user_registered from flask_security.core import current_user from flask_sqlalchemy import SQLAlchemy +from flask.ext.security.forms import LoginForm app = Flask(__name__) app.config['SECURITY_PASSWORD_HASH'] = 'pbkdf2_sha512' @@ -72,9 +73,28 @@ def before_request(): @app.route('/') -@login_required def index(): - return redirect(url_for('get_pit_stops')) + if current_user.is_authenticated: + return redirect(url_for('get_pit_stops')) + else: + user_count = len(User.query.all()) + vehicles = Vehicle.query.all() + litres = 0 + kilometers = 0 + for vehicle in vehicles: + stats = tools.VehicleStats(vehicle) + litres += stats.overall_litres + kilometers += stats.overall_distance + vehicle_count = len(vehicles) + pitstop_count = len(Pitstop.query.all()) + data = { + 'users':user_count, + 'vehicles': vehicle_count, + 'pitstops': pitstop_count, + 'litres': litres, + 'kilometers': kilometers + } + return render_template('index.html', login_user_form=LoginForm(), data=data) @app.route('/account/edit_vehicle/', methods=['GET', 'POST']) diff --git a/app/rollerverbrauch/static/main.css b/app/rollerverbrauch/static/main.css index 7626b33..6b9476b 100644 --- a/app/rollerverbrauch/static/main.css +++ b/app/rollerverbrauch/static/main.css @@ -1,8 +1,10 @@ body { padding-top: 50px; } + .starter-template { - padding: 40px 15px; + padding-top: 30px; + padding-bottom: 60px; text-align: center; } @@ -22,9 +24,55 @@ td { color: #a94442; } -.pitstop { -} - .nav-pills > li > a { border: 1px solid; +} + +h1 { + margin-top: 0px; +} + +h2 { + margin-top: 0px; +} + +h3 { + margin-top: 0px; + text-align: center; +} +h3:before{ + content:"― "; +} +h3:after{ + content:" ―"; +} + +.tab-content > .active { + border-left: 1px solid #ddd; + border-right: 1px solid #ddd; + border-bottom: 1px solid #ddd; + padding: 1px; + padding-top: 15px; +} + +.panel-body > p, .panel-body > ul { + text-align: left; +} + +// for small devices +@media only screen +and (min-device-width : 320px) +and (max-device-width : 568px) { + h3:before{ + content:""; + } + h3:after{ + content:""; + } + #charts_tabs { + display:none; + } + #charts_tabs-content { + display:none; + } } \ No newline at end of file diff --git a/app/rollerverbrauch/templates/account.html b/app/rollerverbrauch/templates/account.html index 8cec4de..756216e 100644 --- a/app/rollerverbrauch/templates/account.html +++ b/app/rollerverbrauch/templates/account.html @@ -1,11 +1,11 @@ {% extends "layout.html" %} {% block body %} -

Account management for {{current_user.email}}

+

Account management for {{current_user.email}}

Password
@@ -13,44 +13,46 @@
Vehicles
- - - - - - {% for vehicle in current_user.vehicles %} + - - - + + + - {% endfor %} + {% for vehicle in current_user.vehicles %} + + + + + + {% endfor %} +
- Vehicle - - Info - - Actions -
- {{ vehicle.name }} - - {{ vehicle.pitstops | length }} pitstops - - - edit - - {% if current_user.vehicles | length > 1 %} - - delete - - {% else %} -   - {% endif %} - + Vehicle + + Info + + Actions +
+ {{ vehicle.name }} + + {{ vehicle.pitstops | length }} pitstops + + + edit + + {% if current_user.vehicles | length > 1 %} + + delete + + {% else %} +   + {% endif %} +
{% endblock %} diff --git a/app/rollerverbrauch/templates/admin.html b/app/rollerverbrauch/templates/admin.html index d57f4da..8b25d30 100644 --- a/app/rollerverbrauch/templates/admin.html +++ b/app/rollerverbrauch/templates/admin.html @@ -1,12 +1,18 @@ {% extends "layout.html" %} {% block body %} -

Admin

- We have {{ data.users|length }} users so far: - - Login +
+
+
+
+

Admin

+ We have {{ data.users|length }} users so far: +
    + {% for user in data.users %} +
  • {{user.email}}
  • + {% endfor %} +
+
+
+
{% endblock %} diff --git a/app/rollerverbrauch/templates/createVehicleForm.html b/app/rollerverbrauch/templates/createVehicleForm.html index 4ea3b84..2dce35b 100644 --- a/app/rollerverbrauch/templates/createVehicleForm.html +++ b/app/rollerverbrauch/templates/createVehicleForm.html @@ -1,12 +1,18 @@ {% extends "layout.html" %} {% block body %} -

Create vehicle

-
- {{ form.hidden_tag() }} - {{ render_field_with_errors(form.name) }} - {{ render_field_with_errors(form.submit) }} -
- - +
+
+
+
+

Create vehicle

+
+ {{ form.hidden_tag() }} + {{ render_field_with_errors(form.name) }} + {{ render_field_with_errors(form.submit) }} +
+
+
+
+
{% endblock %} diff --git a/app/rollerverbrauch/templates/deleteVehicleForm.html b/app/rollerverbrauch/templates/deleteVehicleForm.html index 5e957c3..c058771 100644 --- a/app/rollerverbrauch/templates/deleteVehicleForm.html +++ b/app/rollerverbrauch/templates/deleteVehicleForm.html @@ -1,11 +1,18 @@ {% extends "layout.html" %} {% block body %} -

Delete vehicle '{{vehicle.name}}'

-
- {{ form.hidden_tag() }} - {{ render_field_with_errors(form.submit) }} -
- +
+
+
+
+

Delete vehicle '{{vehicle.name}}'?

+
+ {{ form.hidden_tag() }} + {{ render_field_with_errors(form.submit) }} +
+
+
+
+
{% endblock %} diff --git a/app/rollerverbrauch/templates/editVehicleForm.html b/app/rollerverbrauch/templates/editVehicleForm.html index 627a24f..8d2827f 100644 --- a/app/rollerverbrauch/templates/editVehicleForm.html +++ b/app/rollerverbrauch/templates/editVehicleForm.html @@ -1,12 +1,18 @@ {% extends "layout.html" %} {% block body %} -

Edit vehicle

-
- {{ form.hidden_tag() }} - {{ render_field_with_errors(form.name) }} - {{ render_field_with_errors(form.submit) }} -
- +
+
+
+
+

Edit vehicle

+
+ {{ form.hidden_tag() }} + {{ render_field_with_errors(form.name) }} + {{ render_field_with_errors(form.submit) }} +
+
+
+
{% endblock %} diff --git a/app/rollerverbrauch/templates/index.html b/app/rollerverbrauch/templates/index.html new file mode 100644 index 0000000..162c066 --- /dev/null +++ b/app/rollerverbrauch/templates/index.html @@ -0,0 +1,28 @@ +{% extends "layout.html" %} +{% from "security/_macros.html" import render_field_with_errors, render_field %} + +{% block body %} +
+
+ {{ render_login_form() }} +
+
+
+
+

Join the pitstop community!

+ +

There are already {{ data.users}} members with {{ data.vehicles }} vehicles who have logged {{ data.pitstops }} pitstops fuelling {{ data.litres }}l for {{ data.kilometers }}km.

+ +

With pitstop community you can:

+
    +
  • manage multiple vehicles
  • +
  • track each pitstop
  • +
  • get statistics about the fuel consumption
  • +
+ +

Register your account now or log into your account.

+
+
+
+
+{% endblock %} diff --git a/app/rollerverbrauch/templates/layout.html b/app/rollerverbrauch/templates/layout.html index 2df1885..60e5ebe 100644 --- a/app/rollerverbrauch/templates/layout.html +++ b/app/rollerverbrauch/templates/layout.html @@ -16,14 +16,22 @@ {% macro render_field_with_errors(field) %}
{% if field.type == 'SubmitField' %} -
+
+ +
+ +
{% else %} -
+
{% if field.type == 'SelectField' %}