From f7a969240a984c6eb63662331ad7767283088efc Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 16 Oct 2011 23:38:27 +0200 Subject: Add a datepicker (with support of i18n). Fix #37 --- budget/templates/forms.html | 8 ++++---- budget/templates/layout.html | 3 ++- budget/templates/list_bills.html | 9 +++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'budget/templates') diff --git a/budget/templates/forms.html b/budget/templates/forms.html index 3a3d5ba..8c0cda3 100644 --- a/budget/templates/forms.html +++ b/budget/templates/forms.html @@ -1,4 +1,4 @@ -{% macro input(field, multiple=False) -%} +{% macro input(field, multiple=False, class=None) -%}
{% if field.type != "SubmitField" %} @@ -6,9 +6,9 @@ {% endif %}
{% if multiple == True %} - {{ field(multiple=True) }} + {{ field(multiple=True, class=class) }} {% else %} - {{ field }} + {{ field(class=class) | safe }} {% endif %} {% if field.description %} {{ field.description }} @@ -75,7 +75,7 @@ {% if edit %}{{ _("Edit this bill") }} {% else %}{{ _("Add a bill") }} {% endif %} {% include "display_errors.html" %} {{ form.hidden_tag() }} - {{ input(form.date) }} + {{ input(form.date, class="datepicker") }} {{ input(form.what) }} {{ input(form.payer) }} {{ input(form.amount) }} diff --git a/budget/templates/layout.html b/budget/templates/layout.html index 72b6ee8..e6614d8 100644 --- a/budget/templates/layout.html +++ b/budget/templates/layout.html @@ -5,7 +5,8 @@ {{ _("Account manager") }}{% block title %}{% endblock %} - + + {% block head %}{% endblock %} + {% if g.lang != "en" %} + + {% endif %} +{% endblock %} {% block js %} // display the form when clicking on the "add bill" button var show_form = function(){ @@ -40,6 +46,9 @@ }, function(){ $(this).find('.remove').hide(); }); + + $.datepicker.setDefaults({'dateFormat': 'yy-mm-dd'}); + $(".datepicker").datepicker($.datepicker.regional['{{ g.lang }}']); {% endblock %} {% block sidebar %} -- cgit v1.1