From a961100556e5a8aa301261f08319c54bc49ace59 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 15 Apr 2014 23:58:57 -0400 Subject: [PATCH] Improve milestone listing and include closed milestones --- .../java/com/gitblit/wicket/WicketUtils.java | 5 ++- .../com/gitblit/wicket/pages/TicketsPage.html | 4 +-- .../com/gitblit/wicket/pages/TicketsPage.java | 31 ++++++++++++++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/WicketUtils.java b/src/main/java/com/gitblit/wicket/WicketUtils.java index 8598447e..2a34ca80 100644 --- a/src/main/java/com/gitblit/wicket/WicketUtils.java +++ b/src/main/java/com/gitblit/wicket/WicketUtils.java @@ -587,10 +587,13 @@ public class WicketUtils { if (TimeUtils.isToday(date, timeZone)) { title = timeUtils.today(); } else if (TimeUtils.isYesterday(date, timeZone)) { - title = timeUtils.yesterday(); + title = timeUtils.yesterday(); } else if (date.getTime() <= System.currentTimeMillis()) { // past title = timeUtils.timeAgo(date); + } else { + // future + title = timeUtils.inFuture(date); } if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) { String tmp = dateString; diff --git a/src/main/java/com/gitblit/wicket/pages/TicketsPage.html b/src/main/java/com/gitblit/wicket/pages/TicketsPage.html index 07e6563f..7d13852b 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketsPage.html +++ b/src/main/java/com/gitblit/wicket/pages/TicketsPage.html @@ -139,9 +139,9 @@
-
+

- +
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java index 3e8e4edd..ca509e28 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java @@ -164,6 +164,9 @@ public class TicketsPage extends TicketBasePage { if (currentMilestone == null) { // milestone not found, create a temporary one currentMilestone = new TicketMilestone(milestoneParam); + String q = QueryBuilder.q(Lucene.rid.matches(getRepositoryModel().getRID())).and(Lucene.milestone.matches(milestoneParam)).build(); + currentMilestone.tickets = app().tickets().queryFor(q, 1, 0, Lucene.number.name(), true); + milestones.add(currentMilestone); } } @@ -643,15 +646,35 @@ public class TicketsPage extends TicketBasePage { }; add(ticketsView); - DataView milestonesList = new DataView("milestoneList", milestonesDp) { + List allMilestones = app().tickets().getMilestones(getRepositoryModel()); + ListDataProvider allMilestonesDp = new ListDataProvider(allMilestones); + DataView milestonesList = new DataView("milestoneList", allMilestonesDp) { private static final long serialVersionUID = 1L; @Override public void populateItem(final Item item) { final TicketMilestone tm = item.getModelObject(); - item.add(new Label("milestoneName", tm.name)); - item.add(new Label("milestoneState", tm.status.name())); - item.add(new Label("milestoneDue", tm.due == null ? getString("gb.notSpecified") : tm.due.toString())); + PageParameters params = queryParameters(null, tm.name, null, null, null, desc, 1); + item.add(new LinkPanel("milestoneName", null, tm.name, TicketsPage.class, params).setRenderBodyOnly(true)); + + String css; + switch (tm.status) { + case Open: + css = "aui-lozenge aui-lozenge-subtle"; + break; + default: + css = "aui-lozenge"; + break; + } + Label stateLabel = new Label("milestoneState", tm.status.name()); + WicketUtils.setCssClass(stateLabel, css); + item.add(stateLabel); + + if (tm.due == null) { + item.add(new Label("milestoneDue", getString("gb.notSpecified"))); + } else { + item.add(WicketUtils.createDatestampLabel("milestoneDue", tm.due, getTimeZone(), getTimeUtils())); + } } }; add(milestonesList); -- 2.39.5