Forms translation & formatting

This commit is contained in:
Emily 2019-05-12 03:22:48 +01:00
parent 3b324f2b62
commit 08e68e35b8
8 changed files with 46 additions and 17 deletions

View File

@ -1,14 +1,19 @@
from wtforms import Form, BooleanField, IntegerField, DecimalField, StringField, DateField, PasswordField, validators
from wtforms import Form, BooleanField, StringField, PasswordField, TextAreaField, validators
from wtforms.fields.html5 import DateField, DecimalField, IntegerField
from wtforms.widgets import TextArea
from flask_login import UserMixin
from objects import glob
class BillForm(Form):
payment_to = StringField("Payment to", [validators.DataRequired()])
description = StringField("Description")
sum = DecimalField("Sum")
kid = IntegerField("KID")
date_due = DateField("Date Due (YYYY-MM-DD )")
payment_to = StringField("lbl_to", [validators.DataRequired()])
description = TextAreaField("lbl_desc", render_kw = {
"cols": 55,
"rows": 8
})
sum = DecimalField("lbl_sum")
kid = IntegerField("lbl_id")
date_due = DateField("lbl_date")
class LoginForm(Form):
email = StringField("Email", [

8
locale/en/bills.json Normal file
View File

@ -0,0 +1,8 @@
{
"lbl_to": "Payment to",
"lbl_desc": "Description",
"lbl_sum": "Sum",
"lbl_id": "KID",
"lbl_date": "Date due",
"lbl_status": "Payment status"
}

View File

@ -0,0 +1,4 @@
{
"add": "Add",
"close": "Close"
}

8
locale/no/bills.json Normal file
View File

@ -0,0 +1,8 @@
{
"lbl_to": "Betaling til",
"lbl_desc": "Tekst",
"lbl_sum": "Sum",
"lbl_id": "KID",
"lbl_date": "Forfallsdato",
"lbl_status": "Betalingsstatus"
}

View File

@ -0,0 +1,4 @@
{
"add": "Legg til",
"close": "Lukk"
}

View File

@ -12,7 +12,7 @@
<div class="container module">
<button type="button" class="btn btn-primary" style="margin:10px;" data-toggle="modal" data-target="#myModal">Add</button>
<button type="button" class="btn btn-primary" style="margin:10px;" data-toggle="modal" data-target="#myModal">{{ locale(LANG, "add") }}</button>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
@ -23,7 +23,7 @@
</div>
<div class="modal-body">
{% macro render_field(field) %}
<dt>{{ field.label }}
<dt><label for="{{ field.label.field_id }}">{{ locale(LANG, field.label.text) }}</label>
<dd>{{ field(**kwargs)|safe }}
{% if field.errors %}
<ul class=errors>
@ -40,13 +40,13 @@
{{ render_field(form.description) }}
{{ render_field(form.sum) }}
{{ render_field(form.kid) }}
{{ render_field(form.date_due) }} YYYY-MM-DD
{{ render_field(form.date_due) }}
</dl>
<input type=submit value="Add">
<input type=submit value="{{ locale(LANG, 'add') }}">
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ locale(LANG, "close") }}</button>
</div>
</div>
</div>
@ -55,12 +55,12 @@
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">Payment to</th>
<th scope="col">Description</th>
<th scope="col" style="width: 120px">Sum</th>
<th scope="col" style="width: 220px">KID</th>
<th scope="col" style="width: 120px">Date Due</th>
<th scope="col" style="width: 150px">Payment status</th>
<th scope="col">{{ locale(LANG, "lbl_to") }}</th>
<th scope="col">{{ locale(LANG, "lbl_desc") }}</th>
<th scope="col" style="width: 120px">{{ locale(LANG, "lbl_sum") }}</th>
<th scope="col" style="width: 220px">{{ locale(LANG, "lbl_id") }}</th>
<th scope="col" style="width: 120px">{{ locale(LANG, "lbl_date") }}</th>
<th scope="col" style="width: 150px">{{ locale(LANG, "lbl_status") }}</th>
</tr>
</thead>
<tbody>