##// END OF EJS Templates
search: pre-select menu entry when doing specialized searches for repository.
marcink -
r3783:0fee1faa default
parent child Browse files
Show More
@@ -1,216 +1,217 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 %if c.repo_name:
6 6 ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)}
7 7 %elif c.repo_group_name:
8 8 ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)}
9 9 %else:
10 10 ${_('Search inside all accessible repositories')}
11 11 %endif
12 12 %if c.rhodecode_name:
13 13 &middot; ${h.branding(c.rhodecode_name)}
14 14 %endif
15 15 </%def>
16 16
17 17 <%def name="breadcrumbs_links()">
18 18 %if c.repo_name:
19 19 ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)}
20 20 %elif c.repo_group_name:
21 21 ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)}
22 22 %else:
23 23 ${_('Search inside all accessible repositories')}
24 24 %endif
25 25
26 26 </%def>
27 27
28 28 <%def name="menu_bar_nav()">
29 29 %if c.repo_name:
30 30 ${self.menu_items(active='search')}
31 31 %elif c.repo_group_name:
32 32 ${self.menu_items(active='search')}
33 33 %else:
34 34 ${self.menu_items(active='search')}
35 35 %endif
36 36 </%def>
37 37
38 38 <%def name="menu_bar_subnav()">
39 39 %if c.repo_name:
40 ${self.repo_menu(active='summary')}
40 <% active_entry = {'content':'files', 'path':'files', 'commit':'commits'}.get(c.search_type, 'summary')%>
41 ${self.repo_menu(active=active_entry)}
41 42 %elif c.repo_group_name:
42 43 ${self.repo_group_menu(active='home')}
43 44 %endif
44 45 </%def>
45 46
46 47 <%def name="repo_icon(db_repo)">
47 48 %if h.is_hg(db_repo):
48 49 <i class="icon-hg"></i>
49 50 %endif
50 51 %if h.is_git(db_repo):
51 52 <i class="icon-git"></i>
52 53 %endif
53 54 %if h.is_svn(db_repo):
54 55 <i class="icon-svn"></i>
55 56 %endif
56 57 </%def>
57 58
58 59 <%def name="repo_group_icon()">
59 60 <i class="icon-repo-group"></i>
60 61 </%def>
61 62
62 63 <%def name="main()">
63 64 <div class="box">
64 65 %if c.repo_name:
65 66 <!-- box / title -->
66 67 ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')}
67 68 %elif c.repo_group_name:
68 69 <!-- box / title -->
69 70 ${h.form(h.route_path('search_repo_group',repo_group_name=c.repo_group_name),method='get')}
70 71 %else:
71 72 <!-- box / title -->
72 73 <div class="title">
73 74 ${self.breadcrumbs()}
74 75 <ul class="links">&nbsp;</ul>
75 76 </div>
76 77 <!-- end box / title -->
77 78 ${h.form(h.route_path('search'), method='get')}
78 79 %endif
79 80 <div class="form search-form">
80 81 <div class="fields">
81 82
82 83 ${h.text('q', c.cur_query, placeholder="Enter query...")}
83 84
84 85 ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')}
85 86 ${h.hidden('max_lines', '10')}
86 87
87 88 <input type="submit" value="${_('Search')}" class="btn"/>
88 89 <br/>
89 90
90 91 <div class="search-tags">
91 92 <span class="tag tag8">
92 93 %if c.repo_name:
93 94 <a href="${h.route_path('search', _query={'q': c.cur_query, 'type': request.GET.get('type', 'content')})}">${_('Global Search')}</a>
94 95 %elif c.repo_group_name:
95 96 <a href="${h.route_path('search', _query={'q': c.cur_query, 'type': request.GET.get('type', 'content')})}">${_('Global Search')}</a>
96 97 % else:
97 98 ${_('Global Search')}
98 99 %endif
99 100 </span>
100 101
101 102 %if c.repo_name:
102 103 Β»
103 104 <span class="tag tag8">
104 105 ${repo_icon(c.rhodecode_db_repo)}
105 106 ${c.repo_name}
106 107 </span>
107 108
108 109 %elif c.repo_group_name:
109 110 Β»
110 111 <span class="tag tag8">
111 112 ${repo_group_icon()}
112 113 ${c.repo_group_name}
113 114 </span>
114 115 %endif
115 116
116 117
117 118 % for search_tag in c.search_tags:
118 119 <br/><span class="tag disabled" style="margin-top: 3px">${search_tag}</span>
119 120 % endfor
120 121
121 122 </div>
122 123
123 124 <div class="search-feedback-items">
124 125 % for error in c.errors:
125 126 <span class="error-message">
126 127 % for k,v in error.asdict().items():
127 128 ${k} - ${v}
128 129 % endfor
129 130 </span>
130 131 % endfor
131 132 <div class="field">
132 133 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Langague examples')}</p>
133 134 <pre id="search-help" style="display: none">\
134 135
135 136 % if c.searcher.name == 'whoosh':
136 137 Example filter terms for `Whoosh` search:
137 138 query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a>
138 139 Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
139 140
140 141 Generate wildcards using '*' character:
141 142 "repo_name:vcs*" - search everything starting with 'vcs'
142 143 "repo_name:*vcs*" - search for repository containing 'vcs'
143 144
144 145 Optional AND / OR operators in queries
145 146 "repo_name:vcs OR repo_name:test"
146 147 "owner:test AND repo_name:test*" AND extension:py
147 148
148 149 Move advanced search is available via ElasticSearch6 backend in EE edition.
149 150 % elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2':
150 151 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
151 152 ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
152 153
153 154 search type: content (File Content)
154 155 indexed fields: content
155 156
156 157 # search for `fix` string in all files
157 158 fix
158 159
159 160 search type: commit (Commit message)
160 161 indexed fields: message
161 162
162 163 search type: path (File name)
163 164 indexed fields: path
164 165
165 166 % else:
166 167 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
167 168 query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a>
168 169 The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
169 170 % for handler in c.searcher.get_handlers().values():
170 171
171 172 search type: ${handler.search_type_label}
172 173 *indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])}
173 174 % for entry in handler.es_6_example_queries:
174 175 ${entry.rstrip()}
175 176 % endfor
176 177 % endfor
177 178
178 179 % endif
179 180 </pre>
180 181 </div>
181 182
182 183 <div class="field">${c.runtime}</div>
183 184 </div>
184 185 </div>
185 186 </div>
186 187
187 188 ${h.end_form()}
188 189 <div class="search">
189 190 % if c.search_type == 'content':
190 191 <%include file='search_content.mako'/>
191 192 % elif c.search_type == 'path':
192 193 <%include file='search_path.mako'/>
193 194 % elif c.search_type == 'commit':
194 195 <%include file='search_commit.mako'/>
195 196 % elif c.search_type == 'repository':
196 197 <%include file='search_repository.mako'/>
197 198 % endif
198 199 </div>
199 200 </div>
200 201 <script>
201 202 $(document).ready(function(){
202 203 $("#id_search_type").select2({
203 204 'containerCssClass': "drop-menu",
204 205 'dropdownCssClass': "drop-menu-dropdown",
205 206 'dropdownAutoWidth': true,
206 207 'minimumResultsForSearch': -1
207 208 });
208 209
209 210 $('#q').autoGrowInput({maxWidth: 920});
210 211
211 212 setTimeout(function() {
212 213 $('#q').keyup()
213 214 }, 1);
214 215 })
215 216 </script>
216 217 </%def>
General Comments 0
You need to be logged in to leave comments. Login now