Browse Source

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
commit
54bec32b7e
  1. 6
      openid-connect-server-webapp/src/main/resources/messages_en.properties
  2. 32
      openid-connect-server-webapp/src/main/webapp/WEB-INF/views/approve.jsp
  3. 8
      openid-connect-server-webapp/src/main/webapp/resources/js/client.js
  4. 7
      openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json
  5. 6
      openid-connect-server-webapp/src/main/webapp/resources/template/client.html

6
openid-connect-server-webapp/src/main/resources/messages_en.properties

@ -82,10 +82,10 @@ manage.title=Management Console
approve.title=Approve Access
approve.error.not_granted=Access could not be granted.
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.message.none=It has never been approved previously.
approve.caution.message.singular=It has been approved <span class="label">{0}</span> time 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 label-warning">{0}</span> time previously.
approve.caution.message.plural=It has been approved <span class="label">{0}</span> times previously.
approve.more_information=more information
approve.home_page=Home page

32
openid-connect-server-webapp/src/main/webapp/WEB-INF/views/approve.jsp

@ -41,16 +41,15 @@
<div class="row">
<div class="span5 offset1 well-small" style="text-align: left">
<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:when test="${ gras }">
<!-- client is "generally recognized as safe, display a more muted block -->
<div>
<p class="alert alert-info">
<i class="icon-globe"></i>
<spring:message code="approve.dynamically_registered"/>
<span id="registrationTime" title='<c:out value="${titleRegistrationTime}"/>'> <c:out value="${registrationTime}"/></span>.
</p>
</div>
</c:when>
@ -60,8 +59,11 @@
<h4>
<i class="icon-globe"></i> <spring:message code="approve.caution"/>:
</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:when test="${count == 0}">
<spring:message code="approve.caution.message.none" arguments="${count}"/>
@ -73,6 +75,7 @@
<spring:message code="approve.caution.message.plural" arguments="${count}"/>
</c:otherwise>
</c:choose>
</p>
</div>
</c:otherwise>
</c:choose>
@ -294,6 +297,25 @@ $(document).ready(function() {
$('#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);
});
//-->

8
openid-connect-server-webapp/src/main/webapp/resources/js/client.js

@ -224,19 +224,19 @@ var ClientView = Backbone.View.extend({
render:function (eventName) {
var creationDate = this.model.get('createdAt');
var displayCreationDate = "at an unknown time";
var displayCreationDate = $.t('client.client-table.unknown');
var hoverCreationDate = "";
if (creationDate == null || !moment(creationDate).isValid()) {
displayCreationDate = "at an unknown time";
displayCreationDate = $.t('client.client-table.unknown');
hoverCreationDate = "";
} else {
creationDate = moment(creationDate);
if (moment().diff(creationDate, 'months') < 6) {
displayCreationDate = creationDate.fromNow();
} 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");
}

7
openid-connect-server-webapp/src/main/webapp/resources/js/locale/en/messages.json

@ -158,6 +158,7 @@
"type": "Application Type",
"type-native": "Native",
"type-web": "Web",
"unknown": "(Unknown)",
"user-info-crypto-algorithm": "User Info Endpoint Encryption Algorithm",
"user-info-crypto-method": "User Info Endpoint Encryption Method",
"user-info-signing-algorithm": "User Info Endpoint Signing Algorithm"
@ -185,7 +186,8 @@
"no-redirect": "NO REDIRECT URI",
"registered": "Registrered",
"search": "Search...",
"whitelist": "Whitelist"
"whitelist": "Whitelist",
"unknown": "at an unknown time"
},
"manage": "Manage Clients",
"more-info": {
@ -335,5 +337,8 @@
"whitelist-table": {
"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"
}
}

6
openid-connect-server-webapp/src/main/webapp/resources/template/client.html

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

Loading…
Cancel
Save