##// 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:

r1922:4edc1a1e default
r2038:2bdf9d4d default
Show More
search.mako
108 lines | 3.2 KiB | application/x-mako | MakoHtmlLexer
templating: use .mako as extensions for template files.
r1282 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.mako"/>
<%def name="title()">
%if c.repo_name:
${_('Search inside repository %(repo_name)s') % {'repo_name': c.repo_name}}
%else:
${_('Search inside all accessible repositories')}
%endif
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="breadcrumbs_links()">
%if c.repo_name:
${_('Search inside repository %(repo_name)s') % {'repo_name': c.repo_name}}
%else:
${_('Search inside all accessible repositories')}
%endif
%if c.cur_query:
&raquo;
${c.cur_query}
%endif
</%def>
<%def name="menu_bar_nav()">
%if c.repo_name:
${self.menu_items(active='repositories')}
%else:
${self.menu_items(active='search')}
%endif
</%def>
<%def name="menu_bar_subnav()">
%if c.repo_name:
${self.repo_menu(active='options')}
%endif
</%def>
<%def name="main()">
<div class="box">
%if c.repo_name:
<!-- box / title -->
<div class="title">
${self.repo_page_title(c.rhodecode_db_repo)}
</div>
search: moved search into pyramid views.
r1685 ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')}
templating: use .mako as extensions for template files.
r1282 %else:
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
<ul class="links">&nbsp;</ul>
</div>
<!-- end box / title -->
search: moved search into pyramid views.
r1685 ${h.form(h.route_path('search'), method='get')}
templating: use .mako as extensions for template files.
r1282 %endif
<div class="form search-form">
<div class="fields">
<label for="q">${_('Search item')}:</label>
${h.text('q', c.cur_query)}
${h.select('type',c.search_type,[('content',_('File contents')), ('commit',_('Commit messages')), ('path',_('File names')),],id='id_search_type')}
<input type="submit" value="${_('Search')}" class="btn"/>
<br/>
search: added basic example query block.
r1684
templating: use .mako as extensions for template files.
r1282 <div class="search-feedback-items">
% for error in c.errors:
<span class="error-message">
% for k,v in error.asdict().items():
${k} - ${v}
% endfor
</span>
% endfor
search: added basic example query block.
r1684 <div class="field">
<p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
pyramid: use explicit c var for globals passed in templates instead of the global 'request'
r1922 <pre id="search-help" style="display: none">${h.tooltip(h.search_filter_help(c.searcher, c.pyramid_request))}</pre>
search: added basic example query block.
r1684 </div>
templating: use .mako as extensions for template files.
r1282 <div class="field">${c.runtime}</div>
</div>
</div>
</div>
search: added basic example query block.
r1684
templating: use .mako as extensions for template files.
r1282 ${h.end_form()}
<div class="search">
% if c.search_type == 'content':
<%include file='search_content.mako'/>
% elif c.search_type == 'path':
<%include file='search_path.mako'/>
% elif c.search_type == 'commit':
<%include file='search_commit.mako'/>
% elif c.search_type == 'repository':
<%include file='search_repository.mako'/>
% endif
</div>
</div>
<script>
$(document).ready(function(){
$("#id_search_type").select2({
'containerCssClass': "drop-menu",
'dropdownCssClass': "drop-menu-dropdown",
'dropdownAutoWidth': true,
'minimumResultsForSearch': -1
});
})
</script>
</%def>