##// END OF EJS Templates
form-validators: fixed usage of deprecated methods, and few py3 fixes
form-validators: fixed usage of deprecated methods, and few py3 fixes

File last commit:

r4091:4e2f3dca default
r5020:c2969528 default
Show More
search.mako
241 lines | 7.6 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:
dan
search: new UI for search, and repo group context search...
r3442 ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)}
%elif c.repo_group_name:
${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)}
templating: use .mako as extensions for template files.
r1282 %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:
dan
search: new UI for search, and repo group context search...
r3442 ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)}
%elif c.repo_group_name:
${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)}
templating: use .mako as extensions for template files.
r1282 %else:
${_('Search inside all accessible repositories')}
%endif
dan
search: add support for elastic search 6...
r3319
templating: use .mako as extensions for template files.
r1282 </%def>
<%def name="menu_bar_nav()">
%if c.repo_name:
dan
search: new UI for search, and repo group context search...
r3442 ${self.menu_items(active='search')}
%elif c.repo_group_name:
${self.menu_items(active='search')}
templating: use .mako as extensions for template files.
r1282 %else:
${self.menu_items(active='search')}
%endif
</%def>
<%def name="menu_bar_subnav()">
%if c.repo_name:
search: pre-select menu entry when doing specialized searches for repository.
r3783 <% active_entry = {'content':'files', 'path':'files', 'commit':'commits'}.get(c.search_type, 'summary')%>
${self.repo_menu(active=active_entry)}
dan
search: new UI for search, and repo group context search...
r3442 %elif c.repo_group_name:
go-to search: updated logic of goto switcher...
r3556 ${self.repo_group_menu(active='home')}
templating: use .mako as extensions for template files.
r1282 %endif
</%def>
search: added narrow result links for global search.
r3467 <%def name="repo_icon(db_repo)">
%if h.is_hg(db_repo):
<i class="icon-hg"></i>
%endif
%if h.is_git(db_repo):
<i class="icon-git"></i>
%endif
%if h.is_svn(db_repo):
<i class="icon-svn"></i>
%endif
</%def>
<%def name="repo_group_icon()">
icons: updated iconography and fontello configuration
r3680 <i class="icon-repo-group"></i>
search: added narrow result links for global search.
r3467 </%def>
search: allow result sorting for elasticsearch6
r3963
<%def name="field_sort(field_name)">
<%
if c.sort.startswith('asc:'):
dan
webhelpers: replaced paginate library with custom lib
r4091 return h.current_route_path(request, sort='desc:{}'.format(field_name))
search: allow result sorting for elasticsearch6
r3963 elif c.sort.startswith('desc:'):
dan
webhelpers: replaced paginate library with custom lib
r4091 return h.current_route_path(request, sort='asc:{}'.format(field_name))
search: allow result sorting for elasticsearch6
r3963
dan
webhelpers: replaced paginate library with custom lib
r4091 return h.current_route_path(request, sort='asc:{}'.format(field_name))
search: allow result sorting for elasticsearch6
r3963 %>
</%def>
templating: use .mako as extensions for template files.
r1282 <%def name="main()">
<div class="box">
%if c.repo_name:
<!-- box / title -->
search: moved search into pyramid views.
r1685 ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')}
dan
search: new UI for search, and repo group context search...
r3442 %elif c.repo_group_name:
<!-- box / title -->
${h.form(h.route_path('search_repo_group',repo_group_name=c.repo_group_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">
dan
search: new UI for search, and repo group context search...
r3442
ui: dropped the custom font in favor of builtin ones....
r3164 ${h.text('q', c.cur_query, placeholder="Enter query...")}
templating: use .mako as extensions for template files.
r1282
dan
search: add support for elastic search 6...
r3319 ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')}
${h.hidden('max_lines', '10')}
dan
search: new UI for search, and repo group context search...
r3442
templating: use .mako as extensions for template files.
r1282 <input type="submit" value="${_('Search')}" class="btn"/>
<br/>
search: added basic example query block.
r1684
dan
search: new UI for search, and repo group context search...
r3442 <div class="search-tags">
dan
search: make better use of search tags...
r3446 <span class="tag tag8">
%if c.repo_name:
search: added narrow result links for global search.
r3467 <a href="${h.route_path('search', _query={'q': c.cur_query, 'type': request.GET.get('type', 'content')})}">${_('Global Search')}</a>
dan
search: make better use of search tags...
r3446 %elif c.repo_group_name:
search: added narrow result links for global search.
r3467 <a href="${h.route_path('search', _query={'q': c.cur_query, 'type': request.GET.get('type', 'content')})}">${_('Global Search')}</a>
dan
search: make better use of search tags...
r3446 % else:
${_('Global Search')}
%endif
</span>
dan
search: new UI for search, and repo group context search...
r3442 %if c.repo_name:
dan
search: make better use of search tags...
r3446 »
<span class="tag tag8">
search: added narrow result links for global search.
r3467 ${repo_icon(c.rhodecode_db_repo)}
dan
search: new UI for search, and repo group context search...
r3442 ${c.repo_name}
</span>
%elif c.repo_group_name:
dan
search: make better use of search tags...
r3446 »
<span class="tag tag8">
search: added narrow result links for global search.
r3467 ${repo_group_icon()}
dan
search: new UI for search, and repo group context search...
r3442 ${c.repo_group_name}
</span>
%endif
search: allow result sorting for elasticsearch6
r3963 % if c.sort_tag:
<span class="tag tag8">
% if c.sort_tag_dir == 'asc':
<i class="icon-angle-down"></i>
% elif c.sort_tag_dir == 'desc':
<i class="icon-angle-up"></i>
% endif
${_('sort')}:${c.sort_tag}
</span>
% endif
dan
search: make better use of search tags...
r3446
dan
search: new UI for search, and repo group context search...
r3442 % for search_tag in c.search_tags:
dan
search: make better use of search tags...
r3446 <br/><span class="tag disabled" style="margin-top: 3px">${search_tag}</span>
dan
search: new UI for search, and repo group context search...
r3442 % endfor
</div>
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">
search: allow result sorting for elasticsearch6
r3963 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Language examples')}</p>
dan
search: add support for elastic search 6...
r3319 <pre id="search-help" style="display: none">\
% if c.searcher.name == 'whoosh':
Example filter terms for `Whoosh` search:
query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a>
Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
Generate wildcards using '*' character:
"repo_name:vcs*" - search everything starting with 'vcs'
"repo_name:*vcs*" - search for repository containing 'vcs'
Optional AND / OR operators in queries
"repo_name:vcs OR repo_name:test"
"owner:test AND repo_name:test*" AND extension:py
Move advanced search is available via ElasticSearch6 backend in EE edition.
% elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2':
Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
search type: content (File Content)
indexed fields: content
# search for `fix` string in all files
fix
search type: commit (Commit message)
indexed fields: message
search type: path (File name)
indexed fields: path
% else:
Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a>
The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
% for handler in c.searcher.get_handlers().values():
search type: ${handler.search_type_label}
*indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])}
% for entry in handler.es_6_example_queries:
${entry.rstrip()}
% endfor
% endfor
% endif
</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
});
dan
search: new UI for search, and repo group context search...
r3442
$('#q').autoGrowInput({maxWidth: 920});
setTimeout(function() {
$('#q').keyup()
}, 1);
templating: use .mako as extensions for template files.
r1282 })
</script>
</%def>