| | |
| | | import java.util.Set;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.behavior.SimpleAttributeModifier;
|
| | | import org.apache.wicket.extensions.markup.html.form.palette.Palette;
|
| | | import org.apache.wicket.markup.html.form.Button;
|
| | | import org.apache.wicket.markup.html.form.CheckBox;
|
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.GitBlitException;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.ArrayUtils;
|
| | |
| | | }
|
| | | };
|
| | |
|
| | | // do not let the browser pre-populate these fields
|
| | | form.add(new SimpleAttributeModifier("autocomplete", "off"));
|
| | |
|
| | | // field names reflective match RepositoryModel fields
|
| | | form.add(new TextField<String>("name").setEnabled(isCreate || isAdmin));
|
| | | form.add(new TextField<String>("description"));
|
| | |
| | | form.add(new CheckBox("isFrozen"));
|
| | | // TODO enable origin definition
|
| | | form.add(new TextField<String>("origin").setEnabled(false/* isCreate */));
|
| | | // enable alteration of the default branch after clone
|
| | | form.add(new DropDownChoice<RefModel>("defaultHead", repositoryModel.availableHeads,
|
| | | new RefModelRenderer()).setEnabled(GitBlitWebSession.get().canAdmin()));
|
| | | |
| | | // allow relinking HEAD to a branch or tag other than master on edit repository
|
| | | List<String> availableRefs = new ArrayList<String>();
|
| | | if (!ArrayUtils.isEmpty(repositoryModel.availableRefs)) {
|
| | | availableRefs.addAll(repositoryModel.availableRefs);
|
| | | }
|
| | | form.add(new DropDownChoice<String>("HEAD", availableRefs).setEnabled(!isCreate));
|
| | |
|
| | | // federation strategies - remove ORIGIN choice if this repository has
|
| | | // no origin.
|
| | |
| | | } else {
|
| | | // No Administration Permitted
|
| | | error("Administration is disabled", true);
|
| | | }
|
| | | }
|
| | |
|
| | | private class RefModelRenderer implements IChoiceRenderer<RefModel> {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Override
|
| | | public String getDisplayValue(RefModel type) {
|
| | | return type.displayName;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getIdValue(RefModel type, int index) {
|
| | | return type.getName();
|
| | | }
|
| | | }
|
| | |
|