##// END OF EJS Templates
goto-switcher: optimized performance and query capabilities....
goto-switcher: optimized performance and query capabilities. - Previous implementation had on significant bug. The use of LIMIT 20 was limiting results BEFORE auth checks. In case of large ammount of similarly named repositories user didn't had access too, the result goto search was empty. This was becuase first 20 items fetched didn't pass permission checks and final auth list was empty. To fix this we now use proper filtering for auth using SQL. It means we first check user allowed repositories, and add this as a filter so end result from database is already to only the accessible repositories.

File last commit:

r1988:f7d6f6e1 default
r2038:2bdf9d4d default
Show More
fork.mako
129 lines | 4.7 KiB | application/x-mako | MakoHtmlLexer
## -*- coding: utf-8 -*-
<%inherit file="/base/base.mako"/>
<%def name="title()">
${_('Fork repository %s') % c.repo_name}
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="breadcrumbs_links()">
${_('New Fork')}
</%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='repositories')}
</%def>
<%def name="menu_bar_subnav()">
${self.repo_menu(active='options')}
</%def>
<%def name="main()">
<div class="box">
<div class="title">
${self.repo_page_title(c.rhodecode_db_repo)}
${self.breadcrumbs()}
</div>
${h.secure_form(h.route_path('repo_fork_create',repo_name=c.repo_info.repo_name), method='POST', request=request)}
<div class="form">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
<label for="repo_name">${_('Fork name')}:</label>
</div>
<div class="input">
${h.text('repo_name', class_="medium")}
${h.hidden('repo_type',c.repo_info.repo_type)}
${h.hidden('fork_parent_id',c.repo_info.repo_id)}
</div>
</div>
<div class="field">
<div class="label label-textarea">
<label for="description">${_('Description')}:</label>
</div>
<div class="textarea-repo textarea text-area editor">
${h.textarea('description')}
<span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span>
</div>
</div>
<div class="field">
<div class="label">
<label for="repo_group">${_('Repository group')}:</label>
</div>
<div class="select">
${h.select('repo_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 (%(repo_group_name)s)') % {'repo_group_name': 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">
<label for="landing_rev">${_('Landing commit')}:</label>
</div>
<div class="select">
${h.select('landing_rev','',c.landing_revs,class_="medium")}
<span class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</span>
</div>
</div>
<div class="field">
<div class="label label-checkbox">
<label for="private">${_('Private')}:</label>
</div>
<div class="checkboxes">
${h.checkbox('private',value="True")}
<span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
</div>
</div>
<div class="field">
<div class="label label-checkbox">
<label for="private">${_('Copy permissions')}:</label>
</div>
<div class="checkboxes">
${h.checkbox('copy_permissions',value="True", checked="checked")}
<span class="help-block">${_('Copy permissions from forked repository')}</span>
</div>
</div>
<div class="buttons">
${h.submit('',_('Fork this Repository'),class_="btn")}
</div>
</div>
</div>
${h.end_form()}
</div>
<script>
$(document).ready(function(){
$("#repo_group").select2({
'dropdownAutoWidth': true,
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'width': "resolve"
});
$("#landing_rev").select2({
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'minimumResultsForSearch': -1
});
$('#repo_name').focus();
$('#select_my_group').on('click', function(e){
e.preventDefault();
$("#repo_group").val($(this).data('personalGroupId')).trigger("change");
})
})
</script>
</%def>