mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
Merge with Robin
This commit is contained in:
parent
8676857d27
commit
31144a8570
@ -16,7 +16,7 @@ public class Messenger {
|
||||
this.jsFunc = jsFunc;
|
||||
}
|
||||
|
||||
public void execute(AjaxRequestTarget target) {
|
||||
public void run(AjaxRequestTarget target) {
|
||||
target.appendJavaScript(jsFunc);
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.Radio;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
|
||||
import com.pmease.gitop.web.common.form.radio.RadioButtonElement;
|
||||
|
||||
@ -18,9 +17,9 @@ public class FlatRadioElement<T> extends RadioButtonElement<T> {
|
||||
|
||||
private IModel<String> descriptionModel;
|
||||
|
||||
public FlatRadioElement(String id, IModel<T> model, String description) {
|
||||
public FlatRadioElement(String id, IModel<T> model, IModel<String> description) {
|
||||
super(id, model, "");
|
||||
this.descriptionModel = Model.of(description);
|
||||
this.descriptionModel = description;
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
||||
@ -22,5 +22,7 @@
|
||||
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
|
||||
<![endif]-->
|
||||
<wicket:child></wicket:child>
|
||||
|
||||
<wicket:container wicket:id="modal"></wicket:container>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -26,6 +26,7 @@ import com.pmease.gitop.core.Gitop;
|
||||
import com.pmease.gitop.web.assets.BaseResourcesBehavior;
|
||||
import com.pmease.gitop.web.assets.PageResourcesBehavior;
|
||||
import com.pmease.gitop.web.common.component.messenger.MessengerResourcesBehavior;
|
||||
import com.pmease.gitop.web.common.component.modal.Modal;
|
||||
import com.pmease.gitop.web.exception.AccessDeniedException;
|
||||
import com.pmease.gitop.web.page.init.ServerInitPage;
|
||||
|
||||
@ -36,7 +37,7 @@ public abstract class BasePage extends WebPage {
|
||||
|
||||
private boolean shouldInitialize = true;
|
||||
|
||||
// private Modal modal;
|
||||
private Modal modal;
|
||||
|
||||
public BasePage() {
|
||||
commonInit();
|
||||
@ -65,8 +66,8 @@ public abstract class BasePage extends WebPage {
|
||||
}
|
||||
}));
|
||||
|
||||
// modal = new Modal("modal");
|
||||
// add(modal);
|
||||
modal = new Modal("modal");
|
||||
add(modal);
|
||||
|
||||
if (!Gitop.getInstance().isReady()
|
||||
&& getClass() != ServerInitPage.class) {
|
||||
@ -221,10 +222,9 @@ public abstract class BasePage extends WebPage {
|
||||
protected final void onInitialize() {
|
||||
super.onInitialize();
|
||||
|
||||
System.out.println("Still invoke onInitialize " + getClass());
|
||||
// if (shouldInitialize) {
|
||||
if (shouldInitialize) {
|
||||
onPageInitialize();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String getPageTitle();
|
||||
|
||||
@ -82,7 +82,7 @@ public class AccountPasswordPage extends AccountSettingPage {
|
||||
newPass = null;
|
||||
confirmPass = null;
|
||||
target.add(form);
|
||||
Messenger.success("Your password has been changed successfully.").execute(target);
|
||||
Messenger.success("Your password has been changed successfully.").run(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ public class AccountProfilePage extends AccountSettingPage {
|
||||
User user = model.getObject();
|
||||
AppLoader.getInstance(UserManager.class).save(user);
|
||||
Messenger.success("Account profile has been updated.")
|
||||
.execute(target);
|
||||
.run(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -164,7 +164,7 @@ public class AccountProfilePage extends AccountSettingPage {
|
||||
|
||||
send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
|
||||
target.add(form);
|
||||
Messenger.success("Your avatar has been changed!").execute(target);;
|
||||
Messenger.success("Your avatar has been changed!").run(target);;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -179,7 +179,7 @@ public class AccountProfilePage extends AccountSettingPage {
|
||||
AppLoader.getInstance(UserManager.class).save(user);
|
||||
|
||||
send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
|
||||
Messenger.success("Your avatar has been reset to the default.").execute(target);
|
||||
Messenger.success("Your avatar has been reset to the default.").run(target);
|
||||
target.add(form);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,11 +1,26 @@
|
||||
<html xmlns:wicket>
|
||||
<wicket:extend>
|
||||
<div class="container">
|
||||
<h3>DropZone Test</h3>
|
||||
<form class="dropzone" enctype="multipart/form-data" action="/rest/file/upload">
|
||||
<div class="fallback">
|
||||
<input name="file" type="file" multiple />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h3>Flat CheckBox RadioBox</h3>
|
||||
<form wicket:id="testForm">
|
||||
<div wicket:id="check1"></div>
|
||||
<div wicket:id="check2"></div>
|
||||
|
||||
<wicket:container wicket:id="radiogroup">
|
||||
<wicket:container wicket:id="radios">
|
||||
<wicket:container wicket:id="radio"></wicket:container>
|
||||
</wicket:container>
|
||||
</wicket:container>
|
||||
|
||||
<button class="btn btn-default" wicket:id="submit">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</wicket:extend>
|
||||
</html>
|
||||
|
||||
@ -1,12 +1,22 @@
|
||||
package com.pmease.gitop.web.page.home;
|
||||
|
||||
import org.apache.wicket.devutils.stateless.StatelessComponent;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.markup.html.form.Form;
|
||||
import org.apache.wicket.markup.html.form.RadioGroup;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.pmease.gitop.web.common.component.dropzone.DropZoneBehavior;
|
||||
import com.pmease.gitop.web.common.component.messenger.Messenger;
|
||||
import com.pmease.gitop.web.common.component.vex.AjaxConfirmButton;
|
||||
import com.pmease.gitop.web.common.component.vex.VexLinkBehavior.VexIcon;
|
||||
import com.pmease.gitop.web.common.form.flatcheckbox.FlatCheckBoxElement;
|
||||
import com.pmease.gitop.web.common.form.flatradio.FlatRadioElement;
|
||||
import com.pmease.gitop.web.page.AbstractLayoutPage;
|
||||
|
||||
@StatelessComponent
|
||||
public class HomePage extends AbstractLayoutPage {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -20,11 +30,46 @@ public class HomePage extends AbstractLayoutPage {
|
||||
return "Gitop - Home";
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Override
|
||||
protected void onPageInitialize() {
|
||||
super.onPageInitialize();
|
||||
|
||||
add(new DropZoneBehavior());
|
||||
|
||||
Form<?> form = new Form<Void>("testForm");
|
||||
add(form);
|
||||
form.add(new FlatCheckBoxElement("check1", new Model<Boolean>(true),
|
||||
Model.of("Enable public access")));
|
||||
form.add(new FlatCheckBoxElement("check2", new Model<Boolean>(false),
|
||||
Model.of("Repository is forkable")));
|
||||
|
||||
RadioGroup<VexIcon> rg = new RadioGroup<VexIcon>("radiogroup", new PropertyModel<VexIcon>(this, "vexIcon"));
|
||||
form.add(rg);
|
||||
|
||||
rg.add(new ListView<VexIcon>("radios", ImmutableList.<VexIcon>copyOf(VexIcon.values())) {
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<VexIcon> item) {
|
||||
item.add(new FlatRadioElement<VexIcon>("radio",
|
||||
item.getModel(),
|
||||
Model.of(item.getDefaultModelObjectAsString())));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
form.add(new AjaxConfirmButton("submit", form,
|
||||
Model.of("Are you sure you want to submit the form?"),
|
||||
Model.of(VexIcon.ERROR),
|
||||
Model.of("Yes"),
|
||||
Model.of("No"),
|
||||
null) {
|
||||
@Override
|
||||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
|
||||
Messenger.success("Yes, your form is submitted").run(target);
|
||||
target.add(form);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
VexIcon vexIcon = VexIcon.INFO;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user