Skip to content

Commit

Permalink
Default template: use grantlee plugin sk_tzc to locale dates (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
buschmann23 committed Aug 29, 2017
1 parent dd84aef commit 6c50aa2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
10 changes: 6 additions & 4 deletions templates/default/site/account/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@
<div class="col"><h2><i class="fa fa-user"></i> {{ _("Edit account") }} <small class="text-muted">{{ account.username }}</small></h2></div>
</div>

{% i18nc_var "Datetime format string to display created and updated times on edit pages" "MMMM d, yyyy hh:mmap" as dtFormatString %}

<form method="post">

<fieldset>
<div class="row mt-1">

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="created">{{ help.created.title }}</label>
<input type="text" class="form-control" id="created" aria-describedby="createdDesc" value="{{ _(account.created) }}" readonly>
<input type="text" class="form-control" id="created" aria-describedby="createdDesc" value="{% sk_tzc account.created dtFormatString %}" readonly>
<small id="createdDesc" class="form-text text-muted">{{ help.created.text }}</small>
</div>

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="updated">{{ help.updated.title }}</label>
<input type="text" class="form-control" id="updated" aria-describedby="updatedDesc" value="{{ _(account.updated) }}" readonly>
<input type="text" class="form-control" id="updated" aria-describedby="updatedDesc" value="{% sk_tzc account.updated dtFormatString %}" readonly>
<small id="updatedDesc" class="form-text text-muted">{{ help.updated.text }}</small>
</div>

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="validUntil">{{ help.validUntil.title }}</label>
<input type="text" id="validUntil" name="validUntil" class="form-control{% if validationErrors.validUntil.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DD hh:mm:ss") }}" value="{{ account.validUntil|time:"yyyy-MM-dd HH:mm:ss" }}" aria-describedby="validUntilDesc" required>
<input type="datetime-local" id="validUntil" name="validUntil" class="form-control{% if validationErrors.validUntil.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DDThh:mm") }}" value="{% sk_tzc validUntil|default_if_none:account.validUntil "yyyy-MM-ddTHH:mm" %}" aria-describedby="validUntilDesc" pattern="^(2\d{3})-(0[1-9]|1[012])-(31|30|0[1-9]|[12][0-9])T([01][0-9]|2[0-3]):([0-5][0-9])$" required>
{% if validationErrors.validUntil.count %}<div class="invalid-feedback"><small>{{ validationErrors.validUntil.0 }}</small></div>{% endif %}
<small id="validUntilDesc" class="form-text text-muted">{{ help.validUntil.text }}</small>
</div>
Expand All @@ -47,7 +49,7 @@

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="passwordExpires">{{ help.passwordExpires.title }}</label>
<input type="text" id="passwordExpires" name="passwordExpires" class="form-control{% if validationErrors.passwordExpires.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DD hh:mm:ss") }}" value="{{ account.passwordExpires|time:"yyyy-MM-dd HH:mm:ss" }}" aria-describedby="passwordExpiresDesc" required>
<input type="datetime-local" id="passwordExpires" name="passwordExpires" class="form-control{% if validationErrors.passwordExpires.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DDThh:mm") }}" value="{% sk_tzc passwordExpires|default_if_none:account.passwordExpires "yyyy-MM-ddTHH:mm" %}" aria-describedby="passwordExpiresDesc" pattern="^(2\d{3})-(0[1-9]|1[012])-(31|30|0[1-9]|[12][0-9])T([01][0-9]|2[0-3]):([0-5][0-9])$" required>
{% if validationErrors.passwordExpires.count %}<div class="invalid-feedback"><small>{{ validationErrors.passwordExpires.0 }}</small></div>{% endif %}
<small id="passwordExpiresDesc" class="form-text text-muted">{{ help.passwordExpires.text }}</small>
</div>
Expand Down
6 changes: 4 additions & 2 deletions templates/default/site/admin/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<div class="col"><h2><i class="fa fa-user"></i> {{ _("Edit admin") }} <small class="text-muted">{{ adminaccount.username }}</small></h2></div>
</div>

{% i18nc_var "Datetime format string to display created and updated times on edit pages" "MMMM d, yyyy hh:mmap" as dtFormatString %}

<form method="post">

<fieldset>
Expand All @@ -15,13 +17,13 @@

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="created">{{ help.created.title }}</label>
<input type="text" class="form-control" id="created" aria-describedby="createdDesc" value="{{ _(adminaccount.created) }}" readonly>
<input type="text" class="form-control" id="created" aria-describedby="createdDesc" value="{% sk_tzc adminaccount.created dtFormatString %}" readonly>
<small id="createdDesc" class="form-text text-muted">{{ help.created.text }}</small>
</div>

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="updated">{{ help.updated.title }}</label>
<input type="text" class="form-control" id="updated" aria-describedby="updatedDesc" value="{{ _(adminaccount.updated) }}" readonly>
<input type="text" class="form-control" id="updated" aria-describedby="updatedDesc" value="{% sk_tzc adminaccount.updated dtFormatString %}" readonly>
<small id="updatedDesc" class="form-text text-muted">{{ help.updated.text }}</small>
</div>

Expand Down
4 changes: 2 additions & 2 deletions templates/default/site/domain/add_account.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="validUntil">{{ help.validUntil.title }}</label>
<input type="text" id="validUntil" name="validUntil" class="form-control{% if validationErrors.validUntil.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DD HH:mm:ss") }}" value="{{ validUntil|default:"2998-12-31 23:59:59" }}" aria-describedby="validUntilDesc" pattern="^2\d{3}-[01]\d-[0123]\d\s[012]\d:[012345]\d:[012345]\d$" required>
<input type="datetime-local" id="validUntil" name="validUntil" class="form-control{% if validationErrors.validUntil.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DDTHH:mm") }}" value="{{ validUntil|default:"2998-12-31T23:59" }}" aria-describedby="validUntilDesc" pattern="^(2\d{3})-(0[1-9]|1[012])-(31|30|0[1-9]|[12][0-9])T([01][0-9]|2[0-3]):([0-5][0-9])$" required>
{% if validationErrors.validUntil.count %}<div class="invalid-feedback"><small>{{ validationErrors.validUntil.0 }}</small></div>{% endif %}
<small id="validUntilDesc" class="form-text text-muted">{{ help.validUntil.text }}</small>
</div>
Expand Down Expand Up @@ -74,7 +74,7 @@

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="passwordExpires">{{ help.passwordExpires.title }}</label>
<input type="text" id="passwordExpires" name="passwordExpires" class="form-control{% if validationErrors.passwordExpires.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DD hh:mm:ss") }}" value="{{ passwordExpiresString|default:"2998-12-31 23:59:59" }}" aria-describedby="passwordExpiresDesc" required>
<input type="datetime-local" id="passwordExpires" name="passwordExpires" class="form-control{% if validationErrors.passwordExpires.count %} is-invalid{% endif %}" placeholder="{{ _("YYYY-MM-DDThh:mm") }}" value="{{ passwordExpiresString|default:"2998-12-31T23:59" }}" aria-describedby="passwordExpiresDesc" pattern="^(2\d{3})-(0[1-9]|1[012])-(31|30|0[1-9]|[12][0-9])T([01][0-9]|2[0-3]):([0-5][0-9])$" required>
{% if validationErrors.passwordExpires.count %}<div class="invalid-feedback"><small>{{ validationErrors.passwordExpires.0 }}</small></div>{% endif %}
<small id="passwordExpiresDesc" class="form-text text-muted">{{ help.passwordExpires.text }}</small>
</div>
Expand Down
6 changes: 4 additions & 2 deletions templates/default/site/domain/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<div class="col"><h2><i class="fa fa-cube"></i> {{ _("Edit domain") }} <small class="text-muted">{{ domain.name }}</small></h2></div>
</div>

{% i18nc_var "Datetime format string to display created and updated times on edit pages" "MMMM d, yyyy hh:mmap" as dtFormatString %}

<form method="post">
<fieldset>
<div class="row mt-1">
Expand All @@ -14,13 +16,13 @@

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="created">{{ help.created.title }}</label>
<input type="text" readonly class="form-control" id="created" value="{{ _(domain.created) }}" aria-describedby="createdDesc">
<input type="text" readonly class="form-control" id="created" value="{% sk_tzc domain.created dtFormatString %}" aria-describedby="createdDesc">
<small id="createdDesc" class="form-text text-muted">{{ help.created.text }}</small>
</div>

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="updated">{{ help.updated.title }}</label>
<input type="text" readonly class="form-control" id="updated" value="{{ _(domain.updated) }}" aria-describedby="updatedDesc">
<input type="text" readonly class="form-control" id="updated" value="{% sk_tzc domain.updated dtFormatString %}" aria-describedby="updatedDesc">
<small id="updatedDesc" class="form-text text-muted">{{ help.updated.text }}</small>
</div>

Expand Down
6 changes: 4 additions & 2 deletions templates/default/site/myaccount/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
<div class="col"><h2><i class="fa fa-user"></i> {{ _("My admin account") }} <small class="text-muted">{{ adminaccount.username }}</small></h2></div>
</div>

{% i18nc_var "Datetime format string to display created and updated times on edit pages" "MMMM d, yyyy hh:mmap" as dtFormatString %}

<form method="post">
<fieldset>
<div class="row mt-1">

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="created">{{ help.created.title }}</label>
<input type="text" id="created" class="form-control" value="{{ _(adminaccount.created) }}" aria-describedby="createdDesc" readonly>
<input type="text" id="created" class="form-control" value="{% sk_tzc adminaccount.created dtFormatString %}" aria-describedby="createdDesc" readonly>
<small id="createdDesc" class="form-text text-muted">{{ help.created.text }}</small>
</div>

<div class="form-group col-12 col-sm-12 col-md-6 col-lg-4">
<label class="col-form-label" for="updated">{{ help.updated.title }}</label>
<input type="text" id="updated" class="form-control" value="{{ _(adminaccount.updated) }}" aria-describedby="updatedDesc" readonly>
<input type="text" id="updated" class="form-control" value="{% sk_tzc adminaccount.updated dtFormatString %}" aria-describedby="updatedDesc" readonly>
<small id="updatedDesc" class="form-text text-muted">{{ help.updated.text }}</small>
</div>

Expand Down

0 comments on commit 6c50aa2

Please sign in to comment.