summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-06-03 09:13:58 -0400
committerJames Moger <james.moger@gitblit.com>2014-06-03 10:34:51 -0400
commit2cf367f1970133303c872e969861be6147196fef (patch)
treefa65a3c1434470c84e46297b0dbbe11db90231e2 /src/main
parent85b5d72949ead641ba697543324ff5d236e23fd1 (diff)
downloadgitblit-2cf367f1970133303c872e969861be6147196fef.tar.gz
gitblit-2cf367f1970133303c872e969861be6147196fef.zip
Extract re-usable checkbox, choice, and text option panels
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.html33
-rw-r--r--src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java90
-rw-r--r--src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html9
-rw-r--r--src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java12
-rw-r--r--src/main/java/com/gitblit/wicket/panels/CheckboxOption.html17
-rw-r--r--src/main/java/com/gitblit/wicket/panels/CheckboxOption.java53
-rw-r--r--src/main/java/com/gitblit/wicket/panels/ChoiceOption.html19
-rw-r--r--src/main/java/com/gitblit/wicket/panels/ChoiceOption.java51
-rw-r--r--src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html2
-rw-r--r--src/main/java/com/gitblit/wicket/panels/TextOption.html20
-rw-r--r--src/main/java/com/gitblit/wicket/panels/TextOption.java53
11 files changed, 239 insertions, 120 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.html b/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.html
index b5f9528f..1e683b4f 100644
--- a/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.html
+++ b/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.html
@@ -189,38 +189,5 @@
</form>
</body>
-<wicket:fragment wicket:id="checkboxOption">
- <div style="padding-top:4px;">
- <div>
- <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>
- </div>
- <label class="checkbox" style="color:#777;" wicket:id="description"></label>
- </div>
-</wicket:fragment>
-
-<wicket:fragment wicket:id="choiceOption">
- <div style="padding-top:4px;">
- <div>
- <b><span wicket:id="name"></span></b>
- </div>
- <label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>
- <p style="padding-top:5px;"><select class="span2" wicket:id="choice" /></p>
- </label>
-
- </div>
-</wicket:fragment>
-
-<wicket:fragment wicket:id="textfieldOption">
- <div style="padding-top:4px;">
- <div>
- <b><span wicket:id="name"></span></b>
- </div>
- <label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>
- <p style="padding-top:5px;"><input class="span2" type="text" wicket:id="text" /></p>
- </label>
-
- </div>
-</wicket:fragment>
-
</wicket:extend>
</html> \ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java
index 16dac895..f891595c 100644
--- a/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -43,7 +43,6 @@ import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
@@ -72,8 +71,11 @@ import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.AccessPolicyPanel;
import com.gitblit.wicket.panels.BasePanel.JavascriptEventConfirmation;
import com.gitblit.wicket.panels.BulletListPanel;
+import com.gitblit.wicket.panels.CheckboxOption;
+import com.gitblit.wicket.panels.ChoiceOption;
import com.gitblit.wicket.panels.RegistrantPermissionsPanel;
import com.gitblit.wicket.panels.RepositoryNamePanel;
+import com.gitblit.wicket.panels.TextOption;
public class EditRepositoryPage extends RootSubPage {
@@ -417,7 +419,7 @@ public class EditRepositoryPage extends RootSubPage {
// XXX AccessPolicyPanel is defined later.
- form.add(newChoice("head",
+ form.add(new ChoiceOption<String>("head",
getString("gb.headRef"),
getString("gb.headRefDescription"),
new PropertyModel<String>(repositoryModel, "HEAD"),
@@ -434,22 +436,22 @@ public class EditRepositoryPage extends RootSubPage {
//
// TICKETS
//
- form.add(newCheckbox("acceptNewPatchsets",
+ form.add(new CheckboxOption("acceptNewPatchsets",
getString("gb.acceptNewPatchsets"),
getString("gb.acceptNewPatchsetsDescription"),
new PropertyModel<Boolean>(repositoryModel, "acceptNewPatchsets")));
- form.add(newCheckbox("acceptNewTickets",
+ form.add(new CheckboxOption("acceptNewTickets",
getString("gb.acceptNewTickets"),
getString("gb.acceptNewTicketsDescription"),
new PropertyModel<Boolean>(repositoryModel, "acceptNewPatchsets")));
- form.add(newCheckbox("requireApproval",
+ form.add(new CheckboxOption("requireApproval",
getString("gb.requireApproval"),
getString("gb.requireApprovalDescription"),
new PropertyModel<Boolean>(repositoryModel, "requireApproval")));
- form.add(newChoice("mergeTo",
+ form.add(new ChoiceOption<String>("mergeTo",
getString("gb.mergeTo"),
getString("gb.mergeToDescription"),
new PropertyModel<String>(repositoryModel, "mergeTo"),
@@ -458,22 +460,22 @@ public class EditRepositoryPage extends RootSubPage {
//
// RECEIVE
//
- form.add(newCheckbox("isFrozen",
+ form.add(new CheckboxOption("isFrozen",
getString("gb.isFrozen"),
getString("gb.isFrozenDescription"),
new PropertyModel<Boolean>(repositoryModel, "isFrozen")));
- form.add(newCheckbox("incrementalPushTags",
+ form.add(new CheckboxOption("incrementalPushTags",
getString("gb.enableIncrementalPushTags"),
getString("gb.useIncrementalPushTagsDescription"),
new PropertyModel<Boolean>(repositoryModel, "useIncrementalPushTags")));
final CheckBox verifyCommitter = new CheckBox("checkbox", new PropertyModel<Boolean>(repositoryModel, "verifyCommitter"));
verifyCommitter.setOutputMarkupId(true);
- form.add(newCheckbox("verifyCommitter",
+ form.add(new CheckboxOption("verifyCommitter",
getString("gb.verifyCommitter"),
- getString("gb.verifyCommitterDescription"),
- verifyCommitter));
+ getString("gb.verifyCommitterDescription") + "<br/>" + getString("gb.verifyCommitterNote"),
+ verifyCommitter).setIsHtmlDescription(true));
form.add(preReceivePalette);
form.add(new BulletListPanel("inheritedPreReceive", getString("gb.inherited"), app().repositories()
@@ -496,7 +498,7 @@ public class EditRepositoryPage extends RootSubPage {
federationStrategies.remove(FederationStrategy.FEDERATE_ORIGIN);
}
- form.add(newChoice("federationStrategy",
+ form.add(new ChoiceOption<FederationStrategy>("federationStrategy",
getString("gb.federationStrategy"),
getString("gb.federationStrategyDescription"),
new DropDownChoice<FederationStrategy>(
@@ -521,7 +523,7 @@ public class EditRepositoryPage extends RootSubPage {
repositoryModel.gcPeriod = defaultGcPeriod;
}
List<Integer> gcPeriods = Arrays.asList(1, 2, 3, 4, 5, 7, 10, 14 );
- form.add(newChoice("gcPeriod",
+ form.add(new ChoiceOption<Integer>("gcPeriod",
getString("gb.gcPeriod"),
getString("gb.gcPeriodDescription"),
new DropDownChoice<Integer>("choice",
@@ -529,7 +531,7 @@ public class EditRepositoryPage extends RootSubPage {
gcPeriods,
new GCPeriodRenderer())).setEnabled(gcEnabled));
- form.add(newTextfield("gcThreshold",
+ form.add(new TextOption("gcThreshold",
getString("gb.gcThreshold"),
getString("gb.gcThresholdDescription"),
"span1",
@@ -539,29 +541,29 @@ public class EditRepositoryPage extends RootSubPage {
// MISCELLANEOUS
//
- form.add(newTextfield("origin",
+ form.add(new TextOption("origin",
getString("gb.origin"),
getString("gb.originDescription"),
"span6",
new PropertyModel<String>(repositoryModel, "origin")).setEnabled(false));
- form.add(newCheckbox("showRemoteBranches",
+ form.add(new CheckboxOption("showRemoteBranches",
getString("gb.showRemoteBranches"),
getString("gb.showRemoteBranchesDescription"),
new PropertyModel<Boolean>(repositoryModel, "showRemoteBranches")));
- form.add(newCheckbox("skipSizeCalculation",
+ form.add(new CheckboxOption("skipSizeCalculation",
getString("gb.skipSizeCalculation"),
getString("gb.skipSizeCalculationDescription"),
new PropertyModel<Boolean>(repositoryModel, "skipSizeCalculation")));
- form.add(newCheckbox("skipSummaryMetrics",
+ form.add(new CheckboxOption("skipSummaryMetrics",
getString("gb.skipSummaryMetrics"),
getString("gb.skipSummaryMetricsDescription"),
new PropertyModel<Boolean>(repositoryModel, "skipSummaryMetrics")));
List<Integer> maxActivityCommits = Arrays.asList(-1, 0, 25, 50, 75, 100, 150, 200, 250, 500);
- form.add(newChoice("maxActivityCommits",
+ form.add(new ChoiceOption<Integer>("maxActivityCommits",
getString("gb.maxActivityCommits"),
getString("gb.maxActivityCommitsDescription"),
new DropDownChoice<Integer>("choice",
@@ -570,7 +572,7 @@ public class EditRepositoryPage extends RootSubPage {
new MaxActivityCommitsRenderer())));
List<CommitMessageRenderer> renderers = Arrays.asList(CommitMessageRenderer.values());
- form.add(newChoice("commitMessageRenderer",
+ form.add(new ChoiceOption<CommitMessageRenderer>("commitMessageRenderer",
getString("gb.commitMessageRenderer"),
getString("gb.commitMessageRendererDescription"),
new DropDownChoice<CommitMessageRenderer>("choice",
@@ -580,7 +582,7 @@ public class EditRepositoryPage extends RootSubPage {
metricAuthorExclusions = new Model<String>(ArrayUtils.isEmpty(repositoryModel.metricAuthorExclusions) ? ""
: StringUtils.flattenStrings(repositoryModel.metricAuthorExclusions, " "));
- form.add(newTextfield("metricAuthorExclusions",
+ form.add(new TextOption("metricAuthorExclusions",
getString("gb.metricAuthorExclusions"),
getString("gb.metricAuthorExclusions"),
"span6",
@@ -589,7 +591,7 @@ public class EditRepositoryPage extends RootSubPage {
mailingLists = new Model<String>(ArrayUtils.isEmpty(repositoryModel.mailingLists) ? ""
: StringUtils.flattenStrings(repositoryModel.mailingLists, " "));
- form.add(newTextfield("mailingLists",
+ form.add(new TextOption("mailingLists",
getString("gb.mailingLists"),
getString("gb.mailingLists"),
"span6",
@@ -752,50 +754,6 @@ public class EditRepositoryPage extends RootSubPage {
}
}
- private Fragment newCheckbox(String wicketId, String title, String description, IModel<Boolean> model) {
- Fragment fragment = new Fragment(wicketId, "checkboxOption", this);
- fragment.add(new Label("name", title));
- fragment.add(new Label("description", description));
- fragment.add(new CheckBox("checkbox", model));
- return fragment;
- }
-
- private Fragment newCheckbox(String wicketId, String title, String description, CheckBox checkbox) {
- Fragment fragment = new Fragment(wicketId, "checkboxOption", this);
- fragment.add(new Label("name", title));
- fragment.add(new Label("description", description));
- fragment.add(checkbox);
- return fragment;
- }
-
- private <T> Fragment newChoice(String wicketId, String title, String description, IModel<T> model, List<T> choices) {
- Fragment fragment = new Fragment(wicketId, "choiceOption", this);
- fragment.add(new Label("name", title));
- fragment.add(new Label("description", description));
- fragment.add(new DropDownChoice<>("choice", model, choices).setEnabled(choices.size() > 0));
- return fragment;
- }
-
- private <T> Fragment newChoice(String wicketId, String title, String description, DropDownChoice<?> choice) {
- Fragment fragment = new Fragment(wicketId, "choiceOption", this);
- fragment.add(new Label("name", title));
- fragment.add(new Label("description", description));
- fragment.add(choice.setEnabled(choice.getChoices().size() > 0));
- return fragment;
- }
-
- private Fragment newTextfield(String wicketId, String title, String description, String css, IModel<String> model) {
- Fragment fragment = new Fragment(wicketId, "textfieldOption", this);
- fragment.add(new Label("name", title));
- fragment.add(new Label("description", description));
- TextField<String> tf = new TextField<String>("text", model);
- if (!StringUtils.isEmpty(css)) {
- WicketUtils.setCssClass(tf, css);
- }
- fragment.add(tf);
- return fragment;
- }
-
private class FederationTypeRenderer implements IChoiceRenderer<FederationStrategy> {
diff --git a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html
index 965c4d51..d3c29ba7 100644
--- a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html
+++ b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html
@@ -27,15 +27,6 @@
<div wicket:id="allowForks"></div>
-<wicket:fragment wicket:id="checkboxOption">
- <div style="padding-top:4px;">
- <div>
- <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>
- </div>
- <label class="checkbox" style="color:#777;" wicket:id="description"></label>
- </div>
-</wicket:fragment>
-
</wicket:panel>
</body>
</html> \ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
index 7aa801f4..4f234263 100644
--- a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
@@ -21,12 +21,10 @@ import java.util.List;
import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.Radio;
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.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
@@ -148,7 +146,7 @@ public class AccessPolicyPanel extends BasePanel {
add(policiesGroup);
allowForks = Model.of(true);
- add(newCheckbox("allowForks",
+ add(new CheckboxOption("allowForks",
getString("gb.allowForks"),
getString("gb.allowForksDescription"),
allowForks).setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));
@@ -156,14 +154,6 @@ public class AccessPolicyPanel extends BasePanel {
setOutputMarkupId(true);
}
- private Fragment newCheckbox(String wicketId, String title, String description, IModel<Boolean> model) {
- Fragment fragment = new Fragment(wicketId, "checkboxOption", this);
- fragment.add(new Label("name", title));
- fragment.add(new Label("description", description));
- fragment.add(new CheckBox("checkbox", model));
- return fragment;
- }
-
public void updateModel(RepositoryModel repository) {
AccessPolicy policy = policiesGroup.getModelObject();
repository.authorizationControl = policy.control;
diff --git a/src/main/java/com/gitblit/wicket/panels/CheckboxOption.html b/src/main/java/com/gitblit/wicket/panels/CheckboxOption.html
new file mode 100644
index 00000000..6684fe92
--- /dev/null
+++ b/src/main/java/com/gitblit/wicket/panels/CheckboxOption.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
+ xml:lang="en"
+ lang="en">
+
+<body>
+<wicket:panel>
+ <div style="padding-top:4px;">
+ <div>
+ <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>
+ </div>
+ <label class="checkbox" style="color:#777;" wicket:id="description"></label>
+ </div>
+</wicket:panel>
+</body>
+</html> \ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java b/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java
new file mode 100644
index 00000000..086d8ef2
--- /dev/null
+++ b/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.wicket.panels;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.CheckBox;
+import org.apache.wicket.model.IModel;
+
+/**
+ * A re-usable checkbox option panel.
+ *
+ * [x] title
+ * description
+ *
+ * @author James Moger
+ *
+ */
+public class CheckboxOption extends BasePanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public CheckboxOption(String wicketId, String title, String description, IModel<Boolean> model) {
+ super(wicketId);
+ add(new Label("name", title));
+ add(new Label("description", description));
+ add(new CheckBox("checkbox", model));
+ }
+
+ public CheckboxOption(String wicketId, String title, String description, CheckBox checkbox) {
+ super(wicketId);
+ add(new Label("name", title));
+ add(new Label("description", description));
+ add(checkbox.setMarkupId("checkbox"));
+ }
+
+ public CheckboxOption setIsHtmlDescription(boolean val) {
+ ((Label) get("description")).setEscapeModelStrings(!val);
+ return this;
+ }
+}
diff --git a/src/main/java/com/gitblit/wicket/panels/ChoiceOption.html b/src/main/java/com/gitblit/wicket/panels/ChoiceOption.html
new file mode 100644
index 00000000..8c34c819
--- /dev/null
+++ b/src/main/java/com/gitblit/wicket/panels/ChoiceOption.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
+ xml:lang="en"
+ lang="en">
+
+<body>
+<wicket:panel>
+ <div style="padding-top:4px;">
+ <div>
+ <b><span wicket:id="name"></span></b>
+ </div>
+ <label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>
+ <p style="padding-top:5px;"><select class="span3" wicket:id="choice" /></p>
+ </label>
+ </div>
+</wicket:panel>
+</body>
+</html> \ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java b/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java
new file mode 100644
index 00000000..cc084a7b
--- /dev/null
+++ b/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.wicket.panels;
+
+import java.util.List;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.model.IModel;
+
+/**
+ * A re-usable choice option panel.
+ *
+ * title
+ * description
+ * [choices]
+ *
+ * @author James Moger
+ *
+ */
+public class ChoiceOption<T> extends BasePanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public ChoiceOption(String wicketId, String title, String description, IModel<T> model, List<T> choices) {
+ super(wicketId);
+ add(new Label("name", title));
+ add(new Label("description", description));
+ add(new DropDownChoice<>("choice", model, choices).setEnabled(choices.size() > 0));
+ }
+
+ public ChoiceOption(String wicketId, String title, String description, DropDownChoice<?> choice) {
+ super(wicketId);
+ add(new Label("name", title));
+ add(new Label("description", description));
+ add(choice.setMarkupId("choice").setEnabled(choice.getChoices().size() > 0));
+ }
+}
diff --git a/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html b/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html
index eb82245c..a48797ec 100644
--- a/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html
+++ b/src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html
@@ -16,7 +16,7 @@
</form>
<div style="clear:both;" wicket:id="permissionRow">
- <div style="padding-top:10px;border-left:1px solid #ccc;border-right:1px solid #ccc;" class="row-fluid">
+ <div style="padding-top:10px;" class="row-fluid">
<div style="padding-top:5px;padding-left:5px" class="span6"><span wicket:id="registrant"></span></div><div style="padding-top:5px;padding-right:5px;text-align:right;" class="span3"><span class="label" wicket:id="pType">[permission type]</span></div> <select class="input-medium" wicket:id="permission"></select>
</div>
</div>
diff --git a/src/main/java/com/gitblit/wicket/panels/TextOption.html b/src/main/java/com/gitblit/wicket/panels/TextOption.html
new file mode 100644
index 00000000..ff2da78e
--- /dev/null
+++ b/src/main/java/com/gitblit/wicket/panels/TextOption.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
+ xml:lang="en"
+ lang="en">
+
+<body>
+<wicket:panel>
+ <div style="padding-top:4px;">
+ <div>
+ <b><span wicket:id="name"></span></b>
+ </div>
+ <label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>
+ <p style="padding-top:5px;"><input class="span2" type="text" wicket:id="text" /></p>
+ </label>
+
+ </div>
+</wicket:panel>
+</body>
+</html> \ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/panels/TextOption.java b/src/main/java/com/gitblit/wicket/panels/TextOption.java
new file mode 100644
index 00000000..dcd465fb
--- /dev/null
+++ b/src/main/java/com/gitblit/wicket/panels/TextOption.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.wicket.panels;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.IModel;
+
+import com.gitblit.utils.StringUtils;
+import com.gitblit.wicket.WicketUtils;
+
+/**
+ * A re-usable textfield option panel.
+ *
+ * title
+ * description
+ * [textfield]
+ *
+ * @author James Moger
+ *
+ */
+public class TextOption extends BasePanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public TextOption(String wicketId, String title, String description, IModel<String> model) {
+ this(wicketId, title, description, null, model);
+ }
+
+ public TextOption(String wicketId, String title, String description, String css, IModel<String> model) {
+ super(wicketId);
+ add(new Label("name", title));
+ add(new Label("description", description));
+ TextField<String> tf = new TextField<String>("text", model);
+ if (!StringUtils.isEmpty(css)) {
+ WicketUtils.setCssClass(tf, css);
+ }
+ add(tf);
+ }
+}