##// END OF EJS Templates
ui: expose search as a visible option for repositories.
ergo -
r3440:92d2ae7e default
parent child Browse files
Show More
@@ -1,138 +1,138 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2011-2019 RhodeCode GmbH
3 # Copyright (C) 2011-2019 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import logging
21 import logging
22 import urllib
22 import urllib
23 from pyramid.view import view_config
23 from pyramid.view import view_config
24 from webhelpers.util import update_params
24 from webhelpers.util import update_params
25
25
26 from rhodecode.apps._base import BaseAppView, RepoAppView
26 from rhodecode.apps._base import BaseAppView, RepoAppView
27 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
27 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
28 from rhodecode.lib.helpers import Page
28 from rhodecode.lib.helpers import Page
29 from rhodecode.lib.utils2 import safe_str
29 from rhodecode.lib.utils2 import safe_str
30 from rhodecode.lib.index import searcher_from_config
30 from rhodecode.lib.index import searcher_from_config
31 from rhodecode.model import validation_schema
31 from rhodecode.model import validation_schema
32 from rhodecode.model.validation_schema.schemas import search_schema
32 from rhodecode.model.validation_schema.schemas import search_schema
33
33
34 log = logging.getLogger(__name__)
34 log = logging.getLogger(__name__)
35
35
36
36
37 def search(request, tmpl_context, repo_name):
37 def search(request, tmpl_context, repo_name):
38 searcher = searcher_from_config(request.registry.settings)
38 searcher = searcher_from_config(request.registry.settings)
39 formatted_results = []
39 formatted_results = []
40 execution_time = ''
40 execution_time = ''
41
41
42 schema = search_schema.SearchParamsSchema()
42 schema = search_schema.SearchParamsSchema()
43
43
44 search_params = {}
44 search_params = {}
45 errors = []
45 errors = []
46 try:
46 try:
47 search_params = schema.deserialize(
47 search_params = schema.deserialize(
48 dict(
48 dict(
49 search_query=request.GET.get('q'),
49 search_query=request.GET.get('q'),
50 search_type=request.GET.get('type'),
50 search_type=request.GET.get('type'),
51 search_sort=request.GET.get('sort'),
51 search_sort=request.GET.get('sort'),
52 search_max_lines=request.GET.get('max_lines'),
52 search_max_lines=request.GET.get('max_lines'),
53 page_limit=request.GET.get('page_limit'),
53 page_limit=request.GET.get('page_limit'),
54 requested_page=request.GET.get('page'),
54 requested_page=request.GET.get('page'),
55 )
55 )
56 )
56 )
57 except validation_schema.Invalid as e:
57 except validation_schema.Invalid as e:
58 errors = e.children
58 errors = e.children
59
59
60 def url_generator(**kw):
60 def url_generator(**kw):
61 q = urllib.quote(safe_str(search_query))
61 q = urllib.quote(safe_str(search_query))
62 return update_params(
62 return update_params(
63 "?q=%s&type=%s&max_lines=%s" % (q, safe_str(search_type), search_max_lines), **kw)
63 "?q=%s&type=%s&max_lines=%s" % (q, safe_str(search_type), search_max_lines), **kw)
64
64
65 c = tmpl_context
65 c = tmpl_context
66 search_query = search_params.get('search_query')
66 search_query = search_params.get('search_query')
67 search_type = search_params.get('search_type')
67 search_type = search_params.get('search_type')
68 search_sort = search_params.get('search_sort')
68 search_sort = search_params.get('search_sort')
69 search_max_lines = search_params.get('search_max_lines')
69 search_max_lines = search_params.get('search_max_lines')
70 if search_params.get('search_query'):
70 if search_params.get('search_query'):
71 page_limit = search_params['page_limit']
71 page_limit = search_params['page_limit']
72 requested_page = search_params['requested_page']
72 requested_page = search_params['requested_page']
73
73
74 try:
74 try:
75 search_result = searcher.search(
75 search_result = searcher.search(
76 search_query, search_type, c.auth_user, repo_name,
76 search_query, search_type, c.auth_user, repo_name,
77 requested_page, page_limit, search_sort)
77 requested_page, page_limit, search_sort)
78
78
79 formatted_results = Page(
79 formatted_results = Page(
80 search_result['results'], page=requested_page,
80 search_result['results'], page=requested_page,
81 item_count=search_result['count'],
81 item_count=search_result['count'],
82 items_per_page=page_limit, url=url_generator)
82 items_per_page=page_limit, url=url_generator)
83 finally:
83 finally:
84 searcher.cleanup()
84 searcher.cleanup()
85
85
86 if not search_result['error']:
86 if not search_result['error']:
87 execution_time = '%s results (%.3f seconds)' % (
87 execution_time = '%s results (%.3f seconds)' % (
88 search_result['count'],
88 search_result['count'],
89 search_result['runtime'])
89 search_result['runtime'])
90 elif not errors:
90 elif not errors:
91 node = schema['search_query']
91 node = schema['search_query']
92 errors = [
92 errors = [
93 validation_schema.Invalid(node, search_result['error'])]
93 validation_schema.Invalid(node, search_result['error'])]
94
94
95 c.perm_user = c.auth_user
95 c.perm_user = c.auth_user
96 c.repo_name = repo_name
96 c.repo_name = repo_name
97 c.sort = search_sort
97 c.sort = search_sort
98 c.url_generator = url_generator
98 c.url_generator = url_generator
99 c.errors = errors
99 c.errors = errors
100 c.formatted_results = formatted_results
100 c.formatted_results = formatted_results
101 c.runtime = execution_time
101 c.runtime = execution_time
102 c.cur_query = search_query
102 c.cur_query = search_query
103 c.search_type = search_type
103 c.search_type = search_type
104 c.searcher = searcher
104 c.searcher = searcher
105
105
106
106
107 class SearchView(BaseAppView):
107 class SearchView(BaseAppView):
108 def load_default_context(self):
108 def load_default_context(self):
109 c = self._get_local_tmpl_context()
109 c = self._get_local_tmpl_context()
110
110
111 return c
111 return c
112
112
113 @LoginRequired()
113 @LoginRequired()
114 @view_config(
114 @view_config(
115 route_name='search', request_method='GET',
115 route_name='search', request_method='GET',
116 renderer='rhodecode:templates/search/search.mako')
116 renderer='rhodecode:templates/search/search.mako')
117 def search(self):
117 def search(self):
118 c = self.load_default_context()
118 c = self.load_default_context()
119 search(self.request, c, repo_name=None)
119 search(self.request, c, repo_name=None)
120 return self._get_template_context(c)
120 return self._get_template_context(c)
121
121
122
122
123 class SearchRepoView(RepoAppView):
123 class SearchRepoView(RepoAppView):
124 def load_default_context(self):
124 def load_default_context(self):
125 c = self._get_local_tmpl_context()
125 c = self._get_local_tmpl_context()
126
126 c.active = 'search'
127 return c
127 return c
128
128
129 @LoginRequired()
129 @LoginRequired()
130 @HasRepoPermissionAnyDecorator(
130 @HasRepoPermissionAnyDecorator(
131 'repository.read', 'repository.write', 'repository.admin')
131 'repository.read', 'repository.write', 'repository.admin')
132 @view_config(
132 @view_config(
133 route_name='search_repo', request_method='GET',
133 route_name='search_repo', request_method='GET',
134 renderer='rhodecode:templates/search/search.mako')
134 renderer='rhodecode:templates/search/search.mako')
135 def search_repo(self):
135 def search_repo(self):
136 c = self.load_default_context()
136 c = self.load_default_context()
137 search(self.request, c, repo_name=self.db_repo_name)
137 search(self.request, c, repo_name=self.db_repo_name)
138 return self._get_template_context(c)
138 return self._get_template_context(c)
@@ -1,728 +1,729 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="root.mako"/>
2 <%inherit file="root.mako"/>
3
3
4 <%include file="/ejs_templates/templates.html"/>
4 <%include file="/ejs_templates/templates.html"/>
5
5
6 <div class="outerwrapper">
6 <div class="outerwrapper">
7 <!-- HEADER -->
7 <!-- HEADER -->
8 <div class="header">
8 <div class="header">
9 <div id="header-inner" class="wrapper">
9 <div id="header-inner" class="wrapper">
10 <div id="logo">
10 <div id="logo">
11 <div class="logo-wrapper">
11 <div class="logo-wrapper">
12 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a>
12 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a>
13 </div>
13 </div>
14 %if c.rhodecode_name:
14 %if c.rhodecode_name:
15 <div class="branding">- ${h.branding(c.rhodecode_name)}</div>
15 <div class="branding">- ${h.branding(c.rhodecode_name)}</div>
16 %endif
16 %endif
17 </div>
17 </div>
18 <!-- MENU BAR NAV -->
18 <!-- MENU BAR NAV -->
19 ${self.menu_bar_nav()}
19 ${self.menu_bar_nav()}
20 <!-- END MENU BAR NAV -->
20 <!-- END MENU BAR NAV -->
21 </div>
21 </div>
22 </div>
22 </div>
23 ${self.menu_bar_subnav()}
23 ${self.menu_bar_subnav()}
24 <!-- END HEADER -->
24 <!-- END HEADER -->
25
25
26 <!-- CONTENT -->
26 <!-- CONTENT -->
27 <div id="content" class="wrapper">
27 <div id="content" class="wrapper">
28
28
29 <rhodecode-toast id="notifications"></rhodecode-toast>
29 <rhodecode-toast id="notifications"></rhodecode-toast>
30
30
31 <div class="main">
31 <div class="main">
32 ${next.main()}
32 ${next.main()}
33 </div>
33 </div>
34 </div>
34 </div>
35 <!-- END CONTENT -->
35 <!-- END CONTENT -->
36
36
37 </div>
37 </div>
38 <!-- FOOTER -->
38 <!-- FOOTER -->
39 <div id="footer">
39 <div id="footer">
40 <div id="footer-inner" class="title wrapper">
40 <div id="footer-inner" class="title wrapper">
41 <div>
41 <div>
42 <p class="footer-link-right">
42 <p class="footer-link-right">
43 % if c.visual.show_version:
43 % if c.visual.show_version:
44 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
44 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
45 % endif
45 % endif
46 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
46 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
47 % if c.visual.rhodecode_support_url:
47 % if c.visual.rhodecode_support_url:
48 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
48 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
49 % endif
49 % endif
50 </p>
50 </p>
51 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
51 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
52 <p class="server-instance" style="display:${sid}">
52 <p class="server-instance" style="display:${sid}">
53 ## display hidden instance ID if specially defined
53 ## display hidden instance ID if specially defined
54 % if c.rhodecode_instanceid:
54 % if c.rhodecode_instanceid:
55 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
55 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
56 % endif
56 % endif
57 </p>
57 </p>
58 </div>
58 </div>
59 </div>
59 </div>
60 </div>
60 </div>
61
61
62 <!-- END FOOTER -->
62 <!-- END FOOTER -->
63
63
64 ### MAKO DEFS ###
64 ### MAKO DEFS ###
65
65
66 <%def name="menu_bar_subnav()">
66 <%def name="menu_bar_subnav()">
67 </%def>
67 </%def>
68
68
69 <%def name="breadcrumbs(class_='breadcrumbs')">
69 <%def name="breadcrumbs(class_='breadcrumbs')">
70 <div class="${class_}">
70 <div class="${class_}">
71 ${self.breadcrumbs_links()}
71 ${self.breadcrumbs_links()}
72 </div>
72 </div>
73 </%def>
73 </%def>
74
74
75 <%def name="admin_menu()">
75 <%def name="admin_menu()">
76 <ul class="admin_menu submenu">
76 <ul class="admin_menu submenu">
77 <li><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
77 <li><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
78 <li><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
78 <li><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
79 <li><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
79 <li><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
80 <li><a href="${h.route_path('users')}">${_('Users')}</a></li>
80 <li><a href="${h.route_path('users')}">${_('Users')}</a></li>
81 <li><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
81 <li><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
82 <li><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
82 <li><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
83 <li><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
83 <li><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
84 <li><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
84 <li><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
85 <li><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
85 <li><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
86 <li class="last"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
86 <li class="last"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
87 </ul>
87 </ul>
88 </%def>
88 </%def>
89
89
90
90
91 <%def name="dt_info_panel(elements)">
91 <%def name="dt_info_panel(elements)">
92 <dl class="dl-horizontal">
92 <dl class="dl-horizontal">
93 %for dt, dd, title, show_items in elements:
93 %for dt, dd, title, show_items in elements:
94 <dt>${dt}:</dt>
94 <dt>${dt}:</dt>
95 <dd title="${h.tooltip(title)}">
95 <dd title="${h.tooltip(title)}">
96 %if callable(dd):
96 %if callable(dd):
97 ## allow lazy evaluation of elements
97 ## allow lazy evaluation of elements
98 ${dd()}
98 ${dd()}
99 %else:
99 %else:
100 ${dd}
100 ${dd}
101 %endif
101 %endif
102 %if show_items:
102 %if show_items:
103 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
103 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
104 %endif
104 %endif
105 </dd>
105 </dd>
106
106
107 %if show_items:
107 %if show_items:
108 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
108 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
109 %for item in show_items:
109 %for item in show_items:
110 <dt></dt>
110 <dt></dt>
111 <dd>${item}</dd>
111 <dd>${item}</dd>
112 %endfor
112 %endfor
113 </div>
113 </div>
114 %endif
114 %endif
115
115
116 %endfor
116 %endfor
117 </dl>
117 </dl>
118 </%def>
118 </%def>
119
119
120
120
121 <%def name="gravatar(email, size=16)">
121 <%def name="gravatar(email, size=16)">
122 <%
122 <%
123 if (size > 16):
123 if (size > 16):
124 gravatar_class = 'gravatar gravatar-large'
124 gravatar_class = 'gravatar gravatar-large'
125 else:
125 else:
126 gravatar_class = 'gravatar'
126 gravatar_class = 'gravatar'
127 %>
127 %>
128 <%doc>
128 <%doc>
129 TODO: johbo: For now we serve double size images to make it smooth
129 TODO: johbo: For now we serve double size images to make it smooth
130 for retina. This is how it worked until now. Should be replaced
130 for retina. This is how it worked until now. Should be replaced
131 with a better solution at some point.
131 with a better solution at some point.
132 </%doc>
132 </%doc>
133 <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}">
133 <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}">
134 </%def>
134 </%def>
135
135
136
136
137 <%def name="gravatar_with_user(contact, size=16, show_disabled=False)">
137 <%def name="gravatar_with_user(contact, size=16, show_disabled=False)">
138 <% email = h.email_or_none(contact) %>
138 <% email = h.email_or_none(contact) %>
139 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
139 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
140 ${self.gravatar(email, size)}
140 ${self.gravatar(email, size)}
141 <span class="${'user user-disabled' if show_disabled else 'user'}"> ${h.link_to_user(contact)}</span>
141 <span class="${'user user-disabled' if show_disabled else 'user'}"> ${h.link_to_user(contact)}</span>
142 </div>
142 </div>
143 </%def>
143 </%def>
144
144
145
145
146 ## admin menu used for people that have some admin resources
146 ## admin menu used for people that have some admin resources
147 <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)">
147 <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)">
148 <ul class="submenu">
148 <ul class="submenu">
149 %if repositories:
149 %if repositories:
150 <li class="local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
150 <li class="local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
151 %endif
151 %endif
152 %if repository_groups:
152 %if repository_groups:
153 <li class="local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
153 <li class="local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
154 %endif
154 %endif
155 %if user_groups:
155 %if user_groups:
156 <li class="local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
156 <li class="local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
157 %endif
157 %endif
158 </ul>
158 </ul>
159 </%def>
159 </%def>
160
160
161 <%def name="repo_page_title(repo_instance)">
161 <%def name="repo_page_title(repo_instance)">
162 <div class="title-content">
162 <div class="title-content">
163 <div class="title-main">
163 <div class="title-main">
164 ## SVN/HG/GIT icons
164 ## SVN/HG/GIT icons
165 %if h.is_hg(repo_instance):
165 %if h.is_hg(repo_instance):
166 <i class="icon-hg"></i>
166 <i class="icon-hg"></i>
167 %endif
167 %endif
168 %if h.is_git(repo_instance):
168 %if h.is_git(repo_instance):
169 <i class="icon-git"></i>
169 <i class="icon-git"></i>
170 %endif
170 %endif
171 %if h.is_svn(repo_instance):
171 %if h.is_svn(repo_instance):
172 <i class="icon-svn"></i>
172 <i class="icon-svn"></i>
173 %endif
173 %endif
174
174
175 ## public/private
175 ## public/private
176 %if repo_instance.private:
176 %if repo_instance.private:
177 <i class="icon-repo-private"></i>
177 <i class="icon-repo-private"></i>
178 %else:
178 %else:
179 <i class="icon-repo-public"></i>
179 <i class="icon-repo-public"></i>
180 %endif
180 %endif
181
181
182 ## repo name with group name
182 ## repo name with group name
183 ${h.breadcrumb_repo_link(c.rhodecode_db_repo)}
183 ${h.breadcrumb_repo_link(c.rhodecode_db_repo)}
184
184
185 </div>
185 </div>
186
186
187 ## FORKED
187 ## FORKED
188 %if repo_instance.fork:
188 %if repo_instance.fork:
189 <p>
189 <p>
190 <i class="icon-code-fork"></i> ${_('Fork of')}
190 <i class="icon-code-fork"></i> ${_('Fork of')}
191 ${h.link_to_if(c.has_origin_repo_read_perm,repo_instance.fork.repo_name, h.route_path('repo_summary', repo_name=repo_instance.fork.repo_name))}
191 ${h.link_to_if(c.has_origin_repo_read_perm,repo_instance.fork.repo_name, h.route_path('repo_summary', repo_name=repo_instance.fork.repo_name))}
192 </p>
192 </p>
193 %endif
193 %endif
194
194
195 ## IMPORTED FROM REMOTE
195 ## IMPORTED FROM REMOTE
196 %if repo_instance.clone_uri:
196 %if repo_instance.clone_uri:
197 <p>
197 <p>
198 <i class="icon-code-fork"></i> ${_('Clone from')}
198 <i class="icon-code-fork"></i> ${_('Clone from')}
199 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
199 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
200 </p>
200 </p>
201 %endif
201 %endif
202
202
203 ## LOCKING STATUS
203 ## LOCKING STATUS
204 %if repo_instance.locked[0]:
204 %if repo_instance.locked[0]:
205 <p class="locking_locked">
205 <p class="locking_locked">
206 <i class="icon-repo-lock"></i>
206 <i class="icon-repo-lock"></i>
207 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
207 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
208 </p>
208 </p>
209 %elif repo_instance.enable_locking:
209 %elif repo_instance.enable_locking:
210 <p class="locking_unlocked">
210 <p class="locking_unlocked">
211 <i class="icon-repo-unlock"></i>
211 <i class="icon-repo-unlock"></i>
212 ${_('Repository not locked. Pull repository to lock it.')}
212 ${_('Repository not locked. Pull repository to lock it.')}
213 </p>
213 </p>
214 %endif
214 %endif
215
215
216 </div>
216 </div>
217 </%def>
217 </%def>
218
218
219 <%def name="repo_menu(active=None)">
219 <%def name="repo_menu(active=None)">
220 <%
220 <%
221 def is_active(selected):
221 def is_active(selected):
222 if selected == active:
222 if selected == active:
223 return "active"
223 return "active"
224 %>
224 %>
225
225
226 <!--- CONTEXT BAR -->
226 <!--- CONTEXT BAR -->
227 <div id="context-bar">
227 <div id="context-bar">
228 <div class="wrapper">
228 <div class="wrapper">
229 <ul id="context-pages" class="navigation horizontal-list">
229 <ul id="context-pages" class="navigation horizontal-list">
230 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
230 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
231 <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li>
231 <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li>
232 <li class="${is_active('files')}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
232 <li class="${is_active('files')}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
233 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
233 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
234 <li class="${is_active('search')}"><a class="menulink" href="${h.route_path('search_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Search')}</div></a></li>
235
234 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
236 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
235 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
237 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
236 <li class="${is_active('showpullrequest')}">
238 <li class="${is_active('showpullrequest')}">
237 <a class="menulink" href="${h.route_path('pullrequest_show_all', repo_name=c.repo_name)}" title="${h.tooltip(_('Show Pull Requests for %s') % c.repo_name)}">
239 <a class="menulink" href="${h.route_path('pullrequest_show_all', repo_name=c.repo_name)}" title="${h.tooltip(_('Show Pull Requests for %s') % c.repo_name)}">
238 %if c.repository_pull_requests:
240 %if c.repository_pull_requests:
239 <span class="pr_notifications">${c.repository_pull_requests}</span>
241 <span class="pr_notifications">${c.repository_pull_requests}</span>
240 %endif
242 %endif
241 <div class="menulabel">${_('Pull Requests')}</div>
243 <div class="menulabel">${_('Pull Requests')}</div>
242 </a>
244 </a>
243 </li>
245 </li>
244 %endif
246 %endif
247
245 <li class="${is_active('options')}">
248 <li class="${is_active('options')}">
246 <a class="menulink dropdown">
249 <a class="menulink dropdown">
247 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
250 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
248 </a>
251 </a>
249 <ul class="submenu">
252 <ul class="submenu">
250 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
253 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
251 <li><a href="${h.route_path('edit_repo',repo_name=c.repo_name)}">${_('Settings')}</a></li>
254 <li><a href="${h.route_path('edit_repo',repo_name=c.repo_name)}">${_('Settings')}</a></li>
252 %endif
255 %endif
253 %if c.rhodecode_db_repo.fork:
256 %if c.rhodecode_db_repo.fork:
254 <li>
257 <li>
255 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
258 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
256 href="${h.route_path('repo_compare',
259 href="${h.route_path('repo_compare',
257 repo_name=c.rhodecode_db_repo.fork.repo_name,
260 repo_name=c.rhodecode_db_repo.fork.repo_name,
258 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
261 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
259 source_ref=c.rhodecode_db_repo.landing_rev[1],
262 source_ref=c.rhodecode_db_repo.landing_rev[1],
260 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
263 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
261 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
264 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
262 _query=dict(merge=1))}"
265 _query=dict(merge=1))}"
263 >
266 >
264 ${_('Compare fork')}
267 ${_('Compare fork')}
265 </a>
268 </a>
266 </li>
269 </li>
267 %endif
270 %endif
268
271
269 <li><a href="${h.route_path('search_repo',repo_name=c.repo_name)}">${_('Search')}</a></li>
270
271 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
272 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
272 %if c.rhodecode_db_repo.locked[0]:
273 %if c.rhodecode_db_repo.locked[0]:
273 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
274 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
274 %else:
275 %else:
275 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
276 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
276 %endif
277 %endif
277 %endif
278 %endif
278 %if c.rhodecode_user.username != h.DEFAULT_USER:
279 %if c.rhodecode_user.username != h.DEFAULT_USER:
279 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
280 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
280 <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork')}</a></li>
281 <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork')}</a></li>
281 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
282 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
282 %endif
283 %endif
283 %endif
284 %endif
284 </ul>
285 </ul>
285 </li>
286 </li>
286 </ul>
287 </ul>
287 </div>
288 </div>
288 <div class="clear"></div>
289 <div class="clear"></div>
289 </div>
290 </div>
290 % if c.rhodecode_db_repo.archived:
291 % if c.rhodecode_db_repo.archived:
291 <div class="alert alert-warning text-center">
292 <div class="alert alert-warning text-center">
292 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
293 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
293 </div>
294 </div>
294 % endif
295 % endif
295 <!--- END CONTEXT BAR -->
296 <!--- END CONTEXT BAR -->
296
297
297 </%def>
298 </%def>
298
299
299 <%def name="usermenu(active=False)">
300 <%def name="usermenu(active=False)">
300 ## USER MENU
301 ## USER MENU
301 <li id="quick_login_li" class="${'active' if active else ''}">
302 <li id="quick_login_li" class="${'active' if active else ''}">
302 % if c.rhodecode_user.username == h.DEFAULT_USER:
303 % if c.rhodecode_user.username == h.DEFAULT_USER:
303 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
304 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
304 ${gravatar(c.rhodecode_user.email, 20)}
305 ${gravatar(c.rhodecode_user.email, 20)}
305 <span class="user">
306 <span class="user">
306 <span>${_('Sign in')}</span>
307 <span>${_('Sign in')}</span>
307 </span>
308 </span>
308 </a>
309 </a>
309 % else:
310 % else:
310 ## logged in user
311 ## logged in user
311 <a id="quick_login_link" class="menulink childs">
312 <a id="quick_login_link" class="menulink childs">
312 ${gravatar(c.rhodecode_user.email, 20)}
313 ${gravatar(c.rhodecode_user.email, 20)}
313 <span class="user">
314 <span class="user">
314 <span class="menu_link_user">${c.rhodecode_user.username}</span>
315 <span class="menu_link_user">${c.rhodecode_user.username}</span>
315 <div class="show_more"></div>
316 <div class="show_more"></div>
316 </span>
317 </span>
317 </a>
318 </a>
318 ## subnav with menu for logged in user
319 ## subnav with menu for logged in user
319 <div class="user-menu submenu">
320 <div class="user-menu submenu">
320 <div id="quick_login">
321 <div id="quick_login">
321 %if c.rhodecode_user.username != h.DEFAULT_USER:
322 %if c.rhodecode_user.username != h.DEFAULT_USER:
322 <div class="">
323 <div class="">
323 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
324 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
324 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
325 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
325 <div class="email">${c.rhodecode_user.email}</div>
326 <div class="email">${c.rhodecode_user.email}</div>
326 </div>
327 </div>
327 <div class="">
328 <div class="">
328 <ol class="links">
329 <ol class="links">
329 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
330 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
330 % if c.rhodecode_user.personal_repo_group:
331 % if c.rhodecode_user.personal_repo_group:
331 <li>${h.link_to(_(u'My personal group'), h.route_path('repo_group_home', repo_group_name=c.rhodecode_user.personal_repo_group.group_name))}</li>
332 <li>${h.link_to(_(u'My personal group'), h.route_path('repo_group_home', repo_group_name=c.rhodecode_user.personal_repo_group.group_name))}</li>
332 % endif
333 % endif
333 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
334 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
334 ## bookmark-items
335 ## bookmark-items
335 <li class="bookmark-items">
336 <li class="bookmark-items">
336 ${_('Bookmarks')}
337 ${_('Bookmarks')}
337 <div class="pull-right">
338 <div class="pull-right">
338 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
339 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
339 </div>
340 </div>
340 </li>
341 </li>
341 % if not c.bookmark_items:
342 % if not c.bookmark_items:
342 <li>
343 <li>
343 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
344 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
344 </li>
345 </li>
345 % endif
346 % endif
346 % for item in c.bookmark_items:
347 % for item in c.bookmark_items:
347 <li>
348 <li>
348 % if item.repository:
349 % if item.repository:
349 <div>
350 <div>
350 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
351 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
351 <code>${item.position}</code>
352 <code>${item.position}</code>
352 % if item.repository.repo_type == 'hg':
353 % if item.repository.repo_type == 'hg':
353 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
354 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
354 % elif item.repository.repo_type == 'git':
355 % elif item.repository.repo_type == 'git':
355 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
356 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
356 % elif item.repository.repo_type == 'svn':
357 % elif item.repository.repo_type == 'svn':
357 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
358 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
358 % endif
359 % endif
359 ${(item.title or h.shorter(item.repository.repo_name, 30))}
360 ${(item.title or h.shorter(item.repository.repo_name, 30))}
360 </a>
361 </a>
361 </div>
362 </div>
362 % elif item.repository_group:
363 % elif item.repository_group:
363 <div>
364 <div>
364 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
365 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
365 <code>${item.position}</code>
366 <code>${item.position}</code>
366 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
367 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
367 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
368 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
368 </a>
369 </a>
369 </div>
370 </div>
370 % else:
371 % else:
371 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
372 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
372 <code>${item.position}</code>
373 <code>${item.position}</code>
373 ${item.title}
374 ${item.title}
374 </a>
375 </a>
375 % endif
376 % endif
376 </li>
377 </li>
377 % endfor
378 % endfor
378
379
379 <li class="logout">
380 <li class="logout">
380 ${h.secure_form(h.route_path('logout'), request=request)}
381 ${h.secure_form(h.route_path('logout'), request=request)}
381 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
382 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
382 ${h.end_form()}
383 ${h.end_form()}
383 </li>
384 </li>
384 </ol>
385 </ol>
385 </div>
386 </div>
386 %endif
387 %endif
387 </div>
388 </div>
388 </div>
389 </div>
389 ## unread counter
390 ## unread counter
390 <div class="pill_container">
391 <div class="pill_container">
391 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
392 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
392 </div>
393 </div>
393 % endif
394 % endif
394 </li>
395 </li>
395 </%def>
396 </%def>
396
397
397 <%def name="menu_items(active=None)">
398 <%def name="menu_items(active=None)">
398 <%
399 <%
399 def is_active(selected):
400 def is_active(selected):
400 if selected == active:
401 if selected == active:
401 return "active"
402 return "active"
402 return ""
403 return ""
403 %>
404 %>
404
405
405 <ul id="quick" class="main_nav navigation horizontal-list">
406 <ul id="quick" class="main_nav navigation horizontal-list">
406 ## notice box for important system messages
407 ## notice box for important system messages
407 <li style="display: none">
408 <li style="display: none">
408 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
409 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
409 <div class="menulabel-notice" >
410 <div class="menulabel-notice" >
410 0
411 0
411 </div>
412 </div>
412 </a>
413 </a>
413 </li>
414 </li>
414
415
415 ## Main filter
416 ## Main filter
416 <li>
417 <li>
417 <div class="menulabel main_filter_box">
418 <div class="menulabel main_filter_box">
418 <div class="main_filter_input_box">
419 <div class="main_filter_input_box">
419 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value=""/>
420 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value=""/>
420 </div>
421 </div>
421 <div class="main_filter_help_box">
422 <div class="main_filter_help_box">
422 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
423 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
423 </div>
424 </div>
424 </div>
425 </div>
425
426
426 <div id="main_filter_help" style="display: none">
427 <div id="main_filter_help" style="display: none">
427 Use '/' key to quickly access this field.
428 Use '/' key to quickly access this field.
428 Enter name of repository, or repository group for quick search.
429 Enter name of repository, or repository group for quick search.
429
430
430 Prefix query to allow special search:
431 Prefix query to allow special search:
431
432
432 user:admin, to search for usernames
433 user:admin, to search for usernames
433
434
434 user_group:devops, to search for user groups
435 user_group:devops, to search for user groups
435
436
436 commit:efced4, to search for commits
437 commit:efced4, to search for commits
437
438
438 </div>
439 </div>
439 </li>
440 </li>
440
441
441 ## ROOT MENU
442 ## ROOT MENU
442 %if c.rhodecode_user.username != h.DEFAULT_USER:
443 %if c.rhodecode_user.username != h.DEFAULT_USER:
443 <li class="${is_active('journal')}">
444 <li class="${is_active('journal')}">
444 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
445 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
445 <div class="menulabel">${_('Journal')}</div>
446 <div class="menulabel">${_('Journal')}</div>
446 </a>
447 </a>
447 </li>
448 </li>
448 %else:
449 %else:
449 <li class="${is_active('journal')}">
450 <li class="${is_active('journal')}">
450 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
451 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
451 <div class="menulabel">${_('Public journal')}</div>
452 <div class="menulabel">${_('Public journal')}</div>
452 </a>
453 </a>
453 </li>
454 </li>
454 %endif
455 %endif
455 <li class="${is_active('gists')}">
456 <li class="${is_active('gists')}">
456 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
457 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
457 <div class="menulabel">${_('Gists')}</div>
458 <div class="menulabel">${_('Gists')}</div>
458 </a>
459 </a>
459 </li>
460 </li>
460 <li class="${is_active('search')}">
461 <li class="${is_active('search')}">
461 <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}">
462 <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}">
462 <div class="menulabel">${_('Search')}</div>
463 <div class="menulabel">${_('Search')}</div>
463 </a>
464 </a>
464 </li>
465 </li>
465 % if h.HasPermissionAll('hg.admin')('access admin main page'):
466 % if h.HasPermissionAll('hg.admin')('access admin main page'):
466 <li class="${is_active('admin')}">
467 <li class="${is_active('admin')}">
467 <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;">
468 <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;">
468 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
469 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
469 </a>
470 </a>
470 ${admin_menu()}
471 ${admin_menu()}
471 </li>
472 </li>
472 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
473 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
473 <li class="${is_active('admin')}">
474 <li class="${is_active('admin')}">
474 <a class="menulink childs" title="${_('Delegated Admin settings')}">
475 <a class="menulink childs" title="${_('Delegated Admin settings')}">
475 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
476 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
476 </a>
477 </a>
477 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
478 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
478 c.rhodecode_user.repository_groups_admin,
479 c.rhodecode_user.repository_groups_admin,
479 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
480 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
480 </li>
481 </li>
481 % endif
482 % endif
482 ## render extra user menu
483 ## render extra user menu
483 ${usermenu(active=(active=='my_account'))}
484 ${usermenu(active=(active=='my_account'))}
484
485
485 % if c.debug_style:
486 % if c.debug_style:
486 <li>
487 <li>
487 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
488 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
488 <div class="menulabel">${_('[Style]')}</div>
489 <div class="menulabel">${_('[Style]')}</div>
489 </a>
490 </a>
490 </li>
491 </li>
491 % endif
492 % endif
492 </ul>
493 </ul>
493
494
494 <script type="text/javascript">
495 <script type="text/javascript">
495 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
496 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
496
497
497 var formatRepoResult = function(result, container, query, escapeMarkup) {
498 var formatRepoResult = function(result, container, query, escapeMarkup) {
498 return function(data, escapeMarkup) {
499 return function(data, escapeMarkup) {
499 if (!data.repo_id){
500 if (!data.repo_id){
500 return data.text; // optgroup text Repositories
501 return data.text; // optgroup text Repositories
501 }
502 }
502
503
503 var tmpl = '';
504 var tmpl = '';
504 var repoType = data['repo_type'];
505 var repoType = data['repo_type'];
505 var repoName = data['text'];
506 var repoName = data['text'];
506
507
507 if(data && data.type == 'repo'){
508 if(data && data.type == 'repo'){
508 if(repoType === 'hg'){
509 if(repoType === 'hg'){
509 tmpl += '<i class="icon-hg"></i> ';
510 tmpl += '<i class="icon-hg"></i> ';
510 }
511 }
511 else if(repoType === 'git'){
512 else if(repoType === 'git'){
512 tmpl += '<i class="icon-git"></i> ';
513 tmpl += '<i class="icon-git"></i> ';
513 }
514 }
514 else if(repoType === 'svn'){
515 else if(repoType === 'svn'){
515 tmpl += '<i class="icon-svn"></i> ';
516 tmpl += '<i class="icon-svn"></i> ';
516 }
517 }
517 if(data['private']){
518 if(data['private']){
518 tmpl += '<i class="icon-lock" ></i> ';
519 tmpl += '<i class="icon-lock" ></i> ';
519 }
520 }
520 else if(visualShowPublicIcon){
521 else if(visualShowPublicIcon){
521 tmpl += '<i class="icon-unlock-alt"></i> ';
522 tmpl += '<i class="icon-unlock-alt"></i> ';
522 }
523 }
523 }
524 }
524 tmpl += escapeMarkup(repoName);
525 tmpl += escapeMarkup(repoName);
525 return tmpl;
526 return tmpl;
526
527
527 }(result, escapeMarkup);
528 }(result, escapeMarkup);
528 };
529 };
529
530
530 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
531 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
531 return function(data, escapeMarkup) {
532 return function(data, escapeMarkup) {
532 if (!data.repo_group_id){
533 if (!data.repo_group_id){
533 return data.text; // optgroup text Repositories
534 return data.text; // optgroup text Repositories
534 }
535 }
535
536
536 var tmpl = '';
537 var tmpl = '';
537 var repoGroupName = data['text'];
538 var repoGroupName = data['text'];
538
539
539 if(data){
540 if(data){
540
541
541 tmpl += '<i class="icon-folder-close"></i> ';
542 tmpl += '<i class="icon-folder-close"></i> ';
542
543
543 }
544 }
544 tmpl += escapeMarkup(repoGroupName);
545 tmpl += escapeMarkup(repoGroupName);
545 return tmpl;
546 return tmpl;
546
547
547 }(result, escapeMarkup);
548 }(result, escapeMarkup);
548 };
549 };
549
550
550
551
551 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
552 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
552
553
553 if (value.split(':').length === 2) {
554 if (value.split(':').length === 2) {
554 value = value.split(':')[1]
555 value = value.split(':')[1]
555 }
556 }
556
557
557 var searchType = data['type'];
558 var searchType = data['type'];
558 var valueDisplay = data['value_display'];
559 var valueDisplay = data['value_display'];
559
560
560 var escapeRegExChars = function (value) {
561 var escapeRegExChars = function (value) {
561 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
562 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
562 };
563 };
563 var pattern = '(' + escapeRegExChars(value) + ')';
564 var pattern = '(' + escapeRegExChars(value) + ')';
564
565
565 // highlight match
566 // highlight match
566 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
567 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
567 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
568 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
568
569
569 var icon = '';
570 var icon = '';
570
571
571 if (searchType === 'hint') {
572 if (searchType === 'hint') {
572 icon += '<i class="icon-folder-close"></i> ';
573 icon += '<i class="icon-folder-close"></i> ';
573 }
574 }
574 else if (searchType === 'search') {
575 else if (searchType === 'search') {
575 icon += '<i class="icon-more"></i> ';
576 icon += '<i class="icon-more"></i> ';
576 }
577 }
577 else if (searchType === 'repo') {
578 else if (searchType === 'repo') {
578 if (data['repo_type'] === 'hg') {
579 if (data['repo_type'] === 'hg') {
579 icon += '<i class="icon-hg"></i> ';
580 icon += '<i class="icon-hg"></i> ';
580 }
581 }
581 else if (data['repo_type'] === 'git') {
582 else if (data['repo_type'] === 'git') {
582 icon += '<i class="icon-git"></i> ';
583 icon += '<i class="icon-git"></i> ';
583 }
584 }
584 else if (data['repo_type'] === 'svn') {
585 else if (data['repo_type'] === 'svn') {
585 icon += '<i class="icon-svn"></i> ';
586 icon += '<i class="icon-svn"></i> ';
586 }
587 }
587 if (data['private']) {
588 if (data['private']) {
588 icon += '<i class="icon-lock" ></i> ';
589 icon += '<i class="icon-lock" ></i> ';
589 }
590 }
590 else if (visualShowPublicIcon) {
591 else if (visualShowPublicIcon) {
591 icon += '<i class="icon-unlock-alt"></i> ';
592 icon += '<i class="icon-unlock-alt"></i> ';
592 }
593 }
593 }
594 }
594 else if (searchType === 'repo_group') {
595 else if (searchType === 'repo_group') {
595 icon += '<i class="icon-folder-close"></i> ';
596 icon += '<i class="icon-folder-close"></i> ';
596 }
597 }
597 else if (searchType === 'user_group') {
598 else if (searchType === 'user_group') {
598 icon += '<i class="icon-group"></i> ';
599 icon += '<i class="icon-group"></i> ';
599 }
600 }
600 else if (searchType === 'user') {
601 else if (searchType === 'user') {
601 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
602 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
602 }
603 }
603 else if (searchType === 'commit') {
604 else if (searchType === 'commit') {
604 icon += '<i class="icon-tag"></i>';
605 icon += '<i class="icon-tag"></i>';
605 }
606 }
606
607
607 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
608 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
608 return tmpl.format(icon, valueDisplay);
609 return tmpl.format(icon, valueDisplay);
609 };
610 };
610
611
611 var handleSelect = function(element, suggestion) {
612 var handleSelect = function(element, suggestion) {
612 if (suggestion.type === "hint") {
613 if (suggestion.type === "hint") {
613 // we skip action
614 // we skip action
614 $('#main_filter').focus();
615 $('#main_filter').focus();
615 } else {
616 } else {
616 window.location = suggestion['url'];
617 window.location = suggestion['url'];
617 }
618 }
618 };
619 };
619 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
620 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
620 if (queryLowerCase.split(':').length === 2) {
621 if (queryLowerCase.split(':').length === 2) {
621 queryLowerCase = queryLowerCase.split(':')[1]
622 queryLowerCase = queryLowerCase.split(':')[1]
622 }
623 }
623 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
624 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
624 };
625 };
625
626
626 $('#main_filter').autocomplete({
627 $('#main_filter').autocomplete({
627 serviceUrl: pyroutes.url('goto_switcher_data'),
628 serviceUrl: pyroutes.url('goto_switcher_data'),
628 params: {"search_context": templateContext.search_context},
629 params: {"search_context": templateContext.search_context},
629 minChars:2,
630 minChars:2,
630 maxHeight:400,
631 maxHeight:400,
631 deferRequestBy: 300, //miliseconds
632 deferRequestBy: 300, //miliseconds
632 tabDisabled: true,
633 tabDisabled: true,
633 autoSelectFirst: true,
634 autoSelectFirst: true,
634 formatResult: autocompleteMainFilterFormatResult,
635 formatResult: autocompleteMainFilterFormatResult,
635 lookupFilter: autocompleteMainFilterResult,
636 lookupFilter: autocompleteMainFilterResult,
636 onSelect: function (element, suggestion) {
637 onSelect: function (element, suggestion) {
637 handleSelect(element, suggestion);
638 handleSelect(element, suggestion);
638 return false;
639 return false;
639 },
640 },
640 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
641 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
641 if (jqXHR !== 'abort') {
642 if (jqXHR !== 'abort') {
642 alert("Error during search.\nError code: {0}".format(textStatus));
643 alert("Error during search.\nError code: {0}".format(textStatus));
643 window.location = '';
644 window.location = '';
644 }
645 }
645 }
646 }
646 });
647 });
647
648
648 showMainFilterBox = function () {
649 showMainFilterBox = function () {
649 $('#main_filter_help').toggle();
650 $('#main_filter_help').toggle();
650 }
651 }
651
652
652 </script>
653 </script>
653 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
654 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
654 </%def>
655 </%def>
655
656
656 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
657 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
657 <div class="modal-dialog">
658 <div class="modal-dialog">
658 <div class="modal-content">
659 <div class="modal-content">
659 <div class="modal-header">
660 <div class="modal-header">
660 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
661 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
661 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
662 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
662 </div>
663 </div>
663 <div class="modal-body">
664 <div class="modal-body">
664 <div class="block-left">
665 <div class="block-left">
665 <table class="keyboard-mappings">
666 <table class="keyboard-mappings">
666 <tbody>
667 <tbody>
667 <tr>
668 <tr>
668 <th></th>
669 <th></th>
669 <th>${_('Site-wide shortcuts')}</th>
670 <th>${_('Site-wide shortcuts')}</th>
670 </tr>
671 </tr>
671 <%
672 <%
672 elems = [
673 elems = [
673 ('/', 'Use quick search box'),
674 ('/', 'Use quick search box'),
674 ('g h', 'Goto home page'),
675 ('g h', 'Goto home page'),
675 ('g g', 'Goto my private gists page'),
676 ('g g', 'Goto my private gists page'),
676 ('g G', 'Goto my public gists page'),
677 ('g G', 'Goto my public gists page'),
677 ('g 0-9', 'Goto bookmarked items from 0-9'),
678 ('g 0-9', 'Goto bookmarked items from 0-9'),
678 ('n r', 'New repository page'),
679 ('n r', 'New repository page'),
679 ('n g', 'New gist page'),
680 ('n g', 'New gist page'),
680 ]
681 ]
681 %>
682 %>
682 %for key, desc in elems:
683 %for key, desc in elems:
683 <tr>
684 <tr>
684 <td class="keys">
685 <td class="keys">
685 <span class="key tag">${key}</span>
686 <span class="key tag">${key}</span>
686 </td>
687 </td>
687 <td>${desc}</td>
688 <td>${desc}</td>
688 </tr>
689 </tr>
689 %endfor
690 %endfor
690 </tbody>
691 </tbody>
691 </table>
692 </table>
692 </div>
693 </div>
693 <div class="block-left">
694 <div class="block-left">
694 <table class="keyboard-mappings">
695 <table class="keyboard-mappings">
695 <tbody>
696 <tbody>
696 <tr>
697 <tr>
697 <th></th>
698 <th></th>
698 <th>${_('Repositories')}</th>
699 <th>${_('Repositories')}</th>
699 </tr>
700 </tr>
700 <%
701 <%
701 elems = [
702 elems = [
702 ('g s', 'Goto summary page'),
703 ('g s', 'Goto summary page'),
703 ('g c', 'Goto changelog page'),
704 ('g c', 'Goto changelog page'),
704 ('g f', 'Goto files page'),
705 ('g f', 'Goto files page'),
705 ('g F', 'Goto files page with file search activated'),
706 ('g F', 'Goto files page with file search activated'),
706 ('g p', 'Goto pull requests page'),
707 ('g p', 'Goto pull requests page'),
707 ('g o', 'Goto repository settings'),
708 ('g o', 'Goto repository settings'),
708 ('g O', 'Goto repository permissions settings'),
709 ('g O', 'Goto repository permissions settings'),
709 ]
710 ]
710 %>
711 %>
711 %for key, desc in elems:
712 %for key, desc in elems:
712 <tr>
713 <tr>
713 <td class="keys">
714 <td class="keys">
714 <span class="key tag">${key}</span>
715 <span class="key tag">${key}</span>
715 </td>
716 </td>
716 <td>${desc}</td>
717 <td>${desc}</td>
717 </tr>
718 </tr>
718 %endfor
719 %endfor
719 </tbody>
720 </tbody>
720 </table>
721 </table>
721 </div>
722 </div>
722 </div>
723 </div>
723 <div class="modal-footer">
724 <div class="modal-footer">
724 </div>
725 </div>
725 </div><!-- /.modal-content -->
726 </div><!-- /.modal-content -->
726 </div><!-- /.modal-dialog -->
727 </div><!-- /.modal-dialog -->
727 </div><!-- /.modal -->
728 </div><!-- /.modal -->
728
729
@@ -1,152 +1,152 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 %if c.repo_name:
5 %if c.repo_name:
6 ${_('Search inside repository %(repo_name)s') % {'repo_name': c.repo_name}}
6 ${_('Search inside repository %(repo_name)s') % {'repo_name': c.repo_name}}
7 %else:
7 %else:
8 ${_('Search inside all accessible repositories')}
8 ${_('Search inside all accessible repositories')}
9 %endif
9 %endif
10 %if c.rhodecode_name:
10 %if c.rhodecode_name:
11 &middot; ${h.branding(c.rhodecode_name)}
11 &middot; ${h.branding(c.rhodecode_name)}
12 %endif
12 %endif
13 </%def>
13 </%def>
14
14
15 <%def name="breadcrumbs_links()">
15 <%def name="breadcrumbs_links()">
16 %if c.repo_name:
16 %if c.repo_name:
17 ${_('Search inside repository %(repo_name)s') % {'repo_name': c.repo_name}}
17 ${_('Search inside repository %(repo_name)s') % {'repo_name': c.repo_name}}
18 %else:
18 %else:
19 ${_('Search inside all accessible repositories')}
19 ${_('Search inside all accessible repositories')}
20 %endif
20 %endif
21
21
22 </%def>
22 </%def>
23
23
24 <%def name="menu_bar_nav()">
24 <%def name="menu_bar_nav()">
25 %if c.repo_name:
25 %if c.repo_name:
26 ${self.menu_items(active='repositories')}
26 ${self.menu_items(active='repositories')}
27 %else:
27 %else:
28 ${self.menu_items(active='search')}
28 ${self.menu_items(active='search')}
29 %endif
29 %endif
30 </%def>
30 </%def>
31
31
32 <%def name="menu_bar_subnav()">
32 <%def name="menu_bar_subnav()">
33 %if c.repo_name:
33 %if c.repo_name:
34 ${self.repo_menu(active='options')}
34 ${self.repo_menu(active='search')}
35 %endif
35 %endif
36 </%def>
36 </%def>
37
37
38 <%def name="main()">
38 <%def name="main()">
39 <div class="box">
39 <div class="box">
40 %if c.repo_name:
40 %if c.repo_name:
41 <!-- box / title -->
41 <!-- box / title -->
42 <div class="title">
42 <div class="title">
43 ${self.repo_page_title(c.rhodecode_db_repo)}
43 ${self.repo_page_title(c.rhodecode_db_repo)}
44 </div>
44 </div>
45 ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')}
45 ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')}
46 %else:
46 %else:
47 <!-- box / title -->
47 <!-- box / title -->
48 <div class="title">
48 <div class="title">
49 ${self.breadcrumbs()}
49 ${self.breadcrumbs()}
50 <ul class="links">&nbsp;</ul>
50 <ul class="links">&nbsp;</ul>
51 </div>
51 </div>
52 <!-- end box / title -->
52 <!-- end box / title -->
53 ${h.form(h.route_path('search'), method='get')}
53 ${h.form(h.route_path('search'), method='get')}
54 %endif
54 %endif
55 <div class="form search-form">
55 <div class="form search-form">
56 <div class="fields">
56 <div class="fields">
57 ${h.text('q', c.cur_query, placeholder="Enter query...")}
57 ${h.text('q', c.cur_query, placeholder="Enter query...")}
58
58
59 ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')}
59 ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')}
60 ${h.hidden('max_lines', '10')}
60 ${h.hidden('max_lines', '10')}
61 <input type="submit" value="${_('Search')}" class="btn"/>
61 <input type="submit" value="${_('Search')}" class="btn"/>
62 <br/>
62 <br/>
63
63
64 <div class="search-feedback-items">
64 <div class="search-feedback-items">
65 % for error in c.errors:
65 % for error in c.errors:
66 <span class="error-message">
66 <span class="error-message">
67 % for k,v in error.asdict().items():
67 % for k,v in error.asdict().items():
68 ${k} - ${v}
68 ${k} - ${v}
69 % endfor
69 % endfor
70 </span>
70 </span>
71 % endfor
71 % endfor
72 <div class="field">
72 <div class="field">
73 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Langague examples')}</p>
73 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Langague examples')}</p>
74 <pre id="search-help" style="display: none">\
74 <pre id="search-help" style="display: none">\
75
75
76 % if c.searcher.name == 'whoosh':
76 % if c.searcher.name == 'whoosh':
77 Example filter terms for `Whoosh` search:
77 Example filter terms for `Whoosh` search:
78 query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a>
78 query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a>
79 Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
79 Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
80
80
81 Generate wildcards using '*' character:
81 Generate wildcards using '*' character:
82 "repo_name:vcs*" - search everything starting with 'vcs'
82 "repo_name:vcs*" - search everything starting with 'vcs'
83 "repo_name:*vcs*" - search for repository containing 'vcs'
83 "repo_name:*vcs*" - search for repository containing 'vcs'
84
84
85 Optional AND / OR operators in queries
85 Optional AND / OR operators in queries
86 "repo_name:vcs OR repo_name:test"
86 "repo_name:vcs OR repo_name:test"
87 "owner:test AND repo_name:test*" AND extension:py
87 "owner:test AND repo_name:test*" AND extension:py
88
88
89 Move advanced search is available via ElasticSearch6 backend in EE edition.
89 Move advanced search is available via ElasticSearch6 backend in EE edition.
90 % elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2':
90 % elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2':
91 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
91 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
92 ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
92 ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
93
93
94 search type: content (File Content)
94 search type: content (File Content)
95 indexed fields: content
95 indexed fields: content
96
96
97 # search for `fix` string in all files
97 # search for `fix` string in all files
98 fix
98 fix
99
99
100 search type: commit (Commit message)
100 search type: commit (Commit message)
101 indexed fields: message
101 indexed fields: message
102
102
103 search type: path (File name)
103 search type: path (File name)
104 indexed fields: path
104 indexed fields: path
105
105
106 % else:
106 % else:
107 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
107 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
108 query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a>
108 query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a>
109 The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
109 The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
110 % for handler in c.searcher.get_handlers().values():
110 % for handler in c.searcher.get_handlers().values():
111
111
112 search type: ${handler.search_type_label}
112 search type: ${handler.search_type_label}
113 *indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])}
113 *indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])}
114 % for entry in handler.es_6_example_queries:
114 % for entry in handler.es_6_example_queries:
115 ${entry.rstrip()}
115 ${entry.rstrip()}
116 % endfor
116 % endfor
117 % endfor
117 % endfor
118
118
119 % endif
119 % endif
120 </pre>
120 </pre>
121 </div>
121 </div>
122
122
123 <div class="field">${c.runtime}</div>
123 <div class="field">${c.runtime}</div>
124 </div>
124 </div>
125 </div>
125 </div>
126 </div>
126 </div>
127
127
128 ${h.end_form()}
128 ${h.end_form()}
129 <div class="search">
129 <div class="search">
130 % if c.search_type == 'content':
130 % if c.search_type == 'content':
131 <%include file='search_content.mako'/>
131 <%include file='search_content.mako'/>
132 % elif c.search_type == 'path':
132 % elif c.search_type == 'path':
133 <%include file='search_path.mako'/>
133 <%include file='search_path.mako'/>
134 % elif c.search_type == 'commit':
134 % elif c.search_type == 'commit':
135 <%include file='search_commit.mako'/>
135 <%include file='search_commit.mako'/>
136 % elif c.search_type == 'repository':
136 % elif c.search_type == 'repository':
137 <%include file='search_repository.mako'/>
137 <%include file='search_repository.mako'/>
138 % endif
138 % endif
139 </div>
139 </div>
140 </div>
140 </div>
141 <script>
141 <script>
142 $(document).ready(function(){
142 $(document).ready(function(){
143 $('#q').autoGrowInput();
143 $('#q').autoGrowInput();
144 $("#id_search_type").select2({
144 $("#id_search_type").select2({
145 'containerCssClass': "drop-menu",
145 'containerCssClass': "drop-menu",
146 'dropdownCssClass': "drop-menu-dropdown",
146 'dropdownCssClass': "drop-menu-dropdown",
147 'dropdownAutoWidth': true,
147 'dropdownAutoWidth': true,
148 'minimumResultsForSearch': -1
148 'minimumResultsForSearch': -1
149 });
149 });
150 })
150 })
151 </script>
151 </script>
152 </%def>
152 </%def>
General Comments 0
You need to be logged in to leave comments. Login now