]> source.dussan.org Git - gitblit.git/commitdiff
Allow changing status from edit ticket page
authorJames Moger <james.moger@gitblit.com>
Wed, 5 Mar 2014 16:19:50 +0000 (11:19 -0500)
committerJames Moger <james.moger@gitblit.com>
Wed, 5 Mar 2014 16:42:34 +0000 (11:42 -0500)
src/main/java/com/gitblit/wicket/pages/EditTicketPage.html
src/main/java/com/gitblit/wicket/pages/EditTicketPage.java
src/main/java/com/gitblit/wicket/pages/TicketPage.java

index 424eece3a1aa59222e3944ca1af5a162755395e8..b3c102d984d5a2212ef695d03f80784e0c566f57 100644 (file)
@@ -39,6 +39,7 @@
                                </div>\r
                        </td></tr>\r
                        <tr><th><wicket:message key="gb.type"></wicket:message><span style="color:red;">*</span></th><td class="edit"><select class="input-large" wicket:id="type"></select></td></tr>\r
+                       <tr><th><wicket:message key="gb.status"></wicket:message><span style="color:red;">*</span></th><td class="edit"><select class="input-large" wicket:id="status"></select></td></tr>\r
                        <tr wicket:id="responsible"></tr>\r
                        <tr wicket:id="milestone"></tr>\r
                        <tr wicket:id="mergeto"></tr>\r
index aad1d6fe344f00015d8e87b1540ce123b81e4ea0..32b202fbf1811c7de40542ce28557070ca5f719b 100644 (file)
@@ -72,6 +72,8 @@ public class EditTicketPage extends RepositoryPage {
 \r
        private IModel<String> mergeToModel;\r
 \r
+       private IModel<Status> statusModel;\r
+\r
        private IModel<TicketResponsible> responsibleModel;\r
 \r
        private IModel<TicketMilestone> milestoneModel;\r
@@ -110,6 +112,7 @@ public class EditTicketPage extends RepositoryPage {
                responsibleModel = Model.of();\r
                milestoneModel = Model.of();\r
                mergeToModel = Model.of(ticket.mergeTo == null ? "" : ticket.mergeTo);\r
+               statusModel = Model.of(ticket.status);\r
 \r
                setStatelessHint(false);\r
                setOutputMarkupId(true);\r
@@ -145,6 +148,12 @@ public class EditTicketPage extends RepositoryPage {
                                        change.setField(Field.body, description);\r
                                }\r
 \r
+                               Status status = statusModel.getObject();\r
+                               if (!ticket.status.equals(status)) {\r
+                                       // status change\r
+                                       change.setField(Field.status, status);\r
+                               }\r
+\r
                                Type type = typeModel.getObject();\r
                                if (!ticket.type.equals(type)) {\r
                                        // type change\r
@@ -213,6 +222,19 @@ public class EditTicketPage extends RepositoryPage {
                        typeChoices = Arrays.asList(TicketModel.Type.choices());\r
                }\r
                form.add(new DropDownChoice<TicketModel.Type>("type", typeModel, typeChoices));\r
+\r
+               List<Status> statusChoices;\r
+               if (ticket.isClosed()) {\r
+                       statusChoices = Arrays.asList(ticket.status, Status.Open);\r
+               } else if (ticket.isProposal()) {\r
+                       statusChoices = Arrays.asList(TicketModel.Status.proposalWorkflow);\r
+               } else if (ticket.isBug()) {\r
+                       statusChoices = Arrays.asList(TicketModel.Status.bugWorkflow);\r
+               } else {\r
+                       statusChoices = Arrays.asList(TicketModel.Status.requestWorkflow);\r
+               }\r
+               form.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));\r
+\r
                form.add(new TextField<String>("title", titleModel));\r
                form.add(new TextField<String>("topic", topicModel));\r
 \r
index 3c1dbdf96a5acaa110336ba2cddba1ac2e5a135c..07382ad9908eb0b44e2f079a1c111a39538555dd 100644 (file)
@@ -335,7 +335,10 @@ public class TicketPage extends TicketBasePage {
                         * STATUS\r
                         */\r
                        List<Status> choices = new ArrayList<Status>();\r
-                       if (ticket.isProposal()) {\r
+                       if (ticket.isClosed()) {\r
+                               // re-open\r
+                               choices.addAll(Arrays.asList(TicketModel.Status.Open));\r
+                       } else if (ticket.isProposal()) {\r
                                choices.addAll(Arrays.asList(TicketModel.Status.proposalWorkflow));\r
                        } else if (ticket.isBug()) {\r
                                choices.addAll(Arrays.asList(TicketModel.Status.bugWorkflow));\r