Merge pull request #352 from levivm/feature/added_localtime
Feature/added localtime The time shows up fine on the VM order confirmation and the ssh keys page both on chrome and firefox.
This commit is contained in:
commit
381ac1fea0
4 changed files with 40 additions and 4 deletions
|
@ -162,6 +162,12 @@
|
||||||
<!-- Gen SSH Key lib -->
|
<!-- Gen SSH Key lib -->
|
||||||
<script type="text/javascript" src="{% static 'hosting/js/gen-ssh-key.js' %}"></script>
|
<script type="text/javascript" src="{% static 'hosting/js/gen-ssh-key.js' %}"></script>
|
||||||
|
|
||||||
|
<!-- Moment -->
|
||||||
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
|
||||||
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<div class="col-xs-6 text-right">
|
<div class="col-xs-6 text-right">
|
||||||
<address>
|
<address>
|
||||||
<strong>{% trans "Date"%}:</strong><br>
|
<strong>{% trans "Date"%}:</strong><br>
|
||||||
{{order.created_at}}<br><br>
|
<span id="order-created_at">{{order.created_at|date:'Y-m-d H:i'}}</span><br><br>
|
||||||
<strong>{% trans "Status:"%}</strong><br>
|
<strong>{% trans "Status:"%}</strong><br>
|
||||||
<strong class="{% if order.status == 'Approved' %}text-success
|
<strong class="{% if order.status == 'Approved' %}text-success
|
||||||
{%else%} text-danger
|
{%else%} text-danger
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
<hr>
|
<hr>
|
||||||
<p><b>{% trans "Disk space"%}</b> <span class="pull-right">{{vm.disk_size}} GB</span></p>
|
<p><b>{% trans "Disk space"%}</b> <span class="pull-right">{{vm.disk_size}} GB</span></p>
|
||||||
<hr>
|
<hr>
|
||||||
<h4>{% trans "Total"%}<p class="pull-right"><b>{{vm.price}} CHF</b></p></h4>
|
<h4>{% trans "Total"%}<p class="pull-right"><b>{{vm.price}} CHF</b></p></h4>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
{% url 'hosting:payment' as payment_url %}
|
{% url 'hosting:payment' as payment_url %}
|
||||||
|
@ -81,4 +81,17 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
window.onload = function () {
|
||||||
|
var locale_date = moment.utc(document.getElementById("order-created_at").textContent,'YYYY-MM-DD HH:mm').toDate();
|
||||||
|
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
|
||||||
|
document.getElementById('order-created_at').innerHTML = locale_date;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
{%endblock%}
|
{%endblock%}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{% for order in orders %}
|
{% for order in orders %}
|
||||||
<tr>
|
<tr>
|
||||||
<td scope="row">{{ order.id }}</td>
|
<td scope="row">{{ order.id }}</td>
|
||||||
<td>{{ order.created_at }}</td>
|
<td>{{ order.created_at | date:"M d, Y" }}</td>
|
||||||
<td>{{ order.price }} CHF</td>
|
<td>{{ order.price }} CHF</td>
|
||||||
<td>{% if order.approved %}
|
<td>{% if order.approved %}
|
||||||
<span class="text-success strong">{% trans "Approved"%}</span>
|
<span class="text-success strong">{% trans "Approved"%}</span>
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
{% for user_key in keys %}
|
{% for user_key in keys %}
|
||||||
<tr>
|
<tr>
|
||||||
<td scope="row">{{user_key.name}}</td>
|
<td scope="row">{{user_key.name}}</td>
|
||||||
<td>{{user_key.created_at}}</td>
|
|
||||||
|
<td><span id="ssh-created_at-{{user_key.id}}">{{user_key.created_at|date:'Y-m-d H:i' }}</span></td>
|
||||||
<td>
|
<td>
|
||||||
<span class="h3 label label-success"><strong>Active</strong></span>
|
<span class="h3 label label-success"><strong>Active</strong></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -92,5 +93,21 @@
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
window.onload = function () {
|
||||||
|
{% for user_key in keys %}
|
||||||
|
// var locale_date = new Date(document.getElementById("ssh-created_at-{{user_key.id}}").textContent).toISOString();
|
||||||
|
var locale_date = moment.utc(document.getElementById("ssh-created_at-{{user_key.id}}").textContent,'YYYY-MM-DD HH:mm').toDate();
|
||||||
|
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
|
||||||
|
document.getElementById('ssh-created_at-{{user_key.id}}').innerHTML = locale_date;
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{%endblock%}
|
{%endblock%}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue