]> source.dussan.org Git - gitblit.git/commitdiff
Hide allow forks control if forking is disabled
authorJames Moger <james.moger@gitblit.com>
Tue, 3 Jun 2014 14:56:26 +0000 (10:56 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 3 Jun 2014 14:56:26 +0000 (10:56 -0400)
src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.html
src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java

index a2d76b7eb2d6f12e3ae97422cfec69be52fc97b4..87a020689a3780ad6faa6a9e30104e0585a74e2f 100644 (file)
                </div>\r
        </div>\r
        \r
+       <div wicket:id="allowForks"></div>\r
+       \r
+<wicket:fragment wicket:id="allowForksFragment">\r
        <hr />\r
        \r
        <div wicket:id="allowForks"></div>\r
-       \r
+</wicket:fragment>\r
 </wicket:panel>\r
 </body>\r
 </html>
\ No newline at end of file
index 4f2342639b20a249da5c8e8c828946513f023ccd..7a812307941e1f6d390ba8e3a7fa63c4ecd8d720 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.wicket.markup.html.form.Radio;
 import org.apache.wicket.markup.html.form.RadioGroup;\r
 import org.apache.wicket.markup.html.list.ListItem;\r
 import org.apache.wicket.markup.html.list.ListView;\r
+import org.apache.wicket.markup.html.panel.Fragment;\r
 import org.apache.wicket.model.IModel;\r
 import org.apache.wicket.model.Model;\r
 \r
@@ -145,11 +146,17 @@ public class AccessPolicyPanel extends BasePanel {
                }\r
                add(policiesGroup);\r
 \r
-               allowForks = Model.of(true);\r
-               add(new CheckboxOption("allowForks",\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
                                getString("gb.allowForks"),\r
                                getString("gb.allowForksDescription"),\r
-                               allowForks).setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));\r
+                               allowForks));\r
+                       add(fragment);\r
+               } else {\r
+                       add(new Label("allowForks").setVisible(false));\r
+               }\r
 \r
                setOutputMarkupId(true);\r
        }\r