##// END OF EJS Templates
quick-search-bar: show errors when search fails.
dan -
r3320:7faf2640 default
parent child Browse files
Show More
@@ -1,62 +1,63 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2016-2018 RhodeCode GmbH
3 # Copyright (C) 2016-2018 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
21
22 def assert_and_get_main_filter_content(result):
22 def assert_and_get_main_filter_content(result):
23 repos = []
23 repos = []
24 groups = []
24 groups = []
25 commits = []
25 commits = []
26 users = []
26 users = []
27 for data_item in result:
27 for data_item in result:
28 assert data_item['id']
28 assert data_item['id']
29 assert data_item['value']
29 assert data_item['value']
30 assert data_item['value_display']
30 assert data_item['value_display']
31 assert data_item['url']
31 assert data_item['url']
32
32
33 if data_item['type'] == 'search':
33 if data_item['type'] == 'search':
34 assert data_item['value_display'].startswith('Full text search for:')
34 display_val = data_item['value_display']
35 assert 'Search for:' in display_val, display_val
35 elif data_item['type'] == 'repo':
36 elif data_item['type'] == 'repo':
36 repos.append(data_item)
37 repos.append(data_item)
37 elif data_item['type'] == 'repo_group':
38 elif data_item['type'] == 'repo_group':
38 groups.append(data_item)
39 groups.append(data_item)
39 elif data_item['type'] == 'user':
40 elif data_item['type'] == 'user':
40 users.append(data_item)
41 users.append(data_item)
41 elif data_item['type'] == 'commit':
42 elif data_item['type'] == 'commit':
42 commits.append(data_item)
43 commits.append(data_item)
43 else:
44 else:
44 raise Exception('invalid type `%s`' % data_item['type'])
45 raise Exception('invalid type `%s`' % data_item['type'])
45
46
46 return repos, groups, users, commits
47 return repos, groups, users, commits
47
48
48
49
49 def assert_and_get_repo_list_content(result):
50 def assert_and_get_repo_list_content(result):
50 repos = []
51 repos = []
51 for data in result:
52 for data in result:
52 for data_item in data['children']:
53 for data_item in data['children']:
53 assert data_item['id']
54 assert data_item['id']
54 assert data_item['text']
55 assert data_item['text']
55 assert data_item['url']
56 assert data_item['url']
56
57
57 if data_item['type'] == 'repo':
58 if data_item['type'] == 'repo':
58 repos.append(data_item)
59 repos.append(data_item)
59 else:
60 else:
60 raise Exception('invalid type %s' % data_item['type'])
61 raise Exception('invalid type %s' % data_item['type'])
61
62
62 return repos
63 return repos
@@ -1,690 +1,696 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: %s') % c.rhodecode_instanceid}
55 ${_('RhodeCode instance id: %s') % 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 <a href="${h.route_path('repo_summary',repo_name=repo_instance.fork.repo_name)}">${repo_instance.fork.repo_name}</a>
191 <a href="${h.route_path('repo_summary',repo_name=repo_instance.fork.repo_name)}">${repo_instance.fork.repo_name}</a>
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 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
234 ## 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']:
235 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
236 <li class="${is_active('showpullrequest')}">
236 <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)}">
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)}">
238 %if c.repository_pull_requests:
238 %if c.repository_pull_requests:
239 <span class="pr_notifications">${c.repository_pull_requests}</span>
239 <span class="pr_notifications">${c.repository_pull_requests}</span>
240 %endif
240 %endif
241 <div class="menulabel">${_('Pull Requests')}</div>
241 <div class="menulabel">${_('Pull Requests')}</div>
242 </a>
242 </a>
243 </li>
243 </li>
244 %endif
244 %endif
245 <li class="${is_active('options')}">
245 <li class="${is_active('options')}">
246 <a class="menulink dropdown">
246 <a class="menulink dropdown">
247 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
247 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
248 </a>
248 </a>
249 <ul class="submenu">
249 <ul class="submenu">
250 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
250 %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>
251 <li><a href="${h.route_path('edit_repo',repo_name=c.repo_name)}">${_('Settings')}</a></li>
252 %endif
252 %endif
253 %if c.rhodecode_db_repo.fork:
253 %if c.rhodecode_db_repo.fork:
254 <li>
254 <li>
255 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
255 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
256 href="${h.route_path('repo_compare',
256 href="${h.route_path('repo_compare',
257 repo_name=c.rhodecode_db_repo.fork.repo_name,
257 repo_name=c.rhodecode_db_repo.fork.repo_name,
258 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
258 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
259 source_ref=c.rhodecode_db_repo.landing_rev[1],
259 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],
260 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],
261 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
262 _query=dict(merge=1))}"
262 _query=dict(merge=1))}"
263 >
263 >
264 ${_('Compare fork')}
264 ${_('Compare fork')}
265 </a>
265 </a>
266 </li>
266 </li>
267 %endif
267 %endif
268
268
269 <li><a href="${h.route_path('search_repo',repo_name=c.repo_name)}">${_('Search')}</a></li>
269 <li><a href="${h.route_path('search_repo',repo_name=c.repo_name)}">${_('Search')}</a></li>
270
270
271 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
271 %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]:
272 %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>
273 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
274 %else:
274 %else:
275 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
275 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
276 %endif
276 %endif
277 %endif
277 %endif
278 %if c.rhodecode_user.username != h.DEFAULT_USER:
278 %if c.rhodecode_user.username != h.DEFAULT_USER:
279 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
279 %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>
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('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
281 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
282 %endif
282 %endif
283 %endif
283 %endif
284 </ul>
284 </ul>
285 </li>
285 </li>
286 </ul>
286 </ul>
287 </div>
287 </div>
288 <div class="clear"></div>
288 <div class="clear"></div>
289 </div>
289 </div>
290 % if c.rhodecode_db_repo.archived:
290 % if c.rhodecode_db_repo.archived:
291 <div class="alert alert-warning text-center">
291 <div class="alert alert-warning text-center">
292 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
292 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
293 </div>
293 </div>
294 % endif
294 % endif
295 <!--- END CONTEXT BAR -->
295 <!--- END CONTEXT BAR -->
296
296
297 </%def>
297 </%def>
298
298
299 <%def name="usermenu(active=False)">
299 <%def name="usermenu(active=False)">
300 ## USER MENU
300 ## USER MENU
301 <li id="quick_login_li" class="${'active' if active else ''}">
301 <li id="quick_login_li" class="${'active' if active else ''}">
302 <a id="quick_login_link" class="menulink childs">
302 <a id="quick_login_link" class="menulink childs">
303 ${gravatar(c.rhodecode_user.email, 20)}
303 ${gravatar(c.rhodecode_user.email, 20)}
304 <span class="user">
304 <span class="user">
305 %if c.rhodecode_user.username != h.DEFAULT_USER:
305 %if c.rhodecode_user.username != h.DEFAULT_USER:
306 <span class="menu_link_user">${c.rhodecode_user.username}</span><div class="show_more"></div>
306 <span class="menu_link_user">${c.rhodecode_user.username}</span><div class="show_more"></div>
307 %else:
307 %else:
308 <span>${_('Sign in')}</span>
308 <span>${_('Sign in')}</span>
309 %endif
309 %endif
310 </span>
310 </span>
311 </a>
311 </a>
312
312
313 <div class="user-menu submenu">
313 <div class="user-menu submenu">
314 <div id="quick_login">
314 <div id="quick_login">
315 %if c.rhodecode_user.username == h.DEFAULT_USER:
315 %if c.rhodecode_user.username == h.DEFAULT_USER:
316 <h4>${_('Sign in to your account')}</h4>
316 <h4>${_('Sign in to your account')}</h4>
317 ${h.form(h.route_path('login', _query={'came_from': h.current_route_path(request)}), needs_csrf_token=False)}
317 ${h.form(h.route_path('login', _query={'came_from': h.current_route_path(request)}), needs_csrf_token=False)}
318 <div class="form form-vertical">
318 <div class="form form-vertical">
319 <div class="fields">
319 <div class="fields">
320 <div class="field">
320 <div class="field">
321 <div class="label">
321 <div class="label">
322 <label for="username">${_('Username')}:</label>
322 <label for="username">${_('Username')}:</label>
323 </div>
323 </div>
324 <div class="input">
324 <div class="input">
325 ${h.text('username',class_='focus',tabindex=1)}
325 ${h.text('username',class_='focus',tabindex=1)}
326 </div>
326 </div>
327
327
328 </div>
328 </div>
329 <div class="field">
329 <div class="field">
330 <div class="label">
330 <div class="label">
331 <label for="password">${_('Password')}:</label>
331 <label for="password">${_('Password')}:</label>
332 %if h.HasPermissionAny('hg.password_reset.enabled')():
332 %if h.HasPermissionAny('hg.password_reset.enabled')():
333 <span class="forgot_password">${h.link_to(_('(Forgot password?)'),h.route_path('reset_password'), class_='pwd_reset')}</span>
333 <span class="forgot_password">${h.link_to(_('(Forgot password?)'),h.route_path('reset_password'), class_='pwd_reset')}</span>
334 %endif
334 %endif
335 </div>
335 </div>
336 <div class="input">
336 <div class="input">
337 ${h.password('password',class_='focus',tabindex=2)}
337 ${h.password('password',class_='focus',tabindex=2)}
338 </div>
338 </div>
339 </div>
339 </div>
340 <div class="buttons">
340 <div class="buttons">
341 <div class="register">
341 <div class="register">
342 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
342 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
343 ${h.link_to(_("Don't have an account?"),h.route_path('register'))} <br/>
343 ${h.link_to(_("Don't have an account?"),h.route_path('register'))} <br/>
344 %endif
344 %endif
345 ${h.link_to(_("Using external auth? Sign In here."),h.route_path('login'))}
345 ${h.link_to(_("Using external auth? Sign In here."),h.route_path('login'))}
346 </div>
346 </div>
347 <div class="submit">
347 <div class="submit">
348 ${h.submit('sign_in',_('Sign In'),class_="btn btn-small",tabindex=3)}
348 ${h.submit('sign_in',_('Sign In'),class_="btn btn-small",tabindex=3)}
349 </div>
349 </div>
350 </div>
350 </div>
351 </div>
351 </div>
352 </div>
352 </div>
353 ${h.end_form()}
353 ${h.end_form()}
354 %else:
354 %else:
355 <div class="">
355 <div class="">
356 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
356 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
357 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
357 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
358 <div class="email">${c.rhodecode_user.email}</div>
358 <div class="email">${c.rhodecode_user.email}</div>
359 </div>
359 </div>
360 <div class="">
360 <div class="">
361 <ol class="links">
361 <ol class="links">
362 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
362 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
363 % if c.rhodecode_user.personal_repo_group:
363 % if c.rhodecode_user.personal_repo_group:
364 <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>
364 <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>
365 % endif
365 % endif
366 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
366 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
367
367
368 <li class="logout">
368 <li class="logout">
369 ${h.secure_form(h.route_path('logout'), request=request)}
369 ${h.secure_form(h.route_path('logout'), request=request)}
370 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
370 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
371 ${h.end_form()}
371 ${h.end_form()}
372 </li>
372 </li>
373 </ol>
373 </ol>
374 </div>
374 </div>
375 %endif
375 %endif
376 </div>
376 </div>
377 </div>
377 </div>
378 %if c.rhodecode_user.username != h.DEFAULT_USER:
378 %if c.rhodecode_user.username != h.DEFAULT_USER:
379 <div class="pill_container">
379 <div class="pill_container">
380 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
380 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
381 </div>
381 </div>
382 % endif
382 % endif
383 </li>
383 </li>
384 </%def>
384 </%def>
385
385
386 <%def name="menu_items(active=None)">
386 <%def name="menu_items(active=None)">
387 <%
387 <%
388 def is_active(selected):
388 def is_active(selected):
389 if selected == active:
389 if selected == active:
390 return "active"
390 return "active"
391 return ""
391 return ""
392 %>
392 %>
393
393
394 <ul id="quick" class="main_nav navigation horizontal-list">
394 <ul id="quick" class="main_nav navigation horizontal-list">
395 ## notice box for important system messages
395 ## notice box for important system messages
396 <li style="display: none">
396 <li style="display: none">
397 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
397 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
398 <div class="menulabel-notice" >
398 <div class="menulabel-notice" >
399 0
399 0
400 </div>
400 </div>
401 </a>
401 </a>
402 </li>
402 </li>
403
403
404 ## Main filter
404 ## Main filter
405 <li>
405 <li>
406 <div class="menulabel main_filter_box">
406 <div class="menulabel main_filter_box">
407 <div class="main_filter_input_box">
407 <div class="main_filter_input_box">
408 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value=""/>
408 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value=""/>
409 </div>
409 </div>
410 <div class="main_filter_help_box">
410 <div class="main_filter_help_box">
411 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
411 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
412 </div>
412 </div>
413 </div>
413 </div>
414
414
415 <div id="main_filter_help" style="display: none">
415 <div id="main_filter_help" style="display: none">
416 Use '/' key to quickly access this field.
416 Use '/' key to quickly access this field.
417 Enter name of repository, or repository group for quick search.
417 Enter name of repository, or repository group for quick search.
418
418
419 Prefix query to allow special search:
419 Prefix query to allow special search:
420
420
421 user:admin, to search for usernames
421 user:admin, to search for usernames
422
422
423 user_group:devops, to search for user groups
423 user_group:devops, to search for user groups
424
424
425 commit:efced4, to search for commits
425 commit:efced4, to search for commits
426
426
427 </div>
427 </div>
428 </li>
428 </li>
429
429
430 ## ROOT MENU
430 ## ROOT MENU
431 %if c.rhodecode_user.username != h.DEFAULT_USER:
431 %if c.rhodecode_user.username != h.DEFAULT_USER:
432 <li class="${is_active('journal')}">
432 <li class="${is_active('journal')}">
433 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
433 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
434 <div class="menulabel">${_('Journal')}</div>
434 <div class="menulabel">${_('Journal')}</div>
435 </a>
435 </a>
436 </li>
436 </li>
437 %else:
437 %else:
438 <li class="${is_active('journal')}">
438 <li class="${is_active('journal')}">
439 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
439 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
440 <div class="menulabel">${_('Public journal')}</div>
440 <div class="menulabel">${_('Public journal')}</div>
441 </a>
441 </a>
442 </li>
442 </li>
443 %endif
443 %endif
444 <li class="${is_active('gists')}">
444 <li class="${is_active('gists')}">
445 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
445 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
446 <div class="menulabel">${_('Gists')}</div>
446 <div class="menulabel">${_('Gists')}</div>
447 </a>
447 </a>
448 </li>
448 </li>
449 <li class="${is_active('search')}">
449 <li class="${is_active('search')}">
450 <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}">
450 <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}">
451 <div class="menulabel">${_('Search')}</div>
451 <div class="menulabel">${_('Search')}</div>
452 </a>
452 </a>
453 </li>
453 </li>
454 % if h.HasPermissionAll('hg.admin')('access admin main page'):
454 % if h.HasPermissionAll('hg.admin')('access admin main page'):
455 <li class="${is_active('admin')}">
455 <li class="${is_active('admin')}">
456 <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;">
456 <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;">
457 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
457 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
458 </a>
458 </a>
459 ${admin_menu()}
459 ${admin_menu()}
460 </li>
460 </li>
461 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
461 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
462 <li class="${is_active('admin')}">
462 <li class="${is_active('admin')}">
463 <a class="menulink childs" title="${_('Delegated Admin settings')}">
463 <a class="menulink childs" title="${_('Delegated Admin settings')}">
464 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
464 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
465 </a>
465 </a>
466 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
466 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
467 c.rhodecode_user.repository_groups_admin,
467 c.rhodecode_user.repository_groups_admin,
468 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
468 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
469 </li>
469 </li>
470 % endif
470 % endif
471 ## render extra user menu
471 ## render extra user menu
472 ${usermenu(active=(active=='my_account'))}
472 ${usermenu(active=(active=='my_account'))}
473
473
474 % if c.debug_style:
474 % if c.debug_style:
475 <li>
475 <li>
476 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
476 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
477 <div class="menulabel">${_('[Style]')}</div>
477 <div class="menulabel">${_('[Style]')}</div>
478 </a>
478 </a>
479 </li>
479 </li>
480 % endif
480 % endif
481 </ul>
481 </ul>
482
482
483 <script type="text/javascript">
483 <script type="text/javascript">
484 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
484 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
485
485
486 var formatRepoResult = function(result, container, query, escapeMarkup) {
486 var formatRepoResult = function(result, container, query, escapeMarkup) {
487 return function(data, escapeMarkup) {
487 return function(data, escapeMarkup) {
488 if (!data.repo_id){
488 if (!data.repo_id){
489 return data.text; // optgroup text Repositories
489 return data.text; // optgroup text Repositories
490 }
490 }
491
491
492 var tmpl = '';
492 var tmpl = '';
493 var repoType = data['repo_type'];
493 var repoType = data['repo_type'];
494 var repoName = data['text'];
494 var repoName = data['text'];
495
495
496 if(data && data.type == 'repo'){
496 if(data && data.type == 'repo'){
497 if(repoType === 'hg'){
497 if(repoType === 'hg'){
498 tmpl += '<i class="icon-hg"></i> ';
498 tmpl += '<i class="icon-hg"></i> ';
499 }
499 }
500 else if(repoType === 'git'){
500 else if(repoType === 'git'){
501 tmpl += '<i class="icon-git"></i> ';
501 tmpl += '<i class="icon-git"></i> ';
502 }
502 }
503 else if(repoType === 'svn'){
503 else if(repoType === 'svn'){
504 tmpl += '<i class="icon-svn"></i> ';
504 tmpl += '<i class="icon-svn"></i> ';
505 }
505 }
506 if(data['private']){
506 if(data['private']){
507 tmpl += '<i class="icon-lock" ></i> ';
507 tmpl += '<i class="icon-lock" ></i> ';
508 }
508 }
509 else if(visualShowPublicIcon){
509 else if(visualShowPublicIcon){
510 tmpl += '<i class="icon-unlock-alt"></i> ';
510 tmpl += '<i class="icon-unlock-alt"></i> ';
511 }
511 }
512 }
512 }
513 tmpl += escapeMarkup(repoName);
513 tmpl += escapeMarkup(repoName);
514 return tmpl;
514 return tmpl;
515
515
516 }(result, escapeMarkup);
516 }(result, escapeMarkup);
517 };
517 };
518
518
519
519
520 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
520 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
521
521
522 if (value.split(':').length === 2) {
522 if (value.split(':').length === 2) {
523 value = value.split(':')[1]
523 value = value.split(':')[1]
524 }
524 }
525
525
526 var searchType = data['type'];
526 var searchType = data['type'];
527 var valueDisplay = data['value_display'];
527 var valueDisplay = data['value_display'];
528
528
529 var escapeRegExChars = function (value) {
529 var escapeRegExChars = function (value) {
530 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
530 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
531 };
531 };
532 var pattern = '(' + escapeRegExChars(value) + ')';
532 var pattern = '(' + escapeRegExChars(value) + ')';
533
533
534 // highlight match
534 // highlight match
535 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
535 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
536 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
536 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
537
537
538 var icon = '';
538 var icon = '';
539
539
540 if (searchType === 'hint') {
540 if (searchType === 'hint') {
541 icon += '<i class="icon-folder-close"></i> ';
541 icon += '<i class="icon-folder-close"></i> ';
542 }
542 }
543 else if (searchType === 'search') {
543 else if (searchType === 'search') {
544 icon += '<i class="icon-more"></i> ';
544 icon += '<i class="icon-more"></i> ';
545 }
545 }
546 else if (searchType === 'repo') {
546 else if (searchType === 'repo') {
547 if (data['repo_type'] === 'hg') {
547 if (data['repo_type'] === 'hg') {
548 icon += '<i class="icon-hg"></i> ';
548 icon += '<i class="icon-hg"></i> ';
549 }
549 }
550 else if (data['repo_type'] === 'git') {
550 else if (data['repo_type'] === 'git') {
551 icon += '<i class="icon-git"></i> ';
551 icon += '<i class="icon-git"></i> ';
552 }
552 }
553 else if (data['repo_type'] === 'svn') {
553 else if (data['repo_type'] === 'svn') {
554 icon += '<i class="icon-svn"></i> ';
554 icon += '<i class="icon-svn"></i> ';
555 }
555 }
556 if (data['private']) {
556 if (data['private']) {
557 icon += '<i class="icon-lock" ></i> ';
557 icon += '<i class="icon-lock" ></i> ';
558 }
558 }
559 else if (visualShowPublicIcon) {
559 else if (visualShowPublicIcon) {
560 icon += '<i class="icon-unlock-alt"></i> ';
560 icon += '<i class="icon-unlock-alt"></i> ';
561 }
561 }
562 }
562 }
563 else if (searchType === 'repo_group') {
563 else if (searchType === 'repo_group') {
564 icon += '<i class="icon-folder-close"></i> ';
564 icon += '<i class="icon-folder-close"></i> ';
565 }
565 }
566 else if (searchType === 'user_group') {
566 else if (searchType === 'user_group') {
567 icon += '<i class="icon-group"></i> ';
567 icon += '<i class="icon-group"></i> ';
568 }
568 }
569 else if (searchType === 'user') {
569 else if (searchType === 'user') {
570 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
570 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
571 }
571 }
572 else if (searchType === 'commit') {
572 else if (searchType === 'commit') {
573 icon += '<i class="icon-tag"></i>';
573 icon += '<i class="icon-tag"></i>';
574 }
574 }
575
575
576 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
576 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
577 return tmpl.format(icon, valueDisplay);
577 return tmpl.format(icon, valueDisplay);
578 };
578 };
579
579
580 var handleSelect = function(element, suggestion) {
580 var handleSelect = function(element, suggestion) {
581 if (suggestion.type === "hint") {
581 if (suggestion.type === "hint") {
582 // we skip action
582 // we skip action
583 $('#main_filter').focus();
583 $('#main_filter').focus();
584 } else {
584 } else {
585 window.location = suggestion['url'];
585 window.location = suggestion['url'];
586 }
586 }
587 };
587 };
588 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
588 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
589 if (queryLowerCase.split(':').length === 2) {
589 if (queryLowerCase.split(':').length === 2) {
590 queryLowerCase = queryLowerCase.split(':')[1]
590 queryLowerCase = queryLowerCase.split(':')[1]
591 }
591 }
592 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
592 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
593 };
593 };
594
594
595 $('#main_filter').autocomplete({
595 $('#main_filter').autocomplete({
596 serviceUrl: pyroutes.url('goto_switcher_data'),
596 serviceUrl: pyroutes.url('goto_switcher_data'),
597 params: {"repo_group_id": templateContext.repo_group_id},
597 params: {"search_context": templateContext.search_context},
598 minChars:2,
598 minChars:2,
599 maxHeight:400,
599 maxHeight:400,
600 deferRequestBy: 300, //miliseconds
600 deferRequestBy: 300, //miliseconds
601 tabDisabled: true,
601 tabDisabled: true,
602 autoSelectFirst: true,
602 autoSelectFirst: true,
603 formatResult: autocompleteMainFilterFormatResult,
603 formatResult: autocompleteMainFilterFormatResult,
604 lookupFilter: autocompleteMainFilterResult,
604 lookupFilter: autocompleteMainFilterResult,
605 onSelect: function(element, suggestion){
605 onSelect: function (element, suggestion) {
606 handleSelect(element, suggestion);
606 handleSelect(element, suggestion);
607 return false;
607 return false;
608 },
609 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
610 if (jqXHR !== 'abort') {
611 alert("Error during search.\nError code: {0}".format(textStatus));
612 window.location = '';
613 }
608 }
614 }
609 });
615 });
610
616
611 showMainFilterBox = function () {
617 showMainFilterBox = function () {
612 $('#main_filter_help').toggle();
618 $('#main_filter_help').toggle();
613 }
619 }
614
620
615 </script>
621 </script>
616 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
622 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
617 </%def>
623 </%def>
618
624
619 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
625 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
620 <div class="modal-dialog">
626 <div class="modal-dialog">
621 <div class="modal-content">
627 <div class="modal-content">
622 <div class="modal-header">
628 <div class="modal-header">
623 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
629 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
624 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
630 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
625 </div>
631 </div>
626 <div class="modal-body">
632 <div class="modal-body">
627 <div class="block-left">
633 <div class="block-left">
628 <table class="keyboard-mappings">
634 <table class="keyboard-mappings">
629 <tbody>
635 <tbody>
630 <tr>
636 <tr>
631 <th></th>
637 <th></th>
632 <th>${_('Site-wide shortcuts')}</th>
638 <th>${_('Site-wide shortcuts')}</th>
633 </tr>
639 </tr>
634 <%
640 <%
635 elems = [
641 elems = [
636 ('/', 'Use quick search box'),
642 ('/', 'Use quick search box'),
637 ('g h', 'Goto home page'),
643 ('g h', 'Goto home page'),
638 ('g g', 'Goto my private gists page'),
644 ('g g', 'Goto my private gists page'),
639 ('g G', 'Goto my public gists page'),
645 ('g G', 'Goto my public gists page'),
640 ('n r', 'New repository page'),
646 ('n r', 'New repository page'),
641 ('n g', 'New gist page'),
647 ('n g', 'New gist page'),
642 ]
648 ]
643 %>
649 %>
644 %for key, desc in elems:
650 %for key, desc in elems:
645 <tr>
651 <tr>
646 <td class="keys">
652 <td class="keys">
647 <span class="key tag">${key}</span>
653 <span class="key tag">${key}</span>
648 </td>
654 </td>
649 <td>${desc}</td>
655 <td>${desc}</td>
650 </tr>
656 </tr>
651 %endfor
657 %endfor
652 </tbody>
658 </tbody>
653 </table>
659 </table>
654 </div>
660 </div>
655 <div class="block-left">
661 <div class="block-left">
656 <table class="keyboard-mappings">
662 <table class="keyboard-mappings">
657 <tbody>
663 <tbody>
658 <tr>
664 <tr>
659 <th></th>
665 <th></th>
660 <th>${_('Repositories')}</th>
666 <th>${_('Repositories')}</th>
661 </tr>
667 </tr>
662 <%
668 <%
663 elems = [
669 elems = [
664 ('g s', 'Goto summary page'),
670 ('g s', 'Goto summary page'),
665 ('g c', 'Goto changelog page'),
671 ('g c', 'Goto changelog page'),
666 ('g f', 'Goto files page'),
672 ('g f', 'Goto files page'),
667 ('g F', 'Goto files page with file search activated'),
673 ('g F', 'Goto files page with file search activated'),
668 ('g p', 'Goto pull requests page'),
674 ('g p', 'Goto pull requests page'),
669 ('g o', 'Goto repository settings'),
675 ('g o', 'Goto repository settings'),
670 ('g O', 'Goto repository permissions settings'),
676 ('g O', 'Goto repository permissions settings'),
671 ]
677 ]
672 %>
678 %>
673 %for key, desc in elems:
679 %for key, desc in elems:
674 <tr>
680 <tr>
675 <td class="keys">
681 <td class="keys">
676 <span class="key tag">${key}</span>
682 <span class="key tag">${key}</span>
677 </td>
683 </td>
678 <td>${desc}</td>
684 <td>${desc}</td>
679 </tr>
685 </tr>
680 %endfor
686 %endfor
681 </tbody>
687 </tbody>
682 </table>
688 </table>
683 </div>
689 </div>
684 </div>
690 </div>
685 <div class="modal-footer">
691 <div class="modal-footer">
686 </div>
692 </div>
687 </div><!-- /.modal-content -->
693 </div><!-- /.modal-content -->
688 </div><!-- /.modal-dialog -->
694 </div><!-- /.modal-dialog -->
689 </div><!-- /.modal -->
695 </div><!-- /.modal -->
690
696
General Comments 0
You need to be logged in to leave comments. Login now