summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java')
-rw-r--r--src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
index 057b96f4..7aa801f4 100644
--- a/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/AccessPolicyPanel.java
@@ -21,10 +21,13 @@ 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;
import com.gitblit.Constants.AccessRestrictionType;
@@ -49,6 +52,8 @@ public class AccessPolicyPanel extends BasePanel {
private RadioGroup<AccessPolicy> policiesGroup;
+ private IModel<Boolean> allowForks;
+
public AccessPolicyPanel(String wicketId, RepositoryModel repository) {
this(wicketId, repository, null);
}
@@ -142,13 +147,28 @@ public class AccessPolicyPanel extends BasePanel {
}
add(policiesGroup);
+ allowForks = Model.of(true);
+ add(newCheckbox("allowForks",
+ getString("gb.allowForks"),
+ getString("gb.allowForksDescription"),
+ allowForks).setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));
+
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;
repository.accessRestriction = policy.type;
+ repository.allowForks = allowForks.getObject();
}
@Override