Forms translation & formatting
This commit is contained in:
parent
3b324f2b62
commit
08e68e35b8
|
@ -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 flask_login import UserMixin
|
||||||
|
|
||||||
from objects import glob
|
from objects import glob
|
||||||
|
|
||||||
class BillForm(Form):
|
class BillForm(Form):
|
||||||
payment_to = StringField("Payment to", [validators.DataRequired()])
|
payment_to = StringField("lbl_to", [validators.DataRequired()])
|
||||||
description = StringField("Description")
|
description = TextAreaField("lbl_desc", render_kw = {
|
||||||
sum = DecimalField("Sum")
|
"cols": 55,
|
||||||
kid = IntegerField("KID")
|
"rows": 8
|
||||||
date_due = DateField("Date Due (YYYY-MM-DD )")
|
})
|
||||||
|
sum = DecimalField("lbl_sum")
|
||||||
|
kid = IntegerField("lbl_id")
|
||||||
|
date_due = DateField("lbl_date")
|
||||||
|
|
||||||
class LoginForm(Form):
|
class LoginForm(Form):
|
||||||
email = StringField("Email", [
|
email = StringField("Email", [
|
||||||
|
|
8
locale/en/bills.json
Normal file
8
locale/en/bills.json
Normal 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"
|
||||||
|
}
|
4
locale/en/etc.buttons.json
Normal file
4
locale/en/etc.buttons.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"add": "Add",
|
||||||
|
"close": "Close"
|
||||||
|
}
|
8
locale/no/bills.json
Normal file
8
locale/no/bills.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"lbl_to": "Betaling til",
|
||||||
|
"lbl_desc": "Tekst",
|
||||||
|
"lbl_sum": "Sum",
|
||||||
|
"lbl_id": "KID",
|
||||||
|
"lbl_date": "Forfallsdato",
|
||||||
|
"lbl_status": "Betalingsstatus"
|
||||||
|
}
|
4
locale/no/etc.buttons.json
Normal file
4
locale/no/etc.buttons.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"add": "Legg til",
|
||||||
|
"close": "Lukk"
|
||||||
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<div class="container module">
|
<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 fade" id="myModal" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<!-- Modal content-->
|
<!-- Modal content-->
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
{% macro render_field(field) %}
|
{% macro render_field(field) %}
|
||||||
<dt>{{ field.label }}
|
<dt><label for="{{ field.label.field_id }}">{{ locale(LANG, field.label.text) }}</label>
|
||||||
<dd>{{ field(**kwargs)|safe }}
|
<dd>{{ field(**kwargs)|safe }}
|
||||||
{% if field.errors %}
|
{% if field.errors %}
|
||||||
<ul class=errors>
|
<ul class=errors>
|
||||||
|
@ -40,13 +40,13 @@
|
||||||
{{ render_field(form.description) }}
|
{{ render_field(form.description) }}
|
||||||
{{ render_field(form.sum) }}
|
{{ render_field(form.sum) }}
|
||||||
{{ render_field(form.kid) }}
|
{{ render_field(form.kid) }}
|
||||||
{{ render_field(form.date_due) }} YYYY-MM-DD
|
{{ render_field(form.date_due) }}
|
||||||
</dl>
|
</dl>
|
||||||
<input type=submit value="Add">
|
<input type=submit value="{{ locale(LANG, 'add') }}">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,12 +55,12 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Payment to</th>
|
<th scope="col">{{ locale(LANG, "lbl_to") }}</th>
|
||||||
<th scope="col">Description</th>
|
<th scope="col">{{ locale(LANG, "lbl_desc") }}</th>
|
||||||
<th scope="col" style="width: 120px">Sum</th>
|
<th scope="col" style="width: 120px">{{ locale(LANG, "lbl_sum") }}</th>
|
||||||
<th scope="col" style="width: 220px">KID</th>
|
<th scope="col" style="width: 220px">{{ locale(LANG, "lbl_id") }}</th>
|
||||||
<th scope="col" style="width: 120px">Date Due</th>
|
<th scope="col" style="width: 120px">{{ locale(LANG, "lbl_date") }}</th>
|
||||||
<th scope="col" style="width: 150px">Payment status</th>
|
<th scope="col" style="width: 150px">{{ locale(LANG, "lbl_status") }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user