restored relative time display to a few pages where it was lost during i18n updates, closes #766

pull/803/head
Justin Richer 10 years ago
parent daee9266c5
commit 54bec32b7e

@ -82,10 +82,10 @@ manage.title=Management Console
approve.title=Approve Access approve.title=Approve Access
approve.error.not_granted=Access could not be granted. approve.error.not_granted=Access could not be granted.
approve.required_for=Approval Required for approve.required_for=Approval Required for
approve.dynamically_registered=This client was dynamically registered approve.dynamically_registered=This client was dynamically registered <span class="label label-info" id="registrationTime">{0}</span>.
approve.caution=Caution approve.caution=Caution
approve.caution.message.none=It has never been approved previously. approve.caution.message.none=It has <span class="label label-important">never</span> been approved previously.
approve.caution.message.singular=It has been approved <span class="label">{0}</span> time previously. approve.caution.message.singular=It has been approved <span class="label label-warning">{0}</span> time previously.
approve.caution.message.plural=It has been approved <span class="label">{0}</span> times previously. approve.caution.message.plural=It has been approved <span class="label">{0}</span> times previously.
approve.more_information=more information approve.more_information=more information
approve.home_page=Home page approve.home_page=Home page

@ -41,16 +41,15 @@
<div class="row"> <div class="row">
<div class="span5 offset1 well-small" style="text-align: left"> <div class="span5 offset1 well-small" style="text-align: left">
<c:if test="${ client.dynamicallyRegistered }"> <c:if test="${ client.dynamicallyRegistered }">
<fmt:formatDate type="both" value="${client.createdAt}" var="titleRegistrationTime"/>
<fmt:formatDate type="date" value="${client.createdAt}" var="registrationTime"/>
<c:choose> <c:choose>
<c:when test="${ gras }"> <c:when test="${ gras }">
<!-- client is "generally recognized as safe, display a more muted block --> <!-- client is "generally recognized as safe, display a more muted block -->
<div> <div>
<p class="alert alert-info"> <p class="alert alert-info">
<i class="icon-globe"></i> <i class="icon-globe"></i>
<spring:message code="approve.dynamically_registered"/> <spring:message code="approve.dynamically_registered"/>
<span id="registrationTime" title='<c:out value="${titleRegistrationTime}"/>'> <c:out value="${registrationTime}"/></span>.
</p> </p>
</div> </div>
</c:when> </c:when>
@ -60,8 +59,11 @@
<h4> <h4>
<i class="icon-globe"></i> <spring:message code="approve.caution"/>: <i class="icon-globe"></i> <spring:message code="approve.caution"/>:
</h4> </h4>
<spring:message code="approve.dynamically_registered"/>
<span id="registrationTime" title='<c:out value="${titleRegistrationTime}"/>'> <c:out value="${registrationTime}"/></span>. <p>
<spring:message code="approve.dynamically_registered" arguments="${ client.createdAt }"/>
</p>
<p>
<c:choose> <c:choose>
<c:when test="${count == 0}"> <c:when test="${count == 0}">
<spring:message code="approve.caution.message.none" arguments="${count}"/> <spring:message code="approve.caution.message.none" arguments="${count}"/>
@ -73,6 +75,7 @@
<spring:message code="approve.caution.message.plural" arguments="${count}"/> <spring:message code="approve.caution.message.plural" arguments="${count}"/>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</p>
</div> </div>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
@ -294,6 +297,25 @@ $(document).ready(function() {
$('#toggleMoreInformation i').attr('class', 'icon-chevron-down'); $('#toggleMoreInformation i').attr('class', 'icon-chevron-down');
} }
}); });
var creationDate = "<c:out value="${ client.createdAt }" />";
var displayCreationDate = $.t('approve.dynamically-registered-unkown');
var hoverCreationDate = "";
if (creationDate != null && moment(creationDate).isValid()) {
creationDate = moment(creationDate);
if (moment().diff(creationDate, 'months') < 6) {
displayCreationDate = creationDate.fromNow();
} else {
displayCreationDate = "on " + creationDate.format("LL");
}
hoverCreationDate = creationDate.format("LLL");
}
$('#registrationTime').html(displayCreationDate);
$('#registrationTime').attr('title', hoverCreationDate);
}); });
//--> //-->

@ -224,19 +224,19 @@ var ClientView = Backbone.View.extend({
render:function (eventName) { render:function (eventName) {
var creationDate = this.model.get('createdAt'); var creationDate = this.model.get('createdAt');
var displayCreationDate = "at an unknown time"; var displayCreationDate = $.t('client.client-table.unknown');
var hoverCreationDate = ""; var hoverCreationDate = "";
if (creationDate == null || !moment(creationDate).isValid()) { if (creationDate == null || !moment(creationDate).isValid()) {
displayCreationDate = "at an unknown time"; displayCreationDate = $.t('client.client-table.unknown');
hoverCreationDate = ""; hoverCreationDate = "";
} else { } else {
creationDate = moment(creationDate); creationDate = moment(creationDate);
if (moment().diff(creationDate, 'months') < 6) { if (moment().diff(creationDate, 'months') < 6) {
displayCreationDate = creationDate.fromNow(); displayCreationDate = creationDate.fromNow();
} else { } else {
displayCreationDate = "on " + creationDate.format("MMMM Do, YYYY"); displayCreationDate = "on " + creationDate.format("LL");
} }
hoverCreationDate = creationDate.format("MMMM Do, YYYY [at] h:mmA"); hoverCreationDate = creationDate.format("LLL");
} }

@ -158,6 +158,7 @@
"type": "Application Type", "type": "Application Type",
"type-native": "Native", "type-native": "Native",
"type-web": "Web", "type-web": "Web",
"unknown": "(Unknown)",
"user-info-crypto-algorithm": "User Info Endpoint Encryption Algorithm", "user-info-crypto-algorithm": "User Info Endpoint Encryption Algorithm",
"user-info-crypto-method": "User Info Endpoint Encryption Method", "user-info-crypto-method": "User Info Endpoint Encryption Method",
"user-info-signing-algorithm": "User Info Endpoint Signing Algorithm" "user-info-signing-algorithm": "User Info Endpoint Signing Algorithm"
@ -185,7 +186,8 @@
"no-redirect": "NO REDIRECT URI", "no-redirect": "NO REDIRECT URI",
"registered": "Registrered", "registered": "Registrered",
"search": "Search...", "search": "Search...",
"whitelist": "Whitelist" "whitelist": "Whitelist",
"unknown": "at an unknown time"
}, },
"manage": "Manage Clients", "manage": "Manage Clients",
"more-info": { "more-info": {
@ -335,5 +337,8 @@
"whitelist-table": { "whitelist-table": {
"no-sites": "There are no whitelisted sites. Use the <strong>whitelist</strong> button on the client management page to create one." "no-sites": "There are no whitelisted sites. Use the <strong>whitelist</strong> button on the client management page to create one."
} }
},
approve: {
"dynamically-registered-unknown": "at an unknown time"
} }
} }

@ -195,7 +195,11 @@
<div class="control-group" id="createdAt"> <div class="control-group" id="createdAt">
<label class="control-label" data-i18n="client.client-form.registered">Registered at</label> <label class="control-label" data-i18n="client.client-form.registered">Registered at</label>
<div class="controls"> <div class="controls">
<%-createdAt%> <% if (createdAt) { %>
<%-createdAt%>
<% } else { %>
<span data-i18n="client.client-form.unknown">Unknown</span>
<% } %>
</div> </div>
</div> </div>

Loading…
Cancel
Save