Made sub-category marking simpler, use it in owned tasks display as well.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@931 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2002-11-12 22:50:54 +00:00
parent c59e9e406b
commit d45494e867
2 changed files with 24 additions and 5 deletions
@@ -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;
}
}
+6 -4
View File
@@ -37,6 +37,11 @@ $form.fixedHidden("task", "$task.taskId")
#else
#set ($rowcolor = "#EEEEEE")
#end
#if ($ocats.checkCategory($task.complexity))
<tr><td colspan="4" class="small">$task.complexity</td></tr>
#end
<tr bgcolor="$rowcolor"><td>
#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
</td></tr>
#set ($complexity = "")
#foreach ($task in $xtask.tasks)
<form action="index.wm">
$form.fixedHidden("task", "$task.taskId")
#if ($task.complexity != $complexity)
#set ($complexity = $task.complexity)
#if ($xcats.checkCategory($task.complexity))
<tr><td colspan="4" class="small">$task.complexity</td></tr>
#end