By default show only ten games from each category on the main page
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 05 Oct 2009 10:23:27 +0200
changeset 11926685a525ec8
parent 118 bbe71fd2f13b
child 120 6bf820453a5f
By default show only ten games from each category on the main page
freemarkerdor/pom.xml
freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt
     1.1 --- a/freemarkerdor/pom.xml	Thu Oct 01 10:50:29 2009 +0200
     1.2 +++ b/freemarkerdor/pom.xml	Mon Oct 05 10:23:27 2009 +0200
     1.3 @@ -10,7 +10,7 @@
     1.4    <groupId>org.apidesign</groupId>
     1.5    <artifactId>freemarkerdor</artifactId>
     1.6    <name>freemarkerdor</name>
     1.7 -  <version>1.30</version>
     1.8 +  <version>1.31</version>
     1.9    <url>http://maven.apache.org</url>
    1.10    <dependencies>
    1.11      <dependency>
     2.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Thu Oct 01 10:50:29 2009 +0200
     2.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Mon Oct 05 10:23:27 2009 +0200
     2.3 @@ -136,12 +136,12 @@
     2.4  
     2.5      @GET
     2.6      @Produces(MediaType.TEXT_HTML)
     2.7 -    public Viewable welcome() {
     2.8 +    public Viewable welcome(@QueryParam("maxItems") @DefaultValue("10") int maxItems) {
     2.9          Viewable v = checkLogin();
    2.10          if (v != null) {
    2.11              return v;
    2.12          }
    2.13 -        return welcomeImpl();
    2.14 +        return welcomeImpl("maxItems", maxItems);
    2.15      }
    2.16  
    2.17      @GET
    2.18 @@ -340,7 +340,7 @@
    2.19          );
    2.20  
    2.21          Client client = new Client();
    2.22 -        base = client.resource(new URI("http://localhost:" + port + "/api/"));
    2.23 +        base = client.resource(new URI("http://quoridor.xelfi.cz:" + 80 + "/api/"));
    2.24  
    2.25          final String baseUri = "http://localhost:" + port + "/";
    2.26          final HttpServer server = HttpServerFactory.create(baseUri, rc);
     3.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties	Thu Oct 01 10:50:29 2009 +0200
     3.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties	Mon Oct 05 10:23:27 2009 +0200
     3.3 @@ -24,6 +24,7 @@
     3.4  GAME_ALL=All games
     3.5  WHITE=White
     3.6  BLACK=Black
     3.7 +SEE_ALL=See all games
     3.8  
     3.9  NEXT=Next
    3.10  PREVIOUS=Prev
     4.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties	Thu Oct 01 10:50:29 2009 +0200
     4.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties	Mon Oct 05 10:23:27 2009 +0200
     4.3 @@ -41,6 +41,7 @@
     4.4  NEXT=Dal\u0161\u00ED
     4.5  PREVIOUS=P\u0159edchoz\u00ED
     4.6  LATEST=Posledn\u00ED
     4.7 +SEE_ALL=Seznam v\u0161ech her
     4.8  
     4.9  BOARD_VIEW=Pohled:
    4.10  BOARD_IMAGE=Obrovsk\u00FD
     5.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt	Thu Oct 01 10:50:29 2009 +0200
     5.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt	Mon Oct 05 10:23:27 2009 +0200
     5.3 @@ -4,6 +4,10 @@
     5.4    <#assign toWait = 0/>
     5.5    <#assign toWon = 0/>
     5.6    <#assign toLost = 0/>
     5.7 +  <#if ! maxItems??>
     5.8 +    <#assign maxItems = 10/>
     5.9 +  </#if>
    5.10 +  <#assign seeAll = false/>
    5.11    <#list doc.gameIds.* as g>
    5.12      <#if (g.@white = user && g.@status = "whiteMove") ||
    5.13           (g.@black = user && g.@status = "blackMove")
    5.14 @@ -51,6 +55,7 @@
    5.15        <#macro game game>
    5.16            ${bundle("gameWhiteBlack", game.@white?string, game.@black?string)} 
    5.17            <a href="/games/${game.@id}/"><@before (now - game.@modified?number)?int/></a>
    5.18 +          <#assign printed = printed + 1/>
    5.19        </#macro>
    5.20  
    5.21        <#if message?? >
    5.22 @@ -63,6 +68,7 @@
    5.23        <h5>${bundle.GAME_MOVE}</h5>
    5.24  
    5.25        <ol>
    5.26 +      <#assign printed = 0/>
    5.27        <#list doc.gameIds.* as g>
    5.28          <#if (g.@white = user && g.@status = "whiteMove") ||
    5.29               (g.@black = user && g.@status = "blackMove")
    5.30 @@ -70,6 +76,7 @@
    5.31              <li>
    5.32                  <@game g/>
    5.33              </li>
    5.34 +            <#if printed = maxItems><#assign seeAll=true/><#break/></#if>
    5.35          </#if>
    5.36        </#list>
    5.37        </ol>
    5.38 @@ -78,6 +85,7 @@
    5.39        <#if (toWait > 0)>
    5.40        <h5>${bundle.GAME_WAIT}</h5>
    5.41        <ol>
    5.42 +      <#assign printed = 0/>
    5.43        <#list doc.gameIds.* as g>
    5.44          <#if (g.@white = user && g.@status = "blackMove") ||
    5.45               (g.@black = user && g.@status = "whiteMove")
    5.46 @@ -85,6 +93,7 @@
    5.47              <li>
    5.48                  <@game g/>
    5.49              </li>
    5.50 +            <#if printed = maxItems><#assign seeAll=true/><#break/></#if>
    5.51          </#if>
    5.52        </#list>
    5.53        </ol>
    5.54 @@ -94,6 +103,7 @@
    5.55        <h5>${bundle.GAME_WON}</h5>
    5.56  
    5.57        <ol>
    5.58 +      <#assign printed = 0/>
    5.59        <#list doc.gameIds.* as g>
    5.60          <#if 
    5.61              (g.@white = user && g.@status = "whiteWon") ||
    5.62 @@ -102,6 +112,7 @@
    5.63              <li>
    5.64                  <@game g/>
    5.65              </li>
    5.66 +            <#if printed = maxItems><#assign seeAll=true/><#break/></#if>
    5.67          </#if>
    5.68        </#list>
    5.69        </ol>
    5.70 @@ -111,6 +122,7 @@
    5.71        <h5>${bundle.GAME_LOST}</h5>
    5.72  
    5.73        <ol>
    5.74 +      <#assign printed = 0/>
    5.75        <#list doc.gameIds.* as g>
    5.76          <#if
    5.77              (g.@white = user && g.@status = "blackWon") ||
    5.78 @@ -119,6 +131,7 @@
    5.79              <li>
    5.80                  <@game g/>
    5.81              </li>
    5.82 +            <#if printed = maxItems><#assign seeAll=true/><#break/></#if>
    5.83          </#if>
    5.84        </#list>
    5.85        </ol>
    5.86 @@ -133,12 +146,21 @@
    5.87        <h5>${bundle.GAME_ALL}</h5>
    5.88  
    5.89        <ol>
    5.90 +      <#assign printed = 0/>
    5.91        <#list doc.gameIds.* as g>
    5.92          <li>
    5.93              <@game g/>
    5.94          </li>
    5.95 +        <#if printed = maxItems><#assign seeAll=true/><#break/></#if>
    5.96        </#list>
    5.97        </ol>
    5.98 +
    5.99 +      <#if seeAll>
   5.100 +        <p>
   5.101 +        <a href="/?maxItems=1024">${bundle.SEE_ALL}</a>...
   5.102 +        </p>
   5.103 +      </#if>
   5.104 +
   5.105        <hr/>
   5.106        ${bundle("copyright", version)}
   5.107    </body>