]> source.dussan.org Git - gitblit.git/commitdiff
Add confirm milestone deletion prompt 68/68/1
authorJames Moger <james.moger@gitblit.com>
Fri, 9 May 2014 12:00:14 +0000 (08:00 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 9 May 2014 12:00:14 +0000 (08:00 -0400)
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java

index d0c2d48c67bbe93e8c2caf63cedd683a77e0cdcc..12430adef074737a655f904ef5e22b3a69144df8 100644 (file)
@@ -676,6 +676,8 @@ gb.myTickets = my tickets
 gb.yourAssignedTickets = assigned to you
 gb.newMilestone = new milestone
 gb.editMilestone = edit milestone
+gb.deleteMilestone = Delete milestone \"{0}\"?
+gb.milestoneDeleteFailed = Failed to delete milestone ''{0}''!
 gb.notifyChangedOpenTickets = send notification for changed open tickets
 gb.overdue = overdue
 gb.openMilestones = open milestones
index d6f58e7b84a287e3d99d55ad9624c0e5c0ee9829..4ed77d83a9e997bf79b3306e84062f6499620169 100644 (file)
@@ -15,6 +15,7 @@
  */\r
 package com.gitblit.wicket.pages;\r
 \r
+import java.text.MessageFormat;\r
 import java.util.Arrays;\r
 import java.util.Date;\r
 import java.util.List;\r
@@ -30,6 +31,7 @@ import org.apache.wicket.markup.html.form.CheckBox;
 import org.apache.wicket.markup.html.form.DropDownChoice;\r
 import org.apache.wicket.markup.html.form.Form;\r
 import org.apache.wicket.markup.html.form.TextField;\r
+import org.apache.wicket.markup.html.link.Link;\r
 import org.apache.wicket.model.IModel;\r
 import org.apache.wicket.model.Model;\r
 \r
@@ -41,6 +43,7 @@ import com.gitblit.tickets.TicketMilestone;
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.panels.BasePanel.JavascriptEventConfirmation;\r
 \r
 /**\r
  * Page for creating a new milestone.\r
@@ -157,11 +160,12 @@ public class EditMilestonePage extends RepositoryPage {
                cancel.setDefaultFormProcessing(false);\r
                form.add(cancel);\r
 \r
-               Button delete = new Button("delete") {\r
+               Link<Void> delete = new Link<Void>("delete") {\r
+\r
                        private static final long serialVersionUID = 1L;\r
 \r
                        @Override\r
-                       public void onSubmit() {\r
+                       public void onClick() {\r
                                UserModel currentUser = GitBlitWebSession.get().getUser();\r
                                String createdBy = currentUser.username;\r
                                boolean notify = notificationModel.getObject();\r
@@ -169,11 +173,14 @@ public class EditMilestonePage extends RepositoryPage {
                                if (app().tickets().deleteMilestone(getRepositoryModel(), oldName, createdBy, notify)) {\r
                                        setResponsePage(TicketsPage.class, WicketUtils.newOpenTicketsParameter(repositoryName));\r
                                } else {\r
-                                       // TODO error processing\r
+                                       error(MessageFormat.format(getString("gb.milestoneDeleteFailed"), oldName));\r
                                }\r
                        }\r
                };\r
-               delete.setDefaultFormProcessing(false);\r
+\r
+               delete.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(\r
+                       getString("gb.deleteMilestone"), oldName)));\r
+\r
                form.add(delete);\r
        }\r
 \r