From f3b1e099e6ae252f1f1296ce5415b85fef6361cf Mon Sep 17 00:00:00 2001
From: Hybris95 <hybris_95@hotmail.com>
Date: Thu, 01 May 2014 16:14:14 -0400
Subject: [PATCH] Added back the "my tickets" button in the navbar.

---
 src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java b/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java
index b92ba8b..b844442 100644
--- a/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java
+++ b/src/main/java/com/gitblit/wicket/pages/EditMilestonePage.java
@@ -21,8 +21,12 @@
 
 import org.apache.wicket.PageParameters;
 import org.apache.wicket.RestartResponseException;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.extensions.markup.html.form.DateTextField;
+import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Button;
+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;
@@ -90,13 +94,28 @@
 		setStatelessHint(false);
 		setOutputMarkupId(true);
 
-		Form<Void> form = new Form<Void>("editForm") {
+		Form<Void> form = new Form<Void>("editForm");
+		add(form);
+
+		nameModel = Model.of(tm.name);
+		dueModel = Model.of(tm.due);
+		statusModel = Model.of(tm.status);
+		notificationModel = Model.of(true);
+
+		form.add(new TextField<String>("name", nameModel));
+		form.add(new DateTextField("due", dueModel, "yyyy-MM-dd"));
+		form.add(new Label("dueFormat", "yyyy-MM-dd"));
+		form.add(new CheckBox("notify", notificationModel));
+
+		List<Status> statusChoices = Arrays.asList(Status.Open, Status.Closed);
+		form.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));
+
+		form.add(new AjaxButton("save") {
 
 			private static final long serialVersionUID = 1L;
 
 			@Override
-			protected void onSubmit() {
-
+			protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
 				String name = nameModel.getObject();
 				if (StringUtils.isEmpty(name)) {
 					return;
@@ -126,21 +145,7 @@
 					// TODO error
 				}
 			}
-		};
-		add(form);
-
-		nameModel = Model.of(tm.name);
-		dueModel = Model.of(tm.due);
-		statusModel = Model.of(tm.status);
-		notificationModel = Model.of(true);
-
-		form.add(new TextField<String>("name", nameModel));
-		form.add(new DateTextField("due", dueModel, "yyyy-MM-dd"));
-
-		List<Status> statusChoices = Arrays.asList(Status.Open, Status.Closed);
-		form.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));
-
-		form.add(new Button("save"));
+		});
 		Button cancel = new Button("cancel") {
 			private static final long serialVersionUID = 1L;
 
@@ -159,8 +164,9 @@
 			public void onSubmit() {
 				UserModel currentUser = GitBlitWebSession.get().getUser();
 				String createdBy = currentUser.username;
+				boolean notify = notificationModel.getObject();
 
-				if (app().tickets().deleteMilestone(getRepositoryModel(), oldName, createdBy)) {
+				if (app().tickets().deleteMilestone(getRepositoryModel(), oldName, createdBy, notify)) {
 					setResponsePage(TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName));
 				} else {
 					// TODO error processing

--
Gitblit v1.9.1