From 2d291de884b4bb3164fda516ebc8510f757495b7 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 3 Jun 2014 10:56:26 -0400 Subject: [PATCH] Hide allow forks control if forking is disabled --- .../gitblit/wicket/panels/AccessPolicyPanel.html | 5 ++++- .../gitblit/wicket/panels/AccessPolicyPanel.java | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html index a2d76b7e..87a02068 100644 --- a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html +++ b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html @@ -19,10 +19,13 @@ +
+ +
- +
\ 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 4f234263..7a812307 100644 --- a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java @@ -25,6 +25,7 @@ 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; @@ -145,11 +146,17 @@ public class AccessPolicyPanel extends BasePanel { } add(policiesGroup); - allowForks = Model.of(true); - add(new CheckboxOption("allowForks", + allowForks = Model.of(app().settings().getBoolean(Keys.web.allowForking, true)); + if (allowForks.getObject()) { + Fragment fragment = new Fragment("allowForks", "allowForksFragment", this); + fragment.add(new CheckboxOption("allowForks", getString("gb.allowForks"), getString("gb.allowForksDescription"), - allowForks).setEnabled(app().settings().getBoolean(Keys.web.allowForking, true))); + allowForks)); + add(fragment); + } else { + add(new Label("allowForks").setVisible(false)); + } setOutputMarkupId(true); } -- 2.39.5