diff options
author | James Moger <james.moger@gitblit.com> | 2014-06-03 10:56:26 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-06-03 10:56:26 -0400 |
commit | 2d291de884b4bb3164fda516ebc8510f757495b7 (patch) | |
tree | e734d62a66e9667d8a024142d0f3ba8a28f27549 | |
parent | 42972d830611fa4b1aa2c2c49c824a15e1987597 (diff) | |
download | gitblit-2d291de884b4bb3164fda516ebc8510f757495b7.tar.gz gitblit-2d291de884b4bb3164fda516ebc8510f757495b7.zip |
Hide allow forks control if forking is disabled
-rw-r--r-- | src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html | 5 | ||||
-rw-r--r-- | src/main/java/com/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 @@ </div>
</div>
+ <div wicket:id="allowForks"></div>
+
+<wicket:fragment wicket:id="allowForksFragment">
<hr />
<div wicket:id="allowForks"></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 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);
}
|