]> source.dussan.org Git - gitblit.git/commitdiff
Show open milestone progress and change milestones list layout 17/17/2
authorJames Moger <james.moger@gitblit.com>
Wed, 30 Apr 2014 21:15:31 +0000 (17:15 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 1 May 2014 18:31:18 +0000 (14:31 -0400)
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
src/main/java/com/gitblit/wicket/pages/TicketsPage.html
src/main/java/com/gitblit/wicket/pages/TicketsPage.java

index e66e53a7e0641fd0dcd1de5be86bc6880eea782e..1394890f5c53ee00dd7642f9d5c0135ad865fd39 100644 (file)
@@ -675,4 +675,6 @@ gb.youDoNotHaveClonePermission = You are not permitted to clone this repository.
 gb.newMilestone = new milestone
 gb.editMilestone = edit milestone
 gb.notifyChangedOpenTickets = send notification for changed open tickets
-gb.overdue = overdue
\ No newline at end of file
+gb.overdue = overdue
+gb.openMilestones = open milestones
+gb.closedMilestones = closed milestones
\ No newline at end of file
index e144bea1d227edb1423e5287fef1f4be7d96b95a..a40d31264b5e1b48e5a165c12f5a76cb42c3cd7b 100644 (file)
                <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
index b7e392a2958f5449f32f9ec17a7b632c22604714..5973d4736a6418a34f37123bebccb148ed815c7c 100644 (file)
@@ -660,27 +660,49 @@ public class TicketsPage extends TicketBasePage {
                }\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
@@ -699,22 +721,47 @@ public class TicketsPage extends TicketBasePage {
                                }\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