feature(repo): added ability to bootstrap repositories on creation
This commit is contained in:
parent
6f780dccb1
commit
ee52770fff
4 changed files with 176 additions and 30 deletions
|
|
@ -5,16 +5,91 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
<div class="fields">
|
||||
<div class="field">
|
||||
<div class="label">
|
||||
<label for="repo_name">${_('Repository name')}:</label>
|
||||
<label for="repo_name">${_('Repository')}:</label>
|
||||
</div>
|
||||
<style>
|
||||
.help-block-repo-create {
|
||||
|
||||
color: #949494;
|
||||
|
||||
}
|
||||
.repo-header-row {
|
||||
display: flex; /* Modern way to align elements inline */
|
||||
align-items: center; /* Keeps text perfectly leveled vertically */
|
||||
gap: 4px; /* Space between the label and the link */
|
||||
margin: 10px 0; /* Space below the entire row */
|
||||
|
||||
}
|
||||
|
||||
#copy_perms {
|
||||
/* Layout & Alignment */
|
||||
display: flex;
|
||||
align-items: center; /* Aligns checkbox with the first line of text */
|
||||
|
||||
/* Spacing for the whole row */
|
||||
margin: 15px 0; /* Space above and below the row */
|
||||
|
||||
/* Internal Spacing */
|
||||
gap: 6px; /* Space specifically between checkbox and text */
|
||||
}
|
||||
|
||||
#checkbox-span {
|
||||
align-items: center; /* Aligns checkbox with the first line of text */
|
||||
padding-top: 2px; /* Micro-adjustment to center checkbox with text line */
|
||||
}
|
||||
|
||||
.help-block-inline {
|
||||
font-size: 14px; /* Standard readable size */
|
||||
line-height: 1.4; /* Improves readability for multi-line text */
|
||||
color: #333; /* Professional dark grey */
|
||||
}
|
||||
|
||||
.repo-create-spacer {
|
||||
margin: 0 4px;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div class="input">
|
||||
${h.text('repo_name', class_="medium")}
|
||||
<div class="info-block">
|
||||
<a id="remote_clone_toggle" href="#">${_('Import Existing Repository ?')}</a>
|
||||
|
||||
${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
|
||||
<span class="repo-create-spacer"> / </span>
|
||||
${h.text('repo_name', class_="medium", id="repo_name_input")}
|
||||
|
||||
% if c.personal_repo_group:
|
||||
<a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
|
||||
${_('Select my personal group ({})').format(c.personal_repo_group.group_name)}
|
||||
</a>
|
||||
% endif
|
||||
|
||||
<div class="repo-header-row">
|
||||
<span class="help-block-repo-create">
|
||||
${_('Repository Group / Repository Name')}.
|
||||
</span>
|
||||
<div class="import-repo">
|
||||
<a id="remote_clone_toggle" href="#">${_('Import an existing repository.')}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## COPY PERMS
|
||||
<div id="copy_perms">
|
||||
<div id="checkbox-span">
|
||||
${h.checkbox('repo_copy_permissions', value="True", checked="checked")}
|
||||
</div>
|
||||
|
||||
<div class="help-block-inline">
|
||||
${_('Copy permissions from parent repository group.')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## TODO: what is this ? i don't think we use it anymore
|
||||
%if not c.rhodecode_user.is_admin:
|
||||
${h.hidden('user_created',True)}
|
||||
%endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="remote_clone" class="field" style="display: none;">
|
||||
|
|
@ -37,20 +112,6 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="label">
|
||||
<label for="repo_group">${_('Repository group')}:</label>
|
||||
</div>
|
||||
<div class="select">
|
||||
${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
|
||||
% if c.personal_repo_group:
|
||||
<a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
|
||||
${_('Select my personal group ({})').format(c.personal_repo_group.group_name)}
|
||||
</a>
|
||||
% endif
|
||||
<span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="label">
|
||||
|
|
@ -58,7 +119,6 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
</div>
|
||||
<div class="fields repo-type-radio">
|
||||
|
||||
|
||||
% for backend in c.backends:
|
||||
% if loop.index == 0:
|
||||
<input id="repo_type_${backend}" name="repo_type" type="radio" value="${backend}" checked="checked"/>
|
||||
|
|
@ -73,7 +133,6 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
|
||||
% endfor
|
||||
|
||||
|
||||
<span class="help-block">${_('Set the type of repository to create.')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -98,15 +157,7 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="copy_perms" class="field">
|
||||
<div class="label label-checkbox">
|
||||
<label for="repo_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
|
||||
</div>
|
||||
<div class="checkboxes">
|
||||
${h.checkbox('repo_copy_permissions', value="True", checked="checked")}
|
||||
<span class="help-block">${_('Copy permissions from parent repository group.')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="label label-checkbox">
|
||||
<label for="repo_private">${_('Private Repository')}:</label>
|
||||
|
|
@ -116,6 +167,28 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
<span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field repo-bootstrap-items">
|
||||
<div class="label label-checkbox">
|
||||
<label for="repo_bootstrap_readme">${_('Add Readme')}:</label>
|
||||
</div>
|
||||
<div class="checkboxes">
|
||||
${h.checkbox('repo_bootstrap_readme',value="True")}
|
||||
<span class="help-block">${_('Initialize repository with a README. Allows you to immediately clone this project’s repository.')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field repo-bootstrap-items">
|
||||
<div class="label label-checkbox">
|
||||
<label for="repo_bootstrap_svn_branch_struct">${_('Add SVN structure')}:</label>
|
||||
</div>
|
||||
<div class="checkboxes">
|
||||
${h.checkbox('repo_bootstrap_svn_branch_struct',value="True")}
|
||||
<span class="help-block">${_('Initialize repository with a branches/tags DIRS')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="buttons">
|
||||
${h.submit('save',_('Create Repository'),class_="btn")}
|
||||
</div>
|
||||
|
|
@ -135,6 +208,8 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
$('#remote_clone_toggle').on('click', function(e){
|
||||
$('#remote_clone').show();
|
||||
e.preventDefault();
|
||||
$('#remote_clone_toggle').hide();
|
||||
$('.repo-bootstrap-items').remove();
|
||||
});
|
||||
|
||||
if($('#remote_clone input').hasClass('error')){
|
||||
|
|
@ -163,6 +238,21 @@ ${h.secure_form(h.route_path('repo_create'), request=request)}
|
|||
$("#repo_group").val($(this).data('personalGroupId')).trigger("change");
|
||||
})
|
||||
|
||||
|
||||
$('#clone_uri').on('input paste', function(e) {
|
||||
var url = $(this).val().trim();
|
||||
if (url) {
|
||||
var parts = url.split('/').filter(Boolean);
|
||||
var lastPart = parts[parts.length - 1];
|
||||
var repoName = lastPart.replace(/\.git$/, "");
|
||||
|
||||
$('#repo_name_input').val(repoName);
|
||||
}
|
||||
else {
|
||||
$('#repo_name_input').val("");
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
${h.end_form()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue