import com.gitblit.wicket.panels.AccessPolicyPanel;\r
import com.gitblit.wicket.panels.BasePanel.JavascriptEventConfirmation;\r
import com.gitblit.wicket.panels.BulletListPanel;\r
-import com.gitblit.wicket.panels.CheckboxOption;\r
+import com.gitblit.wicket.panels.BooleanOption;\r
import com.gitblit.wicket.panels.ChoiceOption;\r
import com.gitblit.wicket.panels.RegistrantPermissionsPanel;\r
import com.gitblit.wicket.panels.RepositoryNamePanel;\r
//\r
// TICKETS\r
//\r
- form.add(new CheckboxOption("acceptNewPatchsets",\r
+ form.add(new BooleanOption("acceptNewPatchsets",\r
getString("gb.acceptNewPatchsets"),\r
getString("gb.acceptNewPatchsetsDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "acceptNewPatchsets")));\r
\r
- form.add(new CheckboxOption("acceptNewTickets",\r
+ form.add(new BooleanOption("acceptNewTickets",\r
getString("gb.acceptNewTickets"),\r
getString("gb.acceptNewTicketsDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "acceptNewPatchsets")));\r
\r
- form.add(new CheckboxOption("requireApproval",\r
+ form.add(new BooleanOption("requireApproval",\r
getString("gb.requireApproval"),\r
getString("gb.requireApprovalDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "requireApproval")));\r
//\r
// RECEIVE\r
//\r
- form.add(new CheckboxOption("isFrozen",\r
+ form.add(new BooleanOption("isFrozen",\r
getString("gb.isFrozen"),\r
getString("gb.isFrozenDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "isFrozen")));\r
\r
- form.add(new CheckboxOption("incrementalPushTags",\r
+ form.add(new BooleanOption("incrementalPushTags",\r
getString("gb.enableIncrementalPushTags"),\r
getString("gb.useIncrementalPushTagsDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "useIncrementalPushTags")));\r
\r
final CheckBox verifyCommitter = new CheckBox("checkbox", new PropertyModel<Boolean>(repositoryModel, "verifyCommitter"));\r
verifyCommitter.setOutputMarkupId(true);\r
- form.add(new CheckboxOption("verifyCommitter",\r
+ form.add(new BooleanOption("verifyCommitter",\r
getString("gb.verifyCommitter"),\r
getString("gb.verifyCommitterDescription") + "<br/>" + getString("gb.verifyCommitterNote"),\r
verifyCommitter).setIsHtmlDescription(true));\r
"span6",\r
new PropertyModel<String>(repositoryModel, "origin")).setEnabled(false));\r
\r
- form.add(new CheckboxOption("showRemoteBranches",\r
+ form.add(new BooleanOption("showRemoteBranches",\r
getString("gb.showRemoteBranches"),\r
getString("gb.showRemoteBranchesDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "showRemoteBranches")));\r
\r
- form.add(new CheckboxOption("skipSizeCalculation",\r
+ form.add(new BooleanOption("skipSizeCalculation",\r
getString("gb.skipSizeCalculation"),\r
getString("gb.skipSizeCalculationDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "skipSizeCalculation")));\r
\r
- form.add(new CheckboxOption("skipSummaryMetrics",\r
+ form.add(new BooleanOption("skipSummaryMetrics",\r
getString("gb.skipSummaryMetrics"),\r
getString("gb.skipSummaryMetricsDescription"),\r
new PropertyModel<Boolean>(repositoryModel, "skipSummaryMetrics")));\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.panels.AccessPolicyPanel;\r
-import com.gitblit.wicket.panels.CheckboxOption;\r
-import com.gitblit.wicket.panels.ConditionalChoiceOption;\r
+import com.gitblit.wicket.panels.BooleanOption;\r
+import com.gitblit.wicket.panels.BooleanChoiceOption;\r
import com.gitblit.wicket.panels.RepositoryNamePanel;\r
\r
public class NewRepositoryPage extends RootSubPage {\r
\r
// add README\r
addReadmeModel = Model.of(false);\r
- form.add(new CheckboxOption("addReadme",\r
+ form.add(new BooleanOption("addReadme",\r
getString("gb.initWithReadme"),\r
getString("gb.initWithReadmeDescription"),\r
addReadmeModel));\r
\r
gitignoreModel = Model.of("");\r
addGitignoreModel = Model.of(false);\r
- form.add(new ConditionalChoiceOption<String>("addGitIgnore",\r
+ form.add(new BooleanChoiceOption<String>("addGitIgnore",\r
getString("gb.initWithGitignore"),\r
getString("gb.initWithGitignoreDescription"),\r
addGitignoreModel,\r
\r
// TODO consider gitflow at creation (ticket-55)\r
addGitflowModel = Model.of(false);\r
- form.add(new CheckboxOption("addGitFlow",\r
+ form.add(new BooleanOption("addGitFlow",\r
"Include a .gitflow file",\r
"This will generate a config file which guides Git clients in setting up Gitflow branches.",\r
addGitflowModel).setVisible(false));\r
allowForks = Model.of(app().settings().getBoolean(Keys.web.allowForking, true));\r
if (allowForks.getObject()) {\r
Fragment fragment = new Fragment("allowForks", "allowForksFragment", this);\r
- fragment.add(new CheckboxOption("allowForks",\r
+ fragment.add(new BooleanOption("allowForks",\r
getString("gb.allowForks"),\r
getString("gb.allowForksDescription"),\r
allowForks));\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:panel>\r
+ <div style="padding-top:4px;">\r
+ <div>\r
+ <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>\r
+ </div>\r
+ <label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>\r
+ <p style="padding-top:5px;"><select class="span3" wicket:id="choice" /></p>\r
+ </label> \r
+ </div>\r
+</wicket:panel>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright 2014 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.wicket.panels;\r
+\r
+import java.util.List;\r
+\r
+import org.apache.wicket.ajax.AjaxRequestTarget;\r
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.form.CheckBox;\r
+import org.apache.wicket.markup.html.form.DropDownChoice;\r
+import org.apache.wicket.model.IModel;\r
+import org.parboiled.common.StringUtils;\r
+\r
+/**\r
+ * A re-usable conditional choice option panel.\r
+ *\r
+ * [x] title\r
+ * description\r
+ * [choices]\r
+ *\r
+ * @author James Moger\r
+ *\r
+ */\r
+public class BooleanChoiceOption<T> extends BasePanel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ final CheckBox checkbox;\r
+ final DropDownChoice<T> choice;\r
+\r
+ public BooleanChoiceOption(String wicketId, String title, String description, IModel<Boolean> checkboxModel, IModel<T> choiceModel, List<T> choices) {\r
+ super(wicketId);\r
+ add(new Label("name", title));\r
+ add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
+\r
+ this.checkbox = new CheckBox("checkbox", checkboxModel);\r
+ checkbox.setOutputMarkupId(true);\r
+\r
+ this.choice = new DropDownChoice<T>("choice", choiceModel, choices);\r
+ choice.setOutputMarkupId(true);\r
+\r
+ setup();\r
+ }\r
+\r
+ private void setup() {\r
+ add(checkbox);\r
+ add(choice.setMarkupId("choice").setEnabled(choice.getChoices().size() > 0));\r
+ choice.setEnabled(checkbox.getModelObject());\r
+\r
+ checkbox.add(new AjaxFormComponentUpdatingBehavior("onchange") {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ @Override\r
+ protected void onUpdate(AjaxRequestTarget target) {\r
+ choice.setEnabled(checkbox.getModelObject());\r
+ target.addComponent(choice);\r
+ if (!choice.isEnabled()) {\r
+ choice.setModelObject(null);\r
+ }\r
+ }\r
+ });\r
+ }\r
+}\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:panel>\r
+ <div style="padding-top:4px;">\r
+ <div>\r
+ <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>\r
+ </div>\r
+ <label class="checkbox" style="color:#777;" wicket:id="description"></label>\r
+ </div>\r
+</wicket:panel>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright 2014 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.wicket.panels;\r
+\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.form.CheckBox;\r
+import org.apache.wicket.model.IModel;\r
+import org.parboiled.common.StringUtils;\r
+\r
+/**\r
+ * A re-usable checkbox option panel.\r
+ *\r
+ * [x] title\r
+ * description\r
+ *\r
+ * @author James Moger\r
+ *\r
+ */\r
+public class BooleanOption extends BasePanel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public BooleanOption(String wicketId, String title, String description, IModel<Boolean> model) {\r
+ super(wicketId);\r
+ add(new Label("name", title));\r
+ add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
+ add(new CheckBox("checkbox", model));\r
+ }\r
+\r
+ public BooleanOption(String wicketId, String title, String description, CheckBox checkbox) {\r
+ super(wicketId);\r
+ add(new Label("name", title));\r
+ add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
+ add(checkbox.setMarkupId("checkbox"));\r
+ }\r
+\r
+ public BooleanOption setIsHtmlDescription(boolean val) {\r
+ ((Label) get("description")).setEscapeModelStrings(!val);\r
+ return this;\r
+ }\r
+}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:panel>\r
- <div style="padding-top:4px;">\r
- <div>\r
- <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>\r
- </div>\r
- <label class="checkbox" style="color:#777;" wicket:id="description"></label>\r
- </div>\r
-</wicket:panel>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright 2014 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.html.form.CheckBox;\r
-import org.apache.wicket.model.IModel;\r
-import org.parboiled.common.StringUtils;\r
-\r
-/**\r
- * A re-usable checkbox option panel.\r
- *\r
- * [x] title\r
- * description\r
- *\r
- * @author James Moger\r
- *\r
- */\r
-public class CheckboxOption extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public CheckboxOption(String wicketId, String title, String description, IModel<Boolean> model) {\r
- super(wicketId);\r
- add(new Label("name", title));\r
- add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
- add(new CheckBox("checkbox", model));\r
- }\r
-\r
- public CheckboxOption(String wicketId, String title, String description, CheckBox checkbox) {\r
- super(wicketId);\r
- add(new Label("name", title));\r
- add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
- add(checkbox.setMarkupId("checkbox"));\r
- }\r
-\r
- public CheckboxOption setIsHtmlDescription(boolean val) {\r
- ((Label) get("description")).setEscapeModelStrings(!val);\r
- return this;\r
- }\r
-}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:panel>\r
- <div style="padding-top:4px;">\r
- <div>\r
- <label style="font-weight:bold;" class="checkbox"><input type="checkbox" wicket:id="checkbox" /> <span wicket:id="name"></span></label>\r
- </div>\r
- <label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>\r
- <p style="padding-top:5px;"><select class="span3" wicket:id="choice" /></p>\r
- </label> \r
- </div>\r
-</wicket:panel>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright 2014 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.wicket.panels;\r
-\r
-import java.util.List;\r
-\r
-import org.apache.wicket.ajax.AjaxRequestTarget;\r
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.html.form.CheckBox;\r
-import org.apache.wicket.markup.html.form.DropDownChoice;\r
-import org.apache.wicket.model.IModel;\r
-import org.parboiled.common.StringUtils;\r
-\r
-/**\r
- * A re-usable conditional choice option panel.\r
- *\r
- * [x] title\r
- * description\r
- * [choices]\r
- *\r
- * @author James Moger\r
- *\r
- */\r
-public class ConditionalChoiceOption<T> extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- final CheckBox checkbox;\r
- final DropDownChoice<T> choice;\r
-\r
- public ConditionalChoiceOption(String wicketId, String title, String description, IModel<Boolean> checkboxModel, IModel<T> choiceModel, List<T> choices) {\r
- super(wicketId);\r
- add(new Label("name", title));\r
- add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
-\r
- this.checkbox = new CheckBox("checkbox", checkboxModel);\r
- checkbox.setOutputMarkupId(true);\r
-\r
- this.choice = new DropDownChoice<T>("choice", choiceModel, choices);\r
- choice.setOutputMarkupId(true);\r
-\r
- setup();\r
- }\r
-\r
- private void setup() {\r
- add(checkbox);\r
- add(choice.setMarkupId("choice").setEnabled(choice.getChoices().size() > 0));\r
- choice.setEnabled(checkbox.getModelObject());\r
-\r
- checkbox.add(new AjaxFormComponentUpdatingBehavior("onchange") {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- @Override\r
- protected void onUpdate(AjaxRequestTarget target) {\r
- choice.setEnabled(checkbox.getModelObject());\r
- target.addComponent(choice);\r
- if (!choice.isEnabled()) {\r
- choice.setModelObject(null);\r
- }\r
- }\r
- });\r
- }\r
-}\r
<b><span wicket:id="name"></span></b>\r
</div>\r
<label class="checkbox" style="color:#777;"> <span wicket:id="description"></span>\r
- <p style="padding-top:5px;"><input class="span2" type="text" wicket:id="text" /></p>\r
+ <p style="padding-top:5px;"><input class="span3" type="text" wicket:id="text" /></p>\r
</label>\r
\r
</div>\r