<div class="row">\r
<span class="span12" style="padding-bottom:10px;" wicket:id="newMilestone"></span>\r
</div>\r
+\r
+ <div class="row">\r
+ <div class="span12"><h2><wicket:message key="gb.openMilestones"></wicket:message></h2></div>\r
+ <div class="span12"><hr/></div>\r
+ </div> \r
+ <div class="row">\r
+ <div class="span4" wicket:id="openMilestonesList" style="padding-bottom: 20px;">\r
+ <div wicket:id="entryPanel"></div>\r
+ </div>\r
+ </div>\r
+\r
<div class="row">\r
- <div class="span9" wicket:id="milestoneList" style="padding-bottom: 10px;">\r
- <h3><span wicket:id="milestoneName"></span> <small><span wicket:id="milestoneState"></span></small></h3>\r
- <i style="color:#888;"class="fa fa-calendar"></i> <span wicket:id="milestoneDue"></span> <span wicket:id="editMilestone"></span>\r
+ <div class="span12"><h2><wicket:message key="gb.closedMilestones"></wicket:message></h2></div>\r
+ <div class="span12"><hr/></div>\r
+ </div> \r
+ <div class="row">\r
+ <div class="span4" wicket:id="closedMilestonesList" style="padding-bottom: 15px;">\r
+ <div wicket:id="entryPanel"></div>\r
</div>\r
</div>\r
+ \r
</div>\r
</div>\r
\r
+<wicket:fragment wicket:id="milestoneListFragment">\r
+ <h3><span wicket:id="milestoneName"></span> <small><span wicket:id="milestoneState"></span></small></h3>\r
+ <i style="color:#888;"class="fa fa-calendar"></i> <span wicket:id="milestoneDue"></span> <span wicket:id="editMilestone"></span>\r
+ <div wicket:id="milestonePanel"></div>\r
+</wicket:fragment>\r
+\r
+<wicket:fragment wicket:id="openMilestoneFragment">\r
+ <div style="clear:both;padding-bottom: 10px;">\r
+ <div style="margin-bottom: 5px;" class="progress progress-success">\r
+ <div class="bar" wicket:id="progress"></div>\r
+ </div>\r
+ <div class="milestoneOverview">\r
+ <span wicket:id="openTickets" />,\r
+ <span wicket:id="closedTickets" />,\r
+ <span wicket:id="totalTickets" />\r
+ </div>\r
+ </div>\r
+</wicket:fragment>\r
+\r
<wicket:fragment wicket:id="noMilestoneFragment">\r
<table style="width: 100%;padding-bottom: 5px;">\r
<tbody>\r
}\r
\r
// milestones list\r
- List<TicketMilestone> allMilestones = new ArrayList<TicketMilestone>(app().tickets().getMilestones(repositoryModel));\r
- Collections.sort(allMilestones, new Comparator<TicketMilestone>() {\r
+ List<TicketMilestone> openMilestones = new ArrayList<TicketMilestone>();\r
+ List<TicketMilestone> closedMilestones = new ArrayList<TicketMilestone>();\r
+ for (TicketMilestone milestone : app().tickets().getMilestones(repositoryModel)) {\r
+ if (milestone.isOpen()) {\r
+ openMilestones.add(milestone);\r
+ } else {\r
+ closedMilestones.add(milestone);\r
+ }\r
+ }\r
+ Collections.sort(openMilestones, new Comparator<TicketMilestone>() {\r
+ @Override\r
+ public int compare(TicketMilestone o1, TicketMilestone o2) {\r
+ return o2.due.compareTo(o1.due);\r
+ }\r
+ });\r
+\r
+ Collections.sort(closedMilestones, new Comparator<TicketMilestone>() {\r
@Override\r
public int compare(TicketMilestone o1, TicketMilestone o2) {\r
- if (o2.isOpen() && !o1.isOpen()) {\r
- return 1;\r
- } else if (o1.isOpen() && !o2.isOpen()) {\r
- return -1;\r
- }\r
return o2.due.compareTo(o1.due);\r
}\r
});\r
- ListDataProvider<TicketMilestone> allMilestonesDp = new ListDataProvider<TicketMilestone>(allMilestones);\r
- DataView<TicketMilestone> milestonesList = new DataView<TicketMilestone>("milestoneList", allMilestonesDp) {\r
+\r
+ DataView<TicketMilestone> openMilestonesList = milestoneList("openMilestonesList", openMilestones, acceptingUpdates);\r
+ add(openMilestonesList);\r
+\r
+ DataView<TicketMilestone> closedMilestonesList = milestoneList("closedMilestonesList", closedMilestones, acceptingUpdates);\r
+ add(closedMilestonesList);\r
+ }\r
+\r
+ protected DataView<TicketMilestone> milestoneList(String wicketId, List<TicketMilestone> milestones, final boolean acceptingUpdates) {\r
+ ListDataProvider<TicketMilestone> milestonesDp = new ListDataProvider<TicketMilestone>(milestones);\r
+ DataView<TicketMilestone> milestonesList = new DataView<TicketMilestone>(wicketId, milestonesDp) {\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
public void populateItem(final Item<TicketMilestone> item) {\r
+ Fragment entryPanel = new Fragment("entryPanel", "milestoneListFragment", this);\r
+ item.add(entryPanel);\r
+\r
final TicketMilestone tm = item.getModelObject();\r
- PageParameters params = queryParameters(null, tm.name, null, null, null, desc, 1);\r
- item.add(new LinkPanel("milestoneName", null, tm.name, TicketsPage.class, params).setRenderBodyOnly(true));\r
+ PageParameters params = queryParameters(null, tm.name, null, null, null, true, 1);\r
+ entryPanel.add(new LinkPanel("milestoneName", null, tm.name, TicketsPage.class, params).setRenderBodyOnly(true));\r
\r
String css;\r
String status = tm.status.name();\r
}\r
Label stateLabel = new Label("milestoneState", status);\r
WicketUtils.setCssClass(stateLabel, css);\r
- item.add(stateLabel);\r
+ entryPanel.add(stateLabel);\r
\r
if (tm.due == null) {\r
- item.add(new Label("milestoneDue", getString("gb.notSpecified")));\r
+ entryPanel.add(new Label("milestoneDue", getString("gb.notSpecified")));\r
} else {\r
- item.add(WicketUtils.createDatestampLabel("milestoneDue", tm.due, getTimeZone(), getTimeUtils()));\r
+ entryPanel.add(WicketUtils.createDatestampLabel("milestoneDue", tm.due, getTimeZone(), getTimeUtils()));\r
}\r
if (acceptingUpdates) {\r
- item.add(new LinkPanel("editMilestone", null, getString("gb.edit"), EditMilestonePage.class,\r
+ entryPanel.add(new LinkPanel("editMilestone", null, getString("gb.edit"), EditMilestonePage.class,\r
WicketUtils.newObjectParameter(repositoryName, tm.name)));\r
} else {\r
- item.add(new Label("editMilestone").setVisible(false));\r
+ entryPanel.add(new Label("editMilestone").setVisible(false));\r
+ }\r
+\r
+ if (tm.isOpen()) {\r
+ // re-load milestone with query results\r
+ TicketMilestone m = app().tickets().getMilestone(getRepositoryModel(), tm.name);\r
+\r
+ Fragment milestonePanel = new Fragment("milestonePanel", "openMilestoneFragment", this);\r
+ Label label = new Label("progress");\r
+ WicketUtils.setCssStyle(label, "width:" + tm.getProgress() + "%;");\r
+ milestonePanel.add(label);\r
+\r
+ milestonePanel.add(new LinkPanel("openTickets", null,\r
+ MessageFormat.format(getString("gb.nOpenTickets"), m.getOpenTickets()),\r
+ TicketsPage.class,\r
+ queryParameters(null, tm.name, openStatii, null, null, true, 1)));\r
+\r
+ milestonePanel.add(new LinkPanel("closedTickets", null,\r
+ MessageFormat.format(getString("gb.nClosedTickets"), m.getClosedTickets()),\r
+ TicketsPage.class,\r
+ queryParameters(null, tm.name, closedStatii, null, null, true, 1)));\r
+\r
+ milestonePanel.add(new Label("totalTickets", MessageFormat.format(getString("gb.nTotalTickets"), m.getTotalTickets())));\r
+ entryPanel.add(milestonePanel);\r
+ } else {\r
+ entryPanel.add(new Label("milestonePanel").setVisible(false));\r
}\r
}\r
};\r
- add(milestonesList);\r
+ return milestonesList;\r
}\r
\r
protected PageParameters queryParameters(\r