diff options
author | James Moger <james.moger@gitblit.com> | 2014-04-30 17:15:31 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-05-01 14:31:18 -0400 |
commit | 8d2caa7e81fcd995f0a5c07fa4454ae2f8e86e6e (patch) | |
tree | 62859416ec505af5b5a68b8dfcd7f39eaa8c4aea /src/main/java/com/gitblit/wicket/pages | |
parent | 667163976e4e51fc3ebf191525e44d97c8a724dc (diff) | |
download | gitblit-8d2caa7e81fcd995f0a5c07fa4454ae2f8e86e6e.tar.gz gitblit-8d2caa7e81fcd995f0a5c07fa4454ae2f8e86e6e.zip |
Show open milestone progress and change milestones list layout
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/TicketsPage.html | 40 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/TicketsPage.java | 81 |
2 files changed, 101 insertions, 20 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketsPage.html b/src/main/java/com/gitblit/wicket/pages/TicketsPage.html index e144bea1..a40d3126 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketsPage.html +++ b/src/main/java/com/gitblit/wicket/pages/TicketsPage.html @@ -141,15 +141,49 @@ <div class="row">
<span class="span12" style="padding-bottom:10px;" wicket:id="newMilestone"></span>
</div>
+
+ <div class="row">
+ <div class="span12"><h2><wicket:message key="gb.openMilestones"></wicket:message></h2></div>
+ <div class="span12"><hr/></div>
+ </div>
+ <div class="row">
+ <div class="span4" wicket:id="openMilestonesList" style="padding-bottom: 20px;">
+ <div wicket:id="entryPanel"></div>
+ </div>
+ </div>
+
<div class="row">
- <div class="span9" wicket:id="milestoneList" style="padding-bottom: 10px;">
- <h3><span wicket:id="milestoneName"></span> <small><span wicket:id="milestoneState"></span></small></h3>
- <i style="color:#888;"class="fa fa-calendar"></i> <span wicket:id="milestoneDue"></span> <span wicket:id="editMilestone"></span>
+ <div class="span12"><h2><wicket:message key="gb.closedMilestones"></wicket:message></h2></div>
+ <div class="span12"><hr/></div>
+ </div>
+ <div class="row">
+ <div class="span4" wicket:id="closedMilestonesList" style="padding-bottom: 15px;">
+ <div wicket:id="entryPanel"></div>
</div>
</div>
+
</div>
</div>
+<wicket:fragment wicket:id="milestoneListFragment">
+ <h3><span wicket:id="milestoneName"></span> <small><span wicket:id="milestoneState"></span></small></h3>
+ <i style="color:#888;"class="fa fa-calendar"></i> <span wicket:id="milestoneDue"></span> <span wicket:id="editMilestone"></span>
+ <div wicket:id="milestonePanel"></div>
+</wicket:fragment>
+
+<wicket:fragment wicket:id="openMilestoneFragment">
+ <div style="clear:both;padding-bottom: 10px;">
+ <div style="margin-bottom: 5px;" class="progress progress-success">
+ <div class="bar" wicket:id="progress"></div>
+ </div>
+ <div class="milestoneOverview">
+ <span wicket:id="openTickets" />,
+ <span wicket:id="closedTickets" />,
+ <span wicket:id="totalTickets" />
+ </div>
+ </div>
+</wicket:fragment>
+
<wicket:fragment wicket:id="noMilestoneFragment">
<table style="width: 100%;padding-bottom: 5px;">
<tbody>
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java index b7e392a2..5973d473 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java @@ -660,27 +660,49 @@ public class TicketsPage extends TicketBasePage { }
// milestones list
- List<TicketMilestone> allMilestones = new ArrayList<TicketMilestone>(app().tickets().getMilestones(repositoryModel));
- Collections.sort(allMilestones, new Comparator<TicketMilestone>() {
+ List<TicketMilestone> openMilestones = new ArrayList<TicketMilestone>();
+ List<TicketMilestone> closedMilestones = new ArrayList<TicketMilestone>();
+ for (TicketMilestone milestone : app().tickets().getMilestones(repositoryModel)) {
+ if (milestone.isOpen()) {
+ openMilestones.add(milestone);
+ } else {
+ closedMilestones.add(milestone);
+ }
+ }
+ Collections.sort(openMilestones, new Comparator<TicketMilestone>() {
+ @Override
+ public int compare(TicketMilestone o1, TicketMilestone o2) {
+ return o2.due.compareTo(o1.due);
+ }
+ });
+
+ Collections.sort(closedMilestones, new Comparator<TicketMilestone>() {
@Override
public int compare(TicketMilestone o1, TicketMilestone o2) {
- if (o2.isOpen() && !o1.isOpen()) {
- return 1;
- } else if (o1.isOpen() && !o2.isOpen()) {
- return -1;
- }
return o2.due.compareTo(o1.due);
}
});
- ListDataProvider<TicketMilestone> allMilestonesDp = new ListDataProvider<TicketMilestone>(allMilestones);
- DataView<TicketMilestone> milestonesList = new DataView<TicketMilestone>("milestoneList", allMilestonesDp) {
+
+ DataView<TicketMilestone> openMilestonesList = milestoneList("openMilestonesList", openMilestones, acceptingUpdates);
+ add(openMilestonesList);
+
+ DataView<TicketMilestone> closedMilestonesList = milestoneList("closedMilestonesList", closedMilestones, acceptingUpdates);
+ add(closedMilestonesList);
+ }
+
+ protected DataView<TicketMilestone> milestoneList(String wicketId, List<TicketMilestone> milestones, final boolean acceptingUpdates) {
+ ListDataProvider<TicketMilestone> milestonesDp = new ListDataProvider<TicketMilestone>(milestones);
+ DataView<TicketMilestone> milestonesList = new DataView<TicketMilestone>(wicketId, milestonesDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<TicketMilestone> item) {
+ Fragment entryPanel = new Fragment("entryPanel", "milestoneListFragment", this);
+ item.add(entryPanel);
+
final TicketMilestone tm = item.getModelObject();
- PageParameters params = queryParameters(null, tm.name, null, null, null, desc, 1);
- item.add(new LinkPanel("milestoneName", null, tm.name, TicketsPage.class, params).setRenderBodyOnly(true));
+ PageParameters params = queryParameters(null, tm.name, null, null, null, true, 1);
+ entryPanel.add(new LinkPanel("milestoneName", null, tm.name, TicketsPage.class, params).setRenderBodyOnly(true));
String css;
String status = tm.status.name();
@@ -699,22 +721,47 @@ public class TicketsPage extends TicketBasePage { }
Label stateLabel = new Label("milestoneState", status);
WicketUtils.setCssClass(stateLabel, css);
- item.add(stateLabel);
+ entryPanel.add(stateLabel);
if (tm.due == null) {
- item.add(new Label("milestoneDue", getString("gb.notSpecified")));
+ entryPanel.add(new Label("milestoneDue", getString("gb.notSpecified")));
} else {
- item.add(WicketUtils.createDatestampLabel("milestoneDue", tm.due, getTimeZone(), getTimeUtils()));
+ entryPanel.add(WicketUtils.createDatestampLabel("milestoneDue", tm.due, getTimeZone(), getTimeUtils()));
}
if (acceptingUpdates) {
- item.add(new LinkPanel("editMilestone", null, getString("gb.edit"), EditMilestonePage.class,
+ entryPanel.add(new LinkPanel("editMilestone", null, getString("gb.edit"), EditMilestonePage.class,
WicketUtils.newObjectParameter(repositoryName, tm.name)));
} else {
- item.add(new Label("editMilestone").setVisible(false));
+ entryPanel.add(new Label("editMilestone").setVisible(false));
+ }
+
+ if (tm.isOpen()) {
+ // re-load milestone with query results
+ TicketMilestone m = app().tickets().getMilestone(getRepositoryModel(), tm.name);
+
+ Fragment milestonePanel = new Fragment("milestonePanel", "openMilestoneFragment", this);
+ Label label = new Label("progress");
+ WicketUtils.setCssStyle(label, "width:" + tm.getProgress() + "%;");
+ milestonePanel.add(label);
+
+ milestonePanel.add(new LinkPanel("openTickets", null,
+ MessageFormat.format(getString("gb.nOpenTickets"), m.getOpenTickets()),
+ TicketsPage.class,
+ queryParameters(null, tm.name, openStatii, null, null, true, 1)));
+
+ milestonePanel.add(new LinkPanel("closedTickets", null,
+ MessageFormat.format(getString("gb.nClosedTickets"), m.getClosedTickets()),
+ TicketsPage.class,
+ queryParameters(null, tm.name, closedStatii, null, null, true, 1)));
+
+ milestonePanel.add(new Label("totalTickets", MessageFormat.format(getString("gb.nTotalTickets"), m.getTotalTickets())));
+ entryPanel.add(milestonePanel);
+ } else {
+ entryPanel.add(new Label("milestonePanel").setVisible(false));
}
}
};
- add(milestonesList);
+ return milestonesList;
}
protected PageParameters queryParameters(
|