@(groupNames: List[String],
isCreateRepoOptionPublic: Boolean)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
@gitbucket.core.html.main("Create a New Repository"){
<div class="content-wrapper main-center">
<div class="content body">
<h2>Create a new repository</h2>
<p class="muted">
A repository contains all the files for your project including the revision history.
</p>
<form id="form" method="post" action="@context.path/new" validate="true" autocomplete="off">
<fieldset class="border-top form-group">
<dl style="float: left;">
<dt>Owner</dt>
<dd style="margin-left: 0px;">
<div class="btn-group" id="owner-dropdown">
<button class="btn dropdown-toggle btn-default" data-toggle="dropdown">
<span class="strong">@helpers.avatar(context.loginAccount.get.userName, 20) @context.loginAccount.get.userName</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:void(0);" data-name="@context.loginAccount.get.userName"><i class="octicon octicon-check"></i> <span>@helpers.avatar(context.loginAccount.get.userName, 20) @context.loginAccount.get.userName</span></a></li>
@groupNames.map { groupName =>
<li><a href="javascript:void(0);" data-name="@groupName"><i class="octicon"></i> <span>@helpers.avatar(groupName, 20) @groupName</span></a></li>
}
</ul>
<input type="hidden" name="owner" id="owner" value="@context.loginAccount.get.userName"/>
</div>
</dd>
</dl>
<span class="slash" style="float: left; margin-left: 10px; margin-right: 10px; margin-top: 15px;">/</span>
<dl>
<dt>Repository name</dt>
<dd style="margin-left: 0px;">
<input type="text" name="name" id="name" class="form-control" style="width: 200px;" autofocus />
<span id="error-name" class="error"></span>
</dd>
</dl>
</fieldset>
<fieldset class="form-group">
<label for="description" class="strong">Description (optional):</label>
<input type="text" name="description" id="description" class="form-control" />
</fieldset>
<fieldset class="border-top">
<label class="radio">
<input type="radio" name="isPrivate" value="false" @if(isCreateRepoOptionPublic){checked}>
<span class="strong"><i class="octicon octicon-repo"></i> </i> Public</span>
<div class="normal muted">
Anyone can see this repository. You choose who can commit.
</div>
</label>
<label class="radio">
<input type="radio" name="isPrivate" value="true" @if(!isCreateRepoOptionPublic){checked}>
<span class="strong"><i class="octicon octicon-lock"></i> </i> Private</span>
<div class="normal muted">
You choose who can see and commit to this repository.
</div>
</label>
</fieldset>
<fieldset class="border-top">
<label class="radio">
<input type="radio" name="initOption" value="EMPTY" checked/>
<span class="strong">Create an empty repository</span>
<div class="normal muted">
Create an empty repository. You have to initialize by yourself initially.
</div>
</label>
<label class="radio">
<input type="radio" name="initOption" value="EMPTY_COMMIT"/>
<span class="strong">Initialize this repository with an empty commit</span>
<div class="normal muted">
Create an empty repository with empty commit. You can clone the repository immediately.
</div>
</label>
<label class="radio">
<input type="radio" name="initOption" value="README"/>
<span class="strong">Initialize this repository with a README</span>
<div class="normal muted">
Create a repository which has README.md. You can clone the repository immediately.
</div>
</label>
<label class="radio">
<input type="radio" name="initOption" value="COPY"/>
<span class="strong">Copy existing git repository</span>
<div class="normal muted">
Create new repository from existing git repository.
<input type="text" class="form-control" name="sourceUrl" id="sourceUrl" disabled placeholder="Source git repository URL..."/>
<span id="error-sourceUrl" class="error"></span>
</div>
</label>
</fieldset>
<fieldset class="border-top form-actions">
<input type="submit" class="btn btn-success" value="Create repository"/>
</fieldset>
</form>
</div>
</div>
}
<script>
$('#owner-dropdown a').click(function(){
var userName = $(this).data('name');
$('#owner').val(userName);
$('#owner-dropdown i').attr('class', 'octicon');
$(this).find('i').attr('class', 'octicon octicon-check');
$('#owner-dropdown span.strong').html($(this).find('span').html());
});
$('input[name=initOption]').click(function () {
$('#sourceUrl').prop('disabled', $('input[name=initOption]:checked').val() != 'COPY');
});
</script>