diff --git a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java index 705468c3..de2c268c 100644 --- a/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java +++ b/runtime/twodue/src/java/com/samskivert/twodue/logic/index.java @@ -1,5 +1,5 @@ // -// $Id: index.java,v 1.5 2002/11/12 22:35:33 mdb Exp $ +// $Id: index.java,v 1.6 2002/11/12 22:50:54 mdb Exp $ package com.samskivert.twodue.logic; @@ -112,6 +112,7 @@ public class index extends UserLogic } }); ctx.put("xtasks", xtasks); + ctx.put("xcats", new CategoryTool()); if (!StringUtil.blank(query) && xtasks.length == 0) { ctx.put("error", "index.error.no_matching_tasks"); @@ -126,6 +127,7 @@ public class index extends UserLogic } }); ctx.put("otasks", otasks); + ctx.put("ocats", new CategoryTool()); // load up recently completed tasks tasks = app.getRepository().loadCompletedTasks(0, 6); @@ -197,4 +199,19 @@ public class index extends UserLogic } } }; + + // used to easy category generation in UI + public static class CategoryTool + { + public boolean checkCategory (String category) + { + if (category.equals(_category)) { + return false; + } else { + _category = category; + return true; + } + } + protected String _category; + } } diff --git a/runtime/twodue/web/index.wm b/runtime/twodue/web/index.wm index f45e2d4f..7a804c6e 100644 --- a/runtime/twodue/web/index.wm +++ b/runtime/twodue/web/index.wm @@ -37,6 +37,11 @@ $form.fixedHidden("task", "$task.taskId") #else #set ($rowcolor = "#EEEEEE") #end + +#if ($ocats.checkCategory($task.complexity)) +$task.complexity +#end + #if ($username == $task.owner) $form.imageSubmit("submit", "", "images/complete.png", "Mark as completed") @@ -72,14 +77,11 @@ $form.imageSubmit("submit", "", "images/complete.png", "Mark as completed") #end -#set ($complexity = "") - #foreach ($task in $xtask.tasks)
$form.fixedHidden("task", "$task.taskId") -#if ($task.complexity != $complexity) -#set ($complexity = $task.complexity) +#if ($xcats.checkCategory($task.complexity)) $task.complexity #end