Fixed a regression based on the ServiceType toString implementation.
The DB code relied on the ServiceType toString matching the enum name. Moved the displayable value to a dedicated field and reference it in the UI.
This commit is contained in:
parent
73be769483
commit
fb722a898e
@ -3,9 +3,9 @@ package com.jdbernard.nlsongs.model;
|
|||||||
public enum ServiceType {
|
public enum ServiceType {
|
||||||
SUN_AM("Sunday AM"), SUN_PM("Sunday PM"), WED("Wednesday");
|
SUN_AM("Sunday AM"), SUN_PM("Sunday PM"), WED("Wednesday");
|
||||||
|
|
||||||
private String displayName;
|
private final String displayName;
|
||||||
|
|
||||||
ServiceType(String displayName) { this.displayName = displayName; }
|
ServiceType(String displayName) { this.displayName = displayName; }
|
||||||
|
|
||||||
@Override public String toString() { return this.displayName; }
|
public String getDisplayName() { return this.displayName; }
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ if (!service) { response.sendError(response.SC_NOT_FOUND); return }
|
|||||||
<link rel="shortcut icon" href="../images/favicon.ico">
|
<link rel="shortcut icon" href="../images/favicon.ico">
|
||||||
|
|
||||||
<title><%= service.@date.toString("yyyy-MM-dd")
|
<title><%= service.@date.toString("yyyy-MM-dd")
|
||||||
%> (<%= service.serviceType%>) - New Life Songs Database</title>
|
%> (<%= service.serviceType.displayName %>) - New Life Songs Database</title>
|
||||||
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||||
<!--<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>-->
|
<!--<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>-->
|
||||||
<!--<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>-->
|
<!--<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>-->
|
||||||
@ -34,9 +34,9 @@ if (!service) { response.sendError(response.SC_NOT_FOUND); return }
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1>New Life Songs</h1>
|
<h1><a href="../">New Life Songs</a></h1>
|
||||||
<h2><%= service.@date.toString("yyyy-MM-dd") %> (<%=
|
<h2 class=service-date><%= service.@date.toString("yyyy-MM-dd") %> (<%=
|
||||||
service.serviceType %>)</h2>
|
service.serviceType.displayName %>)</h2>
|
||||||
|
|
||||||
<nav><ul>
|
<nav><ul>
|
||||||
<li><a href="../admin/">Admin</a></li>
|
<li><a href="../admin/">Admin</a></li>
|
||||||
|
@ -41,13 +41,9 @@ songsDB = NLSongsContext.songsDB
|
|||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% songsDB.findAllServices().sort { it.date }.reverse().each { service -> %>
|
<% songsDB.findAllServices().sort { it.date }.reverse().each { service -> %>
|
||||||
<tr><td><a href="../service/<%= service.id %>"><%=
|
<tr><td class=date><a href="../service/<%= service.id %>"><%=
|
||||||
service.@date.toString("yyyy-MM-dd") %></a></td>
|
service.@date.toString("yyyy-MM-dd") %></a></td>
|
||||||
<td><% switch (service.serviceType) {
|
<td class=service-type><%= service.serviceType.displayName %></td></tr><% } %>
|
||||||
case SUN_PM: out.print("Sunday PM"); break
|
|
||||||
case SUN_AM: out.print("Sunday AM"); break
|
|
||||||
case WED: out.print("Wednesday"); break }
|
|
||||||
%></td></tr><% } %>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot><tr>
|
<tfoot><tr>
|
||||||
<th class="dt-left">Date</th>
|
<th class="dt-left">Date</th>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user