summaryrefslogtreecommitdiffstats
path: root/src/main/java/com
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-05-09 06:19:18 -0600
committerJames Moger <james.moger@gitblit.com>2014-05-09 06:19:18 -0600
commitad1a0235bfce09dbcbcc17a0b49a55862422b728 (patch)
tree94aa0dc44f750bac373affd7bd73bfcf445b288c /src/main/java/com
parent45347a60645625d6634767d1b63753de416d215c (diff)
parentdb040113c4c3b450b535360624baa6053599ad43 (diff)
downloadgitblit-ad1a0235bfce09dbcbcc17a0b49a55862422b728.tar.gz
gitblit-ad1a0235bfce09dbcbcc17a0b49a55862422b728.zip
Merged #68 "Confirm milestone deletion"
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/gitblit/wicket/GitBlitWebApp.properties2
-rw-r--r--src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java15
2 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
index d0c2d48c..12430ade 100644
--- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
@@ -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
diff --git a/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java b/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java
index d6f58e7b..4ed77d83 100644
--- a/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java
+++ b/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java
@@ -15,6 +15,7 @@
*/
package com.gitblit.wicket.pages;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -30,6 +31,7 @@ import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
@@ -41,6 +43,7 @@ import com.gitblit.tickets.TicketMilestone;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.panels.BasePanel.JavascriptEventConfirmation;
/**
* Page for creating a new milestone.
@@ -157,11 +160,12 @@ public class EditMilestonePage extends RepositoryPage {
cancel.setDefaultFormProcessing(false);
form.add(cancel);
- Button delete = new Button("delete") {
+ Link<Void> delete = new Link<Void>("delete") {
+
private static final long serialVersionUID = 1L;
@Override
- public void onSubmit() {
+ public void onClick() {
UserModel currentUser = GitBlitWebSession.get().getUser();
String createdBy = currentUser.username;
boolean notify = notificationModel.getObject();
@@ -169,11 +173,14 @@ public class EditMilestonePage extends RepositoryPage {
if (app().tickets().deleteMilestone(getRepositoryModel(), oldName, createdBy, notify)) {
setResponsePage(TicketsPage.class, WicketUtils.newOpenTicketsParameter(repositoryName));
} else {
- // TODO error processing
+ error(MessageFormat.format(getString("gb.milestoneDeleteFailed"), oldName));
}
}
};
- delete.setDefaultFormProcessing(false);
+
+ delete.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
+ getString("gb.deleteMilestone"), oldName)));
+
form.add(delete);
}