Skip to content

Commit

Permalink
Moved from html to ftl to be more obvious.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gray Watson committed Apr 30, 2016
1 parent 7bb8950 commit 3b2deff
Show file tree
Hide file tree
Showing 22 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public static List<String> listPlayLists() {
if (parts.length > 0) {
parts[0] = parts[0].substring(2);
String last = parts[parts.length - 1];
parts[parts.length - 1] = last.substring(0, last.length() - 2);
int index = last.indexOf('\"');
if (index > 0) {
parts[parts.length - 1] = last.substring(0, index);
}
}
List<String> playlists = new ArrayList<String>();
for (String part : parts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ModelView root(@SessionParam HttpSession session) {
@WebMethod
public ModelView login() {
Map<String, Object> model = new HashMap<String, Object>();
model.put("initialized", (adminPassword != null));
model.put("initialized", (tracks != null));
return new ModelView(model, ViewConstants.ADMIN_LOGIN);
}

Expand Down Expand Up @@ -88,6 +88,7 @@ public ModelView playlists(@SessionParam HttpSession session) {
}
Map<String, Object> model = new HashMap<String, Object>();
model.put("playLists", AppleScriptUtil.listPlayLists());
model.put("initialized", false);
return new ModelView(model, ViewConstants.PLAYLISTS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public BinaryResult artwork(@QueryParam("id") int id) {
return new BinaryResult(contentType, artwork.getBytes());
}

@Path("/videos.html")
@Path("/videos.ftl")
@GET
@WebMethod
public ModelView all() {
Expand Down
31 changes: 15 additions & 16 deletions src/main/java/com/j256/itunesjukebox/web/ViewConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ public class ViewConstants {

private static final String CONTROLLER_ROOT = "/controller";

public static final String ROOT = CONTROLLER_ROOT + "/index.html";
public static final String ARTISTS_ALL = CONTROLLER_ROOT + "/artists/index.html";
public static final String ARTIST_TRACKS = CONTROLLER_ROOT + "/artists/tracks.html";
public static final String GENRES_ALL = CONTROLLER_ROOT + "/genres/index.html";
public static final String GENRE_TRACKS = CONTROLLER_ROOT + "/genres/tracks.html";
public static final String YEARS_ALL = CONTROLLER_ROOT + "/years/index.html";
public static final String YEAR_TRACKS = CONTROLLER_ROOT + "/years/tracks.html";
public static final String SONGS = CONTROLLER_ROOT + "/songs/index.html";
public static final String SONGS_ONE = CONTROLLER_ROOT + "/songs/one.html";
public static final String VIDEOS = CONTROLLER_ROOT + "/videos.html";
public static final String SEARCH = CONTROLLER_ROOT + "/search.html";
public static final String ROOT = CONTROLLER_ROOT + "/index.ftl";
public static final String ARTISTS_ALL = CONTROLLER_ROOT + "/artists/index.ftl";
public static final String ARTIST_TRACKS = CONTROLLER_ROOT + "/artists/tracks.ftl";
public static final String GENRES_ALL = CONTROLLER_ROOT + "/genres/index.ftl";
public static final String GENRE_TRACKS = CONTROLLER_ROOT + "/genres/tracks.ftl";
public static final String YEARS_ALL = CONTROLLER_ROOT + "/years/index.ftl";
public static final String YEAR_TRACKS = CONTROLLER_ROOT + "/years/tracks.ftl";
public static final String SONGS = CONTROLLER_ROOT + "/songs/index.ftl";
public static final String SONGS_ONE = CONTROLLER_ROOT + "/songs/one.ftl";
public static final String VIDEOS = CONTROLLER_ROOT + "/videos.ftl";

public static final String ADMIN = CONTROLLER_ROOT + "/admin/index.html";
public static final String ADMIN_LOGIN = CONTROLLER_ROOT + "/admin/login.html";
public static final String ADMIN_ERROR = CONTROLLER_ROOT + "/admin/error.html";
public static final String PLAYLISTS = CONTROLLER_ROOT + "/admin/playlists.html";
public static final String PLAYLIST_CHOSEN = CONTROLLER_ROOT + "/admin/chosen.html";
public static final String ADMIN = CONTROLLER_ROOT + "/admin/index.ftl";
public static final String ADMIN_LOGIN = CONTROLLER_ROOT + "/admin/login.ftl";
public static final String ADMIN_ERROR = CONTROLLER_ROOT + "/admin/error.ftl";
public static final String PLAYLISTS = CONTROLLER_ROOT + "/admin/playlists.ftl";
public static final String PLAYLIST_CHOSEN = CONTROLLER_ROOT + "/admin/chosen.ftl";
}
1 change: 1 addition & 0 deletions src/main/resources/com/j256/run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<property name="fileExtensionDisplayers">
<map>
<entry key="html" value-ref="freemarkerHtmlDisplayer" />
<entry key="ftl" value-ref="freemarkerHtmlDisplayer" />
</map>
</property>
</bean>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[#ftl][#include "/ftl/header.ftl"]

<table border="1" cellpadding="3">
<tr><th> Select playlist which holds the songs that will be played by the jukebox </th></tr>
<p> Select playlist which holds the songs that will be played by the jukebox </p>
<p style="line-height: 200%;">
[#list playLists as playList]
<tr><td> <a href="chosen?playList=${playList}">${playList}</a> </td></tr>
[/#list]
</table>
</p>

[#include "/ftl/footer.ftl"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/main/webapp/ftl/footer.ftl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[#ftl]
[#if initialized?? && initialized ]
<p> <a href="/" >Menu</a> <a href="/search.html" >Search</a> <a href="/songs/" >Tracks</a> </p>
<p> <a href="/artists/" >Artists</a> <a href="/genres/" >Genres</a> <a href="/videos.html" >Videos</a> </p>
[#if (! initialized??) || initialized ]
<p> <a href="/" >Menu</a> <a href="/search.ftl" >Search</a> <a href="/songs/" >Tracks</a> </p>
<p> <a href="/artists/" >Artists</a> <a href="/genres/" >Genres</a> <a href="/videos.ftl" >Videos</a> </p>
<p> <a href="/years/" >Years</a> <a href="/songs/played" >Played</a> </p>

[#if endLinks?has_content ]
Expand Down
File renamed without changes.

0 comments on commit 3b2deff

Please sign in to comment.