##// END OF EJS Templates
ui: removed always visible options....
dan -
r4192:2b1fc876 stable
parent child Browse files
Show More
@@ -1,1140 +1,1136 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%!
3 <%!
4 ## base64 filter e.g ${ example | base64 }
4 ## base64 filter e.g ${ example | base64 }
5 def base64(text):
5 def base64(text):
6 import base64
6 import base64
7 from rhodecode.lib.helpers import safe_str
7 from rhodecode.lib.helpers import safe_str
8 return base64.encodestring(safe_str(text))
8 return base64.encodestring(safe_str(text))
9 %>
9 %>
10
10
11 <%inherit file="root.mako"/>
11 <%inherit file="root.mako"/>
12
12
13 <%include file="/ejs_templates/templates.html"/>
13 <%include file="/ejs_templates/templates.html"/>
14
14
15 <div class="outerwrapper">
15 <div class="outerwrapper">
16 <!-- HEADER -->
16 <!-- HEADER -->
17 <div class="header">
17 <div class="header">
18 <div id="header-inner" class="wrapper">
18 <div id="header-inner" class="wrapper">
19 <div id="logo">
19 <div id="logo">
20 <div class="logo-wrapper">
20 <div class="logo-wrapper">
21 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-60x60.png')}" alt="RhodeCode"/></a>
21 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-60x60.png')}" alt="RhodeCode"/></a>
22 </div>
22 </div>
23 % if c.rhodecode_name:
23 % if c.rhodecode_name:
24 <div class="branding">
24 <div class="branding">
25 <a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a>
25 <a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a>
26 </div>
26 </div>
27 % endif
27 % endif
28 </div>
28 </div>
29 <!-- MENU BAR NAV -->
29 <!-- MENU BAR NAV -->
30 ${self.menu_bar_nav()}
30 ${self.menu_bar_nav()}
31 <!-- END MENU BAR NAV -->
31 <!-- END MENU BAR NAV -->
32 </div>
32 </div>
33 </div>
33 </div>
34 ${self.menu_bar_subnav()}
34 ${self.menu_bar_subnav()}
35 <!-- END HEADER -->
35 <!-- END HEADER -->
36
36
37 <!-- CONTENT -->
37 <!-- CONTENT -->
38 <div id="content" class="wrapper">
38 <div id="content" class="wrapper">
39
39
40 <rhodecode-toast id="notifications"></rhodecode-toast>
40 <rhodecode-toast id="notifications"></rhodecode-toast>
41
41
42 <div class="main">
42 <div class="main">
43 ${next.main()}
43 ${next.main()}
44 </div>
44 </div>
45 </div>
45 </div>
46 <!-- END CONTENT -->
46 <!-- END CONTENT -->
47
47
48 </div>
48 </div>
49 <!-- FOOTER -->
49 <!-- FOOTER -->
50 <div id="footer">
50 <div id="footer">
51 <div id="footer-inner" class="title wrapper">
51 <div id="footer-inner" class="title wrapper">
52 <div>
52 <div>
53 <p class="footer-link-right">
53 <p class="footer-link-right">
54 % if c.visual.show_version:
54 % if c.visual.show_version:
55 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
55 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
56 % endif
56 % endif
57 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
57 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
58 % if c.visual.rhodecode_support_url:
58 % if c.visual.rhodecode_support_url:
59 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
59 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
60 % endif
60 % endif
61 </p>
61 </p>
62 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
62 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
63 <p class="server-instance" style="display:${sid}">
63 <p class="server-instance" style="display:${sid}">
64 ## display hidden instance ID if specially defined
64 ## display hidden instance ID if specially defined
65 % if c.rhodecode_instanceid:
65 % if c.rhodecode_instanceid:
66 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
66 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
67 % endif
67 % endif
68 </p>
68 </p>
69 </div>
69 </div>
70 </div>
70 </div>
71 </div>
71 </div>
72
72
73 <!-- END FOOTER -->
73 <!-- END FOOTER -->
74
74
75 ### MAKO DEFS ###
75 ### MAKO DEFS ###
76
76
77 <%def name="menu_bar_subnav()">
77 <%def name="menu_bar_subnav()">
78 </%def>
78 </%def>
79
79
80 <%def name="breadcrumbs(class_='breadcrumbs')">
80 <%def name="breadcrumbs(class_='breadcrumbs')">
81 <div class="${class_}">
81 <div class="${class_}">
82 ${self.breadcrumbs_links()}
82 ${self.breadcrumbs_links()}
83 </div>
83 </div>
84 </%def>
84 </%def>
85
85
86 <%def name="admin_menu(active=None)">
86 <%def name="admin_menu(active=None)">
87
87
88 <div id="context-bar">
88 <div id="context-bar">
89 <div class="wrapper">
89 <div class="wrapper">
90 <div class="title">
90 <div class="title">
91 <div class="title-content">
91 <div class="title-content">
92 <div class="title-main">
92 <div class="title-main">
93 % if c.is_super_admin:
93 % if c.is_super_admin:
94 ${_('Super-admin Panel')}
94 ${_('Super-admin Panel')}
95 % else:
95 % else:
96 ${_('Delegated Admin Panel')}
96 ${_('Delegated Admin Panel')}
97 % endif
97 % endif
98 </div>
98 </div>
99 </div>
99 </div>
100 </div>
100 </div>
101
101
102 <ul id="context-pages" class="navigation horizontal-list">
102 <ul id="context-pages" class="navigation horizontal-list">
103
103
104 ## super-admin case
104 ## super-admin case
105 % if c.is_super_admin:
105 % if c.is_super_admin:
106 <li class="${h.is_active('audit_logs', active)}"><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
106 <li class="${h.is_active('audit_logs', active)}"><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
107 <li class="${h.is_active('repositories', active)}"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
107 <li class="${h.is_active('repositories', active)}"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
108 <li class="${h.is_active('repository_groups', active)}"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
108 <li class="${h.is_active('repository_groups', active)}"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
109 <li class="${h.is_active('users', active)}"><a href="${h.route_path('users')}">${_('Users')}</a></li>
109 <li class="${h.is_active('users', active)}"><a href="${h.route_path('users')}">${_('Users')}</a></li>
110 <li class="${h.is_active('user_groups', active)}"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
110 <li class="${h.is_active('user_groups', active)}"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
111 <li class="${h.is_active('permissions', active)}"><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
111 <li class="${h.is_active('permissions', active)}"><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
112 <li class="${h.is_active('authentication', active)}"><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
112 <li class="${h.is_active('authentication', active)}"><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
113 <li class="${h.is_active('integrations', active)}"><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
113 <li class="${h.is_active('integrations', active)}"><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
114 <li class="${h.is_active('defaults', active)}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
114 <li class="${h.is_active('defaults', active)}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
115 <li class="${h.is_active('settings', active)}"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
115 <li class="${h.is_active('settings', active)}"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
116
116
117 ## delegated admin
117 ## delegated admin
118 % elif c.is_delegated_admin:
118 % elif c.is_delegated_admin:
119 <%
119 <%
120 repositories=c.auth_user.repositories_admin or c.can_create_repo
120 repositories=c.auth_user.repositories_admin or c.can_create_repo
121 repository_groups=c.auth_user.repository_groups_admin or c.can_create_repo_group
121 repository_groups=c.auth_user.repository_groups_admin or c.can_create_repo_group
122 user_groups=c.auth_user.user_groups_admin or c.can_create_user_group
122 user_groups=c.auth_user.user_groups_admin or c.can_create_user_group
123 %>
123 %>
124
124
125 %if repositories:
125 %if repositories:
126 <li class="${h.is_active('repositories', active)} local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
126 <li class="${h.is_active('repositories', active)} local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
127 %endif
127 %endif
128 %if repository_groups:
128 %if repository_groups:
129 <li class="${h.is_active('repository_groups', active)} local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
129 <li class="${h.is_active('repository_groups', active)} local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
130 %endif
130 %endif
131 %if user_groups:
131 %if user_groups:
132 <li class="${h.is_active('user_groups', active)} local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
132 <li class="${h.is_active('user_groups', active)} local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
133 %endif
133 %endif
134 % endif
134 % endif
135 </ul>
135 </ul>
136
136
137 </div>
137 </div>
138 <div class="clear"></div>
138 <div class="clear"></div>
139 </div>
139 </div>
140 </%def>
140 </%def>
141
141
142 <%def name="dt_info_panel(elements)">
142 <%def name="dt_info_panel(elements)">
143 <dl class="dl-horizontal">
143 <dl class="dl-horizontal">
144 %for dt, dd, title, show_items in elements:
144 %for dt, dd, title, show_items in elements:
145 <dt>${dt}:</dt>
145 <dt>${dt}:</dt>
146 <dd title="${h.tooltip(title)}">
146 <dd title="${h.tooltip(title)}">
147 %if callable(dd):
147 %if callable(dd):
148 ## allow lazy evaluation of elements
148 ## allow lazy evaluation of elements
149 ${dd()}
149 ${dd()}
150 %else:
150 %else:
151 ${dd}
151 ${dd}
152 %endif
152 %endif
153 %if show_items:
153 %if show_items:
154 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
154 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
155 %endif
155 %endif
156 </dd>
156 </dd>
157
157
158 %if show_items:
158 %if show_items:
159 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
159 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
160 %for item in show_items:
160 %for item in show_items:
161 <dt></dt>
161 <dt></dt>
162 <dd>${item}</dd>
162 <dd>${item}</dd>
163 %endfor
163 %endfor
164 </div>
164 </div>
165 %endif
165 %endif
166
166
167 %endfor
167 %endfor
168 </dl>
168 </dl>
169 </%def>
169 </%def>
170
170
171 <%def name="tr_info_entry(element)">
171 <%def name="tr_info_entry(element)">
172 <% key, val, title, show_items = element %>
172 <% key, val, title, show_items = element %>
173
173
174 <tr>
174 <tr>
175 <td style="vertical-align: top">${key}</td>
175 <td style="vertical-align: top">${key}</td>
176 <td title="${h.tooltip(title)}">
176 <td title="${h.tooltip(title)}">
177 %if callable(val):
177 %if callable(val):
178 ## allow lazy evaluation of elements
178 ## allow lazy evaluation of elements
179 ${val()}
179 ${val()}
180 %else:
180 %else:
181 ${val}
181 ${val}
182 %endif
182 %endif
183 %if show_items:
183 %if show_items:
184 <div class="collapsable-content" data-toggle="item-${h.md5_safe(val)[:6]}-details" style="display: none">
184 <div class="collapsable-content" data-toggle="item-${h.md5_safe(val)[:6]}-details" style="display: none">
185 % for item in show_items:
185 % for item in show_items:
186 <dt></dt>
186 <dt></dt>
187 <dd>${item}</dd>
187 <dd>${item}</dd>
188 % endfor
188 % endfor
189 </div>
189 </div>
190 %endif
190 %endif
191 </td>
191 </td>
192 <td style="vertical-align: top">
192 <td style="vertical-align: top">
193 %if show_items:
193 %if show_items:
194 <span class="btn-collapse" data-toggle="item-${h.md5_safe(val)[:6]}-details">${_('Show More')} </span>
194 <span class="btn-collapse" data-toggle="item-${h.md5_safe(val)[:6]}-details">${_('Show More')} </span>
195 %endif
195 %endif
196 </td>
196 </td>
197 </tr>
197 </tr>
198
198
199 </%def>
199 </%def>
200
200
201 <%def name="gravatar(email, size=16, tooltip=False, tooltip_alt=None, user=None, extra_class=None)">
201 <%def name="gravatar(email, size=16, tooltip=False, tooltip_alt=None, user=None, extra_class=None)">
202 <%
202 <%
203 if size > 16:
203 if size > 16:
204 gravatar_class = ['gravatar','gravatar-large']
204 gravatar_class = ['gravatar','gravatar-large']
205 else:
205 else:
206 gravatar_class = ['gravatar']
206 gravatar_class = ['gravatar']
207
207
208 data_hovercard_url = ''
208 data_hovercard_url = ''
209 data_hovercard_alt = tooltip_alt.replace('<', '&lt;').replace('>', '&gt;') if tooltip_alt else ''
209 data_hovercard_alt = tooltip_alt.replace('<', '&lt;').replace('>', '&gt;') if tooltip_alt else ''
210
210
211 if tooltip:
211 if tooltip:
212 gravatar_class += ['tooltip-hovercard']
212 gravatar_class += ['tooltip-hovercard']
213 if extra_class:
213 if extra_class:
214 gravatar_class += extra_class
214 gravatar_class += extra_class
215 if tooltip and user:
215 if tooltip and user:
216 if user.username == h.DEFAULT_USER:
216 if user.username == h.DEFAULT_USER:
217 gravatar_class.pop(-1)
217 gravatar_class.pop(-1)
218 else:
218 else:
219 data_hovercard_url = request.route_path('hovercard_user', user_id=getattr(user, 'user_id', ''))
219 data_hovercard_url = request.route_path('hovercard_user', user_id=getattr(user, 'user_id', ''))
220 gravatar_class = ' '.join(gravatar_class)
220 gravatar_class = ' '.join(gravatar_class)
221
221
222 %>
222 %>
223 <%doc>
223 <%doc>
224 TODO: johbo: For now we serve double size images to make it smooth
224 TODO: johbo: For now we serve double size images to make it smooth
225 for retina. This is how it worked until now. Should be replaced
225 for retina. This is how it worked until now. Should be replaced
226 with a better solution at some point.
226 with a better solution at some point.
227 </%doc>
227 </%doc>
228
228
229 <img class="${gravatar_class}" height="${size}" width="${size}" data-hovercard-url="${data_hovercard_url}" data-hovercard-alt="${data_hovercard_alt}" src="${h.gravatar_url(email, size * 2)}" />
229 <img class="${gravatar_class}" height="${size}" width="${size}" data-hovercard-url="${data_hovercard_url}" data-hovercard-alt="${data_hovercard_alt}" src="${h.gravatar_url(email, size * 2)}" />
230 </%def>
230 </%def>
231
231
232
232
233 <%def name="gravatar_with_user(contact, size=16, show_disabled=False, tooltip=False)">
233 <%def name="gravatar_with_user(contact, size=16, show_disabled=False, tooltip=False)">
234 <%
234 <%
235 email = h.email_or_none(contact)
235 email = h.email_or_none(contact)
236 rc_user = h.discover_user(contact)
236 rc_user = h.discover_user(contact)
237 %>
237 %>
238
238
239 <div class="rc-user">
239 <div class="rc-user">
240 ${self.gravatar(email, size, tooltip=tooltip, tooltip_alt=contact, user=rc_user)}
240 ${self.gravatar(email, size, tooltip=tooltip, tooltip_alt=contact, user=rc_user)}
241 <span class="${('user user-disabled' if show_disabled else 'user')}"> ${h.link_to_user(rc_user or contact)}</span>
241 <span class="${('user user-disabled' if show_disabled else 'user')}"> ${h.link_to_user(rc_user or contact)}</span>
242 </div>
242 </div>
243 </%def>
243 </%def>
244
244
245
245
246 <%def name="user_group_icon(user_group=None, size=16, tooltip=False)">
246 <%def name="user_group_icon(user_group=None, size=16, tooltip=False)">
247 <%
247 <%
248 if (size > 16):
248 if (size > 16):
249 gravatar_class = 'icon-user-group-alt'
249 gravatar_class = 'icon-user-group-alt'
250 else:
250 else:
251 gravatar_class = 'icon-user-group-alt'
251 gravatar_class = 'icon-user-group-alt'
252
252
253 if tooltip:
253 if tooltip:
254 gravatar_class += ' tooltip-hovercard'
254 gravatar_class += ' tooltip-hovercard'
255
255
256 data_hovercard_url = request.route_path('hovercard_user_group', user_group_id=user_group.users_group_id)
256 data_hovercard_url = request.route_path('hovercard_user_group', user_group_id=user_group.users_group_id)
257 %>
257 %>
258 <%doc>
258 <%doc>
259 TODO: johbo: For now we serve double size images to make it smooth
259 TODO: johbo: For now we serve double size images to make it smooth
260 for retina. This is how it worked until now. Should be replaced
260 for retina. This is how it worked until now. Should be replaced
261 with a better solution at some point.
261 with a better solution at some point.
262 </%doc>
262 </%doc>
263
263
264 <i style="font-size: ${size}px" class="${gravatar_class} x-icon-size-${size}" data-hovercard-url="${data_hovercard_url}"></i>
264 <i style="font-size: ${size}px" class="${gravatar_class} x-icon-size-${size}" data-hovercard-url="${data_hovercard_url}"></i>
265 </%def>
265 </%def>
266
266
267 <%def name="repo_page_title(repo_instance)">
267 <%def name="repo_page_title(repo_instance)">
268 <div class="title-content repo-title">
268 <div class="title-content repo-title">
269
269
270 <div class="title-main">
270 <div class="title-main">
271 ## SVN/HG/GIT icons
271 ## SVN/HG/GIT icons
272 %if h.is_hg(repo_instance):
272 %if h.is_hg(repo_instance):
273 <i class="icon-hg"></i>
273 <i class="icon-hg"></i>
274 %endif
274 %endif
275 %if h.is_git(repo_instance):
275 %if h.is_git(repo_instance):
276 <i class="icon-git"></i>
276 <i class="icon-git"></i>
277 %endif
277 %endif
278 %if h.is_svn(repo_instance):
278 %if h.is_svn(repo_instance):
279 <i class="icon-svn"></i>
279 <i class="icon-svn"></i>
280 %endif
280 %endif
281
281
282 ## public/private
282 ## public/private
283 %if repo_instance.private:
283 %if repo_instance.private:
284 <i class="icon-repo-private"></i>
284 <i class="icon-repo-private"></i>
285 %else:
285 %else:
286 <i class="icon-repo-public"></i>
286 <i class="icon-repo-public"></i>
287 %endif
287 %endif
288
288
289 ## repo name with group name
289 ## repo name with group name
290 ${h.breadcrumb_repo_link(repo_instance)}
290 ${h.breadcrumb_repo_link(repo_instance)}
291
291
292 ## Context Actions
292 ## Context Actions
293 <div class="pull-right">
293 <div class="pull-right">
294 %if c.rhodecode_user.username != h.DEFAULT_USER:
294 %if c.rhodecode_user.username != h.DEFAULT_USER:
295 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_uid, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a>
295 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_uid, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a>
296
296
297 <a href="#WatchRepo" onclick="toggleFollowingRepo(this, templateContext.repo_id); return false" title="${_('Watch this Repository and actions on it in your personalized journal')}" class="btn btn-sm ${('watching' if c.repository_is_user_following else '')}">
297 <a href="#WatchRepo" onclick="toggleFollowingRepo(this, templateContext.repo_id); return false" title="${_('Watch this Repository and actions on it in your personalized journal')}" class="btn btn-sm ${('watching' if c.repository_is_user_following else '')}">
298 % if c.repository_is_user_following:
298 % if c.repository_is_user_following:
299 <i class="icon-eye-off"></i>${_('Unwatch')}
299 <i class="icon-eye-off"></i>${_('Unwatch')}
300 % else:
300 % else:
301 <i class="icon-eye"></i>${_('Watch')}
301 <i class="icon-eye"></i>${_('Watch')}
302 % endif
302 % endif
303
303
304 </a>
304 </a>
305 %else:
305 %else:
306 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_uid)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a>
306 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_uid)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a>
307 %endif
307 %endif
308 </div>
308 </div>
309
309
310 </div>
310 </div>
311
311
312 ## FORKED
312 ## FORKED
313 %if repo_instance.fork:
313 %if repo_instance.fork:
314 <p class="discreet">
314 <p class="discreet">
315 <i class="icon-code-fork"></i> ${_('Fork of')}
315 <i class="icon-code-fork"></i> ${_('Fork of')}
316 ${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))}
316 ${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))}
317 </p>
317 </p>
318 %endif
318 %endif
319
319
320 ## IMPORTED FROM REMOTE
320 ## IMPORTED FROM REMOTE
321 %if repo_instance.clone_uri:
321 %if repo_instance.clone_uri:
322 <p class="discreet">
322 <p class="discreet">
323 <i class="icon-code-fork"></i> ${_('Clone from')}
323 <i class="icon-code-fork"></i> ${_('Clone from')}
324 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
324 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
325 </p>
325 </p>
326 %endif
326 %endif
327
327
328 ## LOCKING STATUS
328 ## LOCKING STATUS
329 %if repo_instance.locked[0]:
329 %if repo_instance.locked[0]:
330 <p class="locking_locked discreet">
330 <p class="locking_locked discreet">
331 <i class="icon-repo-lock"></i>
331 <i class="icon-repo-lock"></i>
332 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
332 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
333 </p>
333 </p>
334 %elif repo_instance.enable_locking:
334 %elif repo_instance.enable_locking:
335 <p class="locking_unlocked discreet">
335 <p class="locking_unlocked discreet">
336 <i class="icon-repo-unlock"></i>
336 <i class="icon-repo-unlock"></i>
337 ${_('Repository not locked. Pull repository to lock it.')}
337 ${_('Repository not locked. Pull repository to lock it.')}
338 </p>
338 </p>
339 %endif
339 %endif
340
340
341 </div>
341 </div>
342 </%def>
342 </%def>
343
343
344 <%def name="repo_menu(active=None)">
344 <%def name="repo_menu(active=None)">
345 <%
345 <%
346 ## determine if we have "any" option available
346 ## determine if we have "any" option available
347 can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking
347 can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking
348 has_actions = can_lock
348 has_actions = can_lock
349
349
350 %>
350 %>
351 % if c.rhodecode_db_repo.archived:
351 % if c.rhodecode_db_repo.archived:
352 <div class="alert alert-warning text-center">
352 <div class="alert alert-warning text-center">
353 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
353 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
354 </div>
354 </div>
355 % endif
355 % endif
356
356
357 <!--- REPO CONTEXT BAR -->
357 <!--- REPO CONTEXT BAR -->
358 <div id="context-bar">
358 <div id="context-bar">
359 <div class="wrapper">
359 <div class="wrapper">
360
360
361 <div class="title">
361 <div class="title">
362 ${self.repo_page_title(c.rhodecode_db_repo)}
362 ${self.repo_page_title(c.rhodecode_db_repo)}
363 </div>
363 </div>
364
364
365 <ul id="context-pages" class="navigation horizontal-list">
365 <ul id="context-pages" class="navigation horizontal-list">
366 <li class="${h.is_active('summary', active)}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
366 <li class="${h.is_active('summary', active)}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
367 <li class="${h.is_active('commits', active)}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
367 <li class="${h.is_active('commits', active)}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
368 <li class="${h.is_active('files', active)}"><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>
368 <li class="${h.is_active('files', active)}"><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>
369 <li class="${h.is_active('compare', active)}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
369 <li class="${h.is_active('compare', active)}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
370
370
371 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
371 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
372 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
372 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
373 <li class="${h.is_active('showpullrequest', active)}">
373 <li class="${h.is_active('showpullrequest', active)}">
374 <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)}">
374 <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)}">
375 <div class="menulabel">
375 <div class="menulabel">
376 ${_('Pull Requests')} <span class="menulink-counter">${c.repository_pull_requests}</span>
376 ${_('Pull Requests')} <span class="menulink-counter">${c.repository_pull_requests}</span>
377 </div>
377 </div>
378 </a>
378 </a>
379 </li>
379 </li>
380 %endif
380 %endif
381
381
382 <li class="${h.is_active('artifacts', active)}">
382 <li class="${h.is_active('artifacts', active)}">
383 <a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}">
383 <a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}">
384 <div class="menulabel">
384 <div class="menulabel">
385 ${_('Artifacts')} <span class="menulink-counter">${c.repository_artifacts}</span>
385 ${_('Artifacts')} <span class="menulink-counter">${c.repository_artifacts}</span>
386 </div>
386 </div>
387 </a>
387 </a>
388 </li>
388 </li>
389
389
390 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
390 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
391 <li class="${h.is_active('settings', active)}"><a class="menulink" href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Repository Settings')}</div></a></li>
391 <li class="${h.is_active('settings', active)}"><a class="menulink" href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Repository Settings')}</div></a></li>
392 %endif
392 %endif
393
393
394 <li class="${h.is_active('options', active)}">
394 <li class="${h.is_active('options', active)}">
395 % if has_actions:
395 % if has_actions:
396 <a class="menulink dropdown">
396 <a class="menulink dropdown">
397 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
397 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
398 </a>
398 </a>
399 <ul class="submenu">
399 <ul class="submenu">
400 %if can_lock:
400 %if can_lock:
401 %if c.rhodecode_db_repo.locked[0]:
401 %if c.rhodecode_db_repo.locked[0]:
402 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock Repository')}</a></li>
402 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock Repository')}</a></li>
403 %else:
403 %else:
404 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock Repository')}</a></li>
404 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock Repository')}</a></li>
405 %endif
405 %endif
406 %endif
406 %endif
407 </ul>
407 </ul>
408 % else:
409 <a class="menulink disabled">
410 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
411 </a>
412 % endif
408 % endif
413 </li>
409 </li>
414
410
415 </ul>
411 </ul>
416 </div>
412 </div>
417 <div class="clear"></div>
413 <div class="clear"></div>
418 </div>
414 </div>
419
415
420 <!--- REPO END CONTEXT BAR -->
416 <!--- REPO END CONTEXT BAR -->
421
417
422 </%def>
418 </%def>
423
419
424 <%def name="repo_group_page_title(repo_group_instance)">
420 <%def name="repo_group_page_title(repo_group_instance)">
425 <div class="title-content">
421 <div class="title-content">
426 <div class="title-main">
422 <div class="title-main">
427 ## Repository Group icon
423 ## Repository Group icon
428 <i class="icon-repo-group"></i>
424 <i class="icon-repo-group"></i>
429
425
430 ## repo name with group name
426 ## repo name with group name
431 ${h.breadcrumb_repo_group_link(repo_group_instance)}
427 ${h.breadcrumb_repo_group_link(repo_group_instance)}
432 </div>
428 </div>
433
429
434 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
430 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
435 <div class="repo-group-desc discreet">
431 <div class="repo-group-desc discreet">
436 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
432 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
437 </div>
433 </div>
438
434
439 </div>
435 </div>
440 </%def>
436 </%def>
441
437
442
438
443 <%def name="repo_group_menu(active=None)">
439 <%def name="repo_group_menu(active=None)">
444 <%
440 <%
445 gr_name = c.repo_group.group_name if c.repo_group else None
441 gr_name = c.repo_group.group_name if c.repo_group else None
446 # create repositories with write permission on group is set to true
442 # create repositories with write permission on group is set to true
447 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
443 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
448
444
449 %>
445 %>
450
446
451
447
452 <!--- REPO GROUP CONTEXT BAR -->
448 <!--- REPO GROUP CONTEXT BAR -->
453 <div id="context-bar">
449 <div id="context-bar">
454 <div class="wrapper">
450 <div class="wrapper">
455 <div class="title">
451 <div class="title">
456 ${self.repo_group_page_title(c.repo_group)}
452 ${self.repo_group_page_title(c.repo_group)}
457 </div>
453 </div>
458
454
459 <ul id="context-pages" class="navigation horizontal-list">
455 <ul id="context-pages" class="navigation horizontal-list">
460 <li class="${h.is_active('home', active)}">
456 <li class="${h.is_active('home', active)}">
461 <a class="menulink" href="${h.route_path('repo_group_home', repo_group_name=c.repo_group.group_name)}"><div class="menulabel">${_('Group Home')}</div></a>
457 <a class="menulink" href="${h.route_path('repo_group_home', repo_group_name=c.repo_group.group_name)}"><div class="menulabel">${_('Group Home')}</div></a>
462 </li>
458 </li>
463 % if c.is_super_admin or group_admin:
459 % if c.is_super_admin or group_admin:
464 <li class="${h.is_active('settings', active)}">
460 <li class="${h.is_active('settings', active)}">
465 <a class="menulink" href="${h.route_path('edit_repo_group',repo_group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}"><div class="menulabel">${_('Group Settings')}</div></a>
461 <a class="menulink" href="${h.route_path('edit_repo_group',repo_group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}"><div class="menulabel">${_('Group Settings')}</div></a>
466 </li>
462 </li>
467 % endif
463 % endif
468
464
469 </ul>
465 </ul>
470 </div>
466 </div>
471 <div class="clear"></div>
467 <div class="clear"></div>
472 </div>
468 </div>
473
469
474 <!--- REPO GROUP CONTEXT BAR -->
470 <!--- REPO GROUP CONTEXT BAR -->
475
471
476 </%def>
472 </%def>
477
473
478
474
479 <%def name="usermenu(active=False)">
475 <%def name="usermenu(active=False)">
480 <%
476 <%
481 not_anonymous = c.rhodecode_user.username != h.DEFAULT_USER
477 not_anonymous = c.rhodecode_user.username != h.DEFAULT_USER
482
478
483 gr_name = c.repo_group.group_name if (hasattr(c, 'repo_group') and c.repo_group) else None
479 gr_name = c.repo_group.group_name if (hasattr(c, 'repo_group') and c.repo_group) else None
484 # create repositories with write permission on group is set to true
480 # create repositories with write permission on group is set to true
485
481
486 can_fork = c.is_super_admin or h.HasPermissionAny('hg.fork.repository')()
482 can_fork = c.is_super_admin or h.HasPermissionAny('hg.fork.repository')()
487 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
483 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
488 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
484 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
489 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
485 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
490
486
491 can_create_repos = c.is_super_admin or c.can_create_repo
487 can_create_repos = c.is_super_admin or c.can_create_repo
492 can_create_repo_groups = c.is_super_admin or c.can_create_repo_group
488 can_create_repo_groups = c.is_super_admin or c.can_create_repo_group
493
489
494 can_create_repos_in_group = c.is_super_admin or group_admin or (group_write and create_on_write)
490 can_create_repos_in_group = c.is_super_admin or group_admin or (group_write and create_on_write)
495 can_create_repo_groups_in_group = c.is_super_admin or group_admin
491 can_create_repo_groups_in_group = c.is_super_admin or group_admin
496 %>
492 %>
497
493
498 % if not_anonymous:
494 % if not_anonymous:
499 <%
495 <%
500 default_target_group = dict()
496 default_target_group = dict()
501 if c.rhodecode_user.personal_repo_group:
497 if c.rhodecode_user.personal_repo_group:
502 default_target_group = dict(parent_group=c.rhodecode_user.personal_repo_group.group_id)
498 default_target_group = dict(parent_group=c.rhodecode_user.personal_repo_group.group_id)
503 %>
499 %>
504
500
505 ## create action
501 ## create action
506 <li>
502 <li>
507 <a href="#create-actions" onclick="return false;" class="menulink childs">
503 <a href="#create-actions" onclick="return false;" class="menulink childs">
508 <i class="tooltip icon-plus-circled" title="${_('Create')}"></i>
504 <i class="tooltip icon-plus-circled" title="${_('Create')}"></i>
509 </a>
505 </a>
510
506
511 <div class="action-menu submenu">
507 <div class="action-menu submenu">
512
508
513 <ol>
509 <ol>
514 ## scope of within a repository
510 ## scope of within a repository
515 % if hasattr(c, 'rhodecode_db_repo') and c.rhodecode_db_repo:
511 % if hasattr(c, 'rhodecode_db_repo') and c.rhodecode_db_repo:
516 <li class="submenu-title">${_('This Repository')}</li>
512 <li class="submenu-title">${_('This Repository')}</li>
517 <li>
513 <li>
518 <a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a>
514 <a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a>
519 </li>
515 </li>
520 % if can_fork:
516 % if can_fork:
521 <li>
517 <li>
522 <a href="${h.route_path('repo_fork_new',repo_name=c.repo_name,_query=default_target_group)}">${_('Fork this repository')}</a>
518 <a href="${h.route_path('repo_fork_new',repo_name=c.repo_name,_query=default_target_group)}">${_('Fork this repository')}</a>
523 </li>
519 </li>
524 % endif
520 % endif
525 % endif
521 % endif
526
522
527 ## scope of within repository groups
523 ## scope of within repository groups
528 % if hasattr(c, 'repo_group') and c.repo_group and (can_create_repos_in_group or can_create_repo_groups_in_group):
524 % if hasattr(c, 'repo_group') and c.repo_group and (can_create_repos_in_group or can_create_repo_groups_in_group):
529 <li class="submenu-title">${_('This Repository Group')}</li>
525 <li class="submenu-title">${_('This Repository Group')}</li>
530
526
531 % if can_create_repos_in_group:
527 % if can_create_repos_in_group:
532 <li>
528 <li>
533 <a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('New Repository')}</a>
529 <a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('New Repository')}</a>
534 </li>
530 </li>
535 % endif
531 % endif
536
532
537 % if can_create_repo_groups_in_group:
533 % if can_create_repo_groups_in_group:
538 <li>
534 <li>
539 <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'New Repository Group')}</a>
535 <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'New Repository Group')}</a>
540 </li>
536 </li>
541 % endif
537 % endif
542 % endif
538 % endif
543
539
544 ## personal group
540 ## personal group
545 % if c.rhodecode_user.personal_repo_group:
541 % if c.rhodecode_user.personal_repo_group:
546 <li class="submenu-title">Personal Group</li>
542 <li class="submenu-title">Personal Group</li>
547
543
548 <li>
544 <li>
549 <a href="${h.route_path('repo_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}" >${_('New Repository')} </a>
545 <a href="${h.route_path('repo_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}" >${_('New Repository')} </a>
550 </li>
546 </li>
551
547
552 <li>
548 <li>
553 <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}">${_('New Repository Group')} </a>
549 <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}">${_('New Repository Group')} </a>
554 </li>
550 </li>
555 % endif
551 % endif
556
552
557 ## Global actions
553 ## Global actions
558 <li class="submenu-title">RhodeCode</li>
554 <li class="submenu-title">RhodeCode</li>
559 % if can_create_repos:
555 % if can_create_repos:
560 <li>
556 <li>
561 <a href="${h.route_path('repo_new')}" >${_('New Repository')}</a>
557 <a href="${h.route_path('repo_new')}" >${_('New Repository')}</a>
562 </li>
558 </li>
563 % endif
559 % endif
564
560
565 % if can_create_repo_groups:
561 % if can_create_repo_groups:
566 <li>
562 <li>
567 <a href="${h.route_path('repo_group_new')}" >${_(u'New Repository Group')}</a>
563 <a href="${h.route_path('repo_group_new')}" >${_(u'New Repository Group')}</a>
568 </li>
564 </li>
569 % endif
565 % endif
570
566
571 <li>
567 <li>
572 <a href="${h.route_path('gists_new')}">${_(u'New Gist')}</a>
568 <a href="${h.route_path('gists_new')}">${_(u'New Gist')}</a>
573 </li>
569 </li>
574
570
575 </ol>
571 </ol>
576
572
577 </div>
573 </div>
578 </li>
574 </li>
579
575
580 ## notifications
576 ## notifications
581 <li>
577 <li>
582 <a class="${('empty' if c.unread_notifications == 0 else '')}" href="${h.route_path('notifications_show_all')}">
578 <a class="${('empty' if c.unread_notifications == 0 else '')}" href="${h.route_path('notifications_show_all')}">
583 ${c.unread_notifications}
579 ${c.unread_notifications}
584 </a>
580 </a>
585 </li>
581 </li>
586 % endif
582 % endif
587
583
588 ## USER MENU
584 ## USER MENU
589 <li id="quick_login_li" class="${'active' if active else ''}">
585 <li id="quick_login_li" class="${'active' if active else ''}">
590 % if c.rhodecode_user.username == h.DEFAULT_USER:
586 % if c.rhodecode_user.username == h.DEFAULT_USER:
591 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
587 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
592 ${gravatar(c.rhodecode_user.email, 20)}
588 ${gravatar(c.rhodecode_user.email, 20)}
593 <span class="user">
589 <span class="user">
594 <span>${_('Sign in')}</span>
590 <span>${_('Sign in')}</span>
595 </span>
591 </span>
596 </a>
592 </a>
597 % else:
593 % else:
598 ## logged in user
594 ## logged in user
599 <a id="quick_login_link" class="menulink childs">
595 <a id="quick_login_link" class="menulink childs">
600 ${gravatar(c.rhodecode_user.email, 20)}
596 ${gravatar(c.rhodecode_user.email, 20)}
601 <span class="user">
597 <span class="user">
602 <span class="menu_link_user">${c.rhodecode_user.username}</span>
598 <span class="menu_link_user">${c.rhodecode_user.username}</span>
603 <div class="show_more"></div>
599 <div class="show_more"></div>
604 </span>
600 </span>
605 </a>
601 </a>
606 ## subnav with menu for logged in user
602 ## subnav with menu for logged in user
607 <div class="user-menu submenu">
603 <div class="user-menu submenu">
608 <div id="quick_login">
604 <div id="quick_login">
609 %if c.rhodecode_user.username != h.DEFAULT_USER:
605 %if c.rhodecode_user.username != h.DEFAULT_USER:
610 <div class="">
606 <div class="">
611 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
607 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
612 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
608 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
613 <div class="email">${c.rhodecode_user.email}</div>
609 <div class="email">${c.rhodecode_user.email}</div>
614 </div>
610 </div>
615 <div class="">
611 <div class="">
616 <ol class="links">
612 <ol class="links">
617 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
613 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
618 % if c.rhodecode_user.personal_repo_group:
614 % if c.rhodecode_user.personal_repo_group:
619 <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>
615 <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>
620 % endif
616 % endif
621 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
617 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
622
618
623 % if c.debug_style:
619 % if c.debug_style:
624 <li>
620 <li>
625 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
621 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
626 <div class="menulabel">${_('[Style]')}</div>
622 <div class="menulabel">${_('[Style]')}</div>
627 </a>
623 </a>
628 </li>
624 </li>
629 % endif
625 % endif
630
626
631 ## bookmark-items
627 ## bookmark-items
632 <li class="bookmark-items">
628 <li class="bookmark-items">
633 ${_('Bookmarks')}
629 ${_('Bookmarks')}
634 <div class="pull-right">
630 <div class="pull-right">
635 <a href="${h.route_path('my_account_bookmarks')}">
631 <a href="${h.route_path('my_account_bookmarks')}">
636
632
637 <i class="icon-cog"></i>
633 <i class="icon-cog"></i>
638 </a>
634 </a>
639 </div>
635 </div>
640 </li>
636 </li>
641 % if not c.bookmark_items:
637 % if not c.bookmark_items:
642 <li>
638 <li>
643 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
639 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
644 </li>
640 </li>
645 % endif
641 % endif
646 % for item in c.bookmark_items:
642 % for item in c.bookmark_items:
647 <li>
643 <li>
648 % if item.repository:
644 % if item.repository:
649 <div>
645 <div>
650 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
646 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
651 <code>${item.position}</code>
647 <code>${item.position}</code>
652 % if item.repository.repo_type == 'hg':
648 % if item.repository.repo_type == 'hg':
653 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
649 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
654 % elif item.repository.repo_type == 'git':
650 % elif item.repository.repo_type == 'git':
655 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
651 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
656 % elif item.repository.repo_type == 'svn':
652 % elif item.repository.repo_type == 'svn':
657 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
653 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
658 % endif
654 % endif
659 ${(item.title or h.shorter(item.repository.repo_name, 30))}
655 ${(item.title or h.shorter(item.repository.repo_name, 30))}
660 </a>
656 </a>
661 </div>
657 </div>
662 % elif item.repository_group:
658 % elif item.repository_group:
663 <div>
659 <div>
664 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
660 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
665 <code>${item.position}</code>
661 <code>${item.position}</code>
666 <i class="icon-repo-group" title="${_('Repository group')}" style="font-size: 14px"></i>
662 <i class="icon-repo-group" title="${_('Repository group')}" style="font-size: 14px"></i>
667 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
663 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
668 </a>
664 </a>
669 </div>
665 </div>
670 % else:
666 % else:
671 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
667 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
672 <code>${item.position}</code>
668 <code>${item.position}</code>
673 ${item.title}
669 ${item.title}
674 </a>
670 </a>
675 % endif
671 % endif
676 </li>
672 </li>
677 % endfor
673 % endfor
678
674
679 <li class="logout">
675 <li class="logout">
680 ${h.secure_form(h.route_path('logout'), request=request)}
676 ${h.secure_form(h.route_path('logout'), request=request)}
681 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
677 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
682 ${h.end_form()}
678 ${h.end_form()}
683 </li>
679 </li>
684 </ol>
680 </ol>
685 </div>
681 </div>
686 %endif
682 %endif
687 </div>
683 </div>
688 </div>
684 </div>
689
685
690 % endif
686 % endif
691 </li>
687 </li>
692 </%def>
688 </%def>
693
689
694 <%def name="menu_items(active=None)">
690 <%def name="menu_items(active=None)">
695
691
696 <ul id="quick" class="main_nav navigation horizontal-list">
692 <ul id="quick" class="main_nav navigation horizontal-list">
697 ## notice box for important system messages
693 ## notice box for important system messages
698 <li style="display: none">
694 <li style="display: none">
699 <a class="notice-box" href="#openNotice" onclick="return false">
695 <a class="notice-box" href="#openNotice" onclick="return false">
700 <div class="menulabel-notice" >
696 <div class="menulabel-notice" >
701 0
697 0
702 </div>
698 </div>
703 </a>
699 </a>
704 </li>
700 </li>
705
701
706 ## Main filter
702 ## Main filter
707 <li>
703 <li>
708 <div class="menulabel main_filter_box">
704 <div class="menulabel main_filter_box">
709 <div class="main_filter_input_box">
705 <div class="main_filter_input_box">
710 <ul class="searchItems">
706 <ul class="searchItems">
711
707
712 <li class="searchTag searchTagIcon">
708 <li class="searchTag searchTagIcon">
713 <i class="icon-search"></i>
709 <i class="icon-search"></i>
714 </li>
710 </li>
715
711
716 % if c.template_context['search_context']['repo_id']:
712 % if c.template_context['search_context']['repo_id']:
717 <li class="searchTag searchTagFilter searchTagHidable" >
713 <li class="searchTag searchTagFilter searchTagHidable" >
718 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
714 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
719 <span class="tag">
715 <span class="tag">
720 This repo
716 This repo
721 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
717 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
722 </span>
718 </span>
723 ##</a>
719 ##</a>
724 </li>
720 </li>
725 % elif c.template_context['search_context']['repo_group_id']:
721 % elif c.template_context['search_context']['repo_group_id']:
726 <li class="searchTag searchTagFilter searchTagHidable">
722 <li class="searchTag searchTagFilter searchTagHidable">
727 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
723 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
728 <span class="tag">
724 <span class="tag">
729 This group
725 This group
730 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
726 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
731 </span>
727 </span>
732 ##</a>
728 ##</a>
733 </li>
729 </li>
734 % endif
730 % endif
735
731
736 <li class="searchTagInput">
732 <li class="searchTagInput">
737 <input class="main_filter_input" id="main_filter" size="25" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
733 <input class="main_filter_input" id="main_filter" size="25" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
738 </li>
734 </li>
739 <li class="searchTag searchTagHelp">
735 <li class="searchTag searchTagHelp">
740 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
736 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
741 </li>
737 </li>
742 </ul>
738 </ul>
743 </div>
739 </div>
744 </div>
740 </div>
745
741
746 <div id="main_filter_help" style="display: none">
742 <div id="main_filter_help" style="display: none">
747 - Use '/' key to quickly access this field.
743 - Use '/' key to quickly access this field.
748
744
749 - Enter a name of repository, or repository group for quick search.
745 - Enter a name of repository, or repository group for quick search.
750
746
751 - Prefix query to allow special search:
747 - Prefix query to allow special search:
752
748
753 user:admin, to search for usernames, always global
749 user:admin, to search for usernames, always global
754
750
755 user_group:devops, to search for user groups, always global
751 user_group:devops, to search for user groups, always global
756
752
757 commit:efced4, to search for commits, scoped to repositories or groups
753 commit:efced4, to search for commits, scoped to repositories or groups
758
754
759 file:models.py, to search for file paths, scoped to repositories or groups
755 file:models.py, to search for file paths, scoped to repositories or groups
760
756
761 % if c.template_context['search_context']['repo_id']:
757 % if c.template_context['search_context']['repo_id']:
762 For advanced full text search visit: <a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">repository search</a>
758 For advanced full text search visit: <a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">repository search</a>
763 % elif c.template_context['search_context']['repo_group_id']:
759 % elif c.template_context['search_context']['repo_group_id']:
764 For advanced full text search visit: <a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">repository group search</a>
760 For advanced full text search visit: <a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">repository group search</a>
765 % else:
761 % else:
766 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
762 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
767 % endif
763 % endif
768 </div>
764 </div>
769 </li>
765 </li>
770
766
771 ## ROOT MENU
767 ## ROOT MENU
772 <li class="${h.is_active('home', active)}">
768 <li class="${h.is_active('home', active)}">
773 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
769 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
774 <div class="menulabel">${_('Home')}</div>
770 <div class="menulabel">${_('Home')}</div>
775 </a>
771 </a>
776 </li>
772 </li>
777
773
778 %if c.rhodecode_user.username != h.DEFAULT_USER:
774 %if c.rhodecode_user.username != h.DEFAULT_USER:
779 <li class="${h.is_active('journal', active)}">
775 <li class="${h.is_active('journal', active)}">
780 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
776 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
781 <div class="menulabel">${_('Journal')}</div>
777 <div class="menulabel">${_('Journal')}</div>
782 </a>
778 </a>
783 </li>
779 </li>
784 %else:
780 %else:
785 <li class="${h.is_active('journal', active)}">
781 <li class="${h.is_active('journal', active)}">
786 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
782 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
787 <div class="menulabel">${_('Public journal')}</div>
783 <div class="menulabel">${_('Public journal')}</div>
788 </a>
784 </a>
789 </li>
785 </li>
790 %endif
786 %endif
791
787
792 <li class="${h.is_active('gists', active)}">
788 <li class="${h.is_active('gists', active)}">
793 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
789 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
794 <div class="menulabel">${_('Gists')}</div>
790 <div class="menulabel">${_('Gists')}</div>
795 </a>
791 </a>
796 </li>
792 </li>
797
793
798 % if c.is_super_admin or c.is_delegated_admin:
794 % if c.is_super_admin or c.is_delegated_admin:
799 <li class="${h.is_active('admin', active)}">
795 <li class="${h.is_active('admin', active)}">
800 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
796 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
801 <div class="menulabel">${_('Admin')} </div>
797 <div class="menulabel">${_('Admin')} </div>
802 </a>
798 </a>
803 </li>
799 </li>
804 % endif
800 % endif
805
801
806 ## render extra user menu
802 ## render extra user menu
807 ${usermenu(active=(active=='my_account'))}
803 ${usermenu(active=(active=='my_account'))}
808
804
809 </ul>
805 </ul>
810
806
811 <script type="text/javascript">
807 <script type="text/javascript">
812 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
808 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
813
809
814 var formatRepoResult = function(result, container, query, escapeMarkup) {
810 var formatRepoResult = function(result, container, query, escapeMarkup) {
815 return function(data, escapeMarkup) {
811 return function(data, escapeMarkup) {
816 if (!data.repo_id){
812 if (!data.repo_id){
817 return data.text; // optgroup text Repositories
813 return data.text; // optgroup text Repositories
818 }
814 }
819
815
820 var tmpl = '';
816 var tmpl = '';
821 var repoType = data['repo_type'];
817 var repoType = data['repo_type'];
822 var repoName = data['text'];
818 var repoName = data['text'];
823
819
824 if(data && data.type == 'repo'){
820 if(data && data.type == 'repo'){
825 if(repoType === 'hg'){
821 if(repoType === 'hg'){
826 tmpl += '<i class="icon-hg"></i> ';
822 tmpl += '<i class="icon-hg"></i> ';
827 }
823 }
828 else if(repoType === 'git'){
824 else if(repoType === 'git'){
829 tmpl += '<i class="icon-git"></i> ';
825 tmpl += '<i class="icon-git"></i> ';
830 }
826 }
831 else if(repoType === 'svn'){
827 else if(repoType === 'svn'){
832 tmpl += '<i class="icon-svn"></i> ';
828 tmpl += '<i class="icon-svn"></i> ';
833 }
829 }
834 if(data['private']){
830 if(data['private']){
835 tmpl += '<i class="icon-lock" ></i> ';
831 tmpl += '<i class="icon-lock" ></i> ';
836 }
832 }
837 else if(visualShowPublicIcon){
833 else if(visualShowPublicIcon){
838 tmpl += '<i class="icon-unlock-alt"></i> ';
834 tmpl += '<i class="icon-unlock-alt"></i> ';
839 }
835 }
840 }
836 }
841 tmpl += escapeMarkup(repoName);
837 tmpl += escapeMarkup(repoName);
842 return tmpl;
838 return tmpl;
843
839
844 }(result, escapeMarkup);
840 }(result, escapeMarkup);
845 };
841 };
846
842
847 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
843 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
848 return function(data, escapeMarkup) {
844 return function(data, escapeMarkup) {
849 if (!data.repo_group_id){
845 if (!data.repo_group_id){
850 return data.text; // optgroup text Repositories
846 return data.text; // optgroup text Repositories
851 }
847 }
852
848
853 var tmpl = '';
849 var tmpl = '';
854 var repoGroupName = data['text'];
850 var repoGroupName = data['text'];
855
851
856 if(data){
852 if(data){
857
853
858 tmpl += '<i class="icon-repo-group"></i> ';
854 tmpl += '<i class="icon-repo-group"></i> ';
859
855
860 }
856 }
861 tmpl += escapeMarkup(repoGroupName);
857 tmpl += escapeMarkup(repoGroupName);
862 return tmpl;
858 return tmpl;
863
859
864 }(result, escapeMarkup);
860 }(result, escapeMarkup);
865 };
861 };
866
862
867 var escapeRegExChars = function (value) {
863 var escapeRegExChars = function (value) {
868 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
864 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
869 };
865 };
870
866
871 var getRepoIcon = function(repo_type) {
867 var getRepoIcon = function(repo_type) {
872 if (repo_type === 'hg') {
868 if (repo_type === 'hg') {
873 return '<i class="icon-hg"></i> ';
869 return '<i class="icon-hg"></i> ';
874 }
870 }
875 else if (repo_type === 'git') {
871 else if (repo_type === 'git') {
876 return '<i class="icon-git"></i> ';
872 return '<i class="icon-git"></i> ';
877 }
873 }
878 else if (repo_type === 'svn') {
874 else if (repo_type === 'svn') {
879 return '<i class="icon-svn"></i> ';
875 return '<i class="icon-svn"></i> ';
880 }
876 }
881 return ''
877 return ''
882 };
878 };
883
879
884 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
880 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
885
881
886 if (value.split(':').length === 2) {
882 if (value.split(':').length === 2) {
887 value = value.split(':')[1]
883 value = value.split(':')[1]
888 }
884 }
889
885
890 var searchType = data['type'];
886 var searchType = data['type'];
891 var searchSubType = data['subtype'];
887 var searchSubType = data['subtype'];
892 var valueDisplay = data['value_display'];
888 var valueDisplay = data['value_display'];
893 var valueIcon = data['value_icon'];
889 var valueIcon = data['value_icon'];
894
890
895 var pattern = '(' + escapeRegExChars(value) + ')';
891 var pattern = '(' + escapeRegExChars(value) + ')';
896
892
897 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
893 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
898
894
899 // highlight match
895 // highlight match
900 if (searchType != 'text') {
896 if (searchType != 'text') {
901 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
897 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
902 }
898 }
903
899
904 var icon = '';
900 var icon = '';
905
901
906 if (searchType === 'hint') {
902 if (searchType === 'hint') {
907 icon += '<i class="icon-repo-group"></i> ';
903 icon += '<i class="icon-repo-group"></i> ';
908 }
904 }
909 // full text search/hints
905 // full text search/hints
910 else if (searchType === 'search') {
906 else if (searchType === 'search') {
911 if (valueIcon === undefined) {
907 if (valueIcon === undefined) {
912 icon += '<i class="icon-more"></i> ';
908 icon += '<i class="icon-more"></i> ';
913 } else {
909 } else {
914 icon += valueIcon + ' ';
910 icon += valueIcon + ' ';
915 }
911 }
916
912
917 if (searchSubType !== undefined && searchSubType == 'repo') {
913 if (searchSubType !== undefined && searchSubType == 'repo') {
918 valueDisplay += '<div class="pull-right tag">repository</div>';
914 valueDisplay += '<div class="pull-right tag">repository</div>';
919 }
915 }
920 else if (searchSubType !== undefined && searchSubType == 'repo_group') {
916 else if (searchSubType !== undefined && searchSubType == 'repo_group') {
921 valueDisplay += '<div class="pull-right tag">repo group</div>';
917 valueDisplay += '<div class="pull-right tag">repo group</div>';
922 }
918 }
923 }
919 }
924 // repository
920 // repository
925 else if (searchType === 'repo') {
921 else if (searchType === 'repo') {
926
922
927 var repoIcon = getRepoIcon(data['repo_type']);
923 var repoIcon = getRepoIcon(data['repo_type']);
928 icon += repoIcon;
924 icon += repoIcon;
929
925
930 if (data['private']) {
926 if (data['private']) {
931 icon += '<i class="icon-lock" ></i> ';
927 icon += '<i class="icon-lock" ></i> ';
932 }
928 }
933 else if (visualShowPublicIcon) {
929 else if (visualShowPublicIcon) {
934 icon += '<i class="icon-unlock-alt"></i> ';
930 icon += '<i class="icon-unlock-alt"></i> ';
935 }
931 }
936 }
932 }
937 // repository groups
933 // repository groups
938 else if (searchType === 'repo_group') {
934 else if (searchType === 'repo_group') {
939 icon += '<i class="icon-repo-group"></i> ';
935 icon += '<i class="icon-repo-group"></i> ';
940 }
936 }
941 // user group
937 // user group
942 else if (searchType === 'user_group') {
938 else if (searchType === 'user_group') {
943 icon += '<i class="icon-group"></i> ';
939 icon += '<i class="icon-group"></i> ';
944 }
940 }
945 // user
941 // user
946 else if (searchType === 'user') {
942 else if (searchType === 'user') {
947 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
943 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
948 }
944 }
949 // commit
945 // commit
950 else if (searchType === 'commit') {
946 else if (searchType === 'commit') {
951 var repo_data = data['repo_data'];
947 var repo_data = data['repo_data'];
952 var repoIcon = getRepoIcon(repo_data['repository_type']);
948 var repoIcon = getRepoIcon(repo_data['repository_type']);
953 if (repoIcon) {
949 if (repoIcon) {
954 icon += repoIcon;
950 icon += repoIcon;
955 } else {
951 } else {
956 icon += '<i class="icon-tag"></i>';
952 icon += '<i class="icon-tag"></i>';
957 }
953 }
958 }
954 }
959 // file
955 // file
960 else if (searchType === 'file') {
956 else if (searchType === 'file') {
961 var repo_data = data['repo_data'];
957 var repo_data = data['repo_data'];
962 var repoIcon = getRepoIcon(repo_data['repository_type']);
958 var repoIcon = getRepoIcon(repo_data['repository_type']);
963 if (repoIcon) {
959 if (repoIcon) {
964 icon += repoIcon;
960 icon += repoIcon;
965 } else {
961 } else {
966 icon += '<i class="icon-tag"></i>';
962 icon += '<i class="icon-tag"></i>';
967 }
963 }
968 }
964 }
969 // generic text
965 // generic text
970 else if (searchType === 'text') {
966 else if (searchType === 'text') {
971 icon = '';
967 icon = '';
972 }
968 }
973
969
974 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
970 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
975 return tmpl.format(icon, valueDisplay);
971 return tmpl.format(icon, valueDisplay);
976 };
972 };
977
973
978 var handleSelect = function(element, suggestion) {
974 var handleSelect = function(element, suggestion) {
979 if (suggestion.type === "hint") {
975 if (suggestion.type === "hint") {
980 // we skip action
976 // we skip action
981 $('#main_filter').focus();
977 $('#main_filter').focus();
982 }
978 }
983 else if (suggestion.type === "text") {
979 else if (suggestion.type === "text") {
984 // we skip action
980 // we skip action
985 $('#main_filter').focus();
981 $('#main_filter').focus();
986
982
987 } else {
983 } else {
988 window.location = suggestion['url'];
984 window.location = suggestion['url'];
989 }
985 }
990 };
986 };
991
987
992 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
988 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
993 if (queryLowerCase.split(':').length === 2) {
989 if (queryLowerCase.split(':').length === 2) {
994 queryLowerCase = queryLowerCase.split(':')[1]
990 queryLowerCase = queryLowerCase.split(':')[1]
995 }
991 }
996 if (suggestion.type === "text") {
992 if (suggestion.type === "text") {
997 // special case we don't want to "skip" display for
993 // special case we don't want to "skip" display for
998 return true
994 return true
999 }
995 }
1000 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
996 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
1001 };
997 };
1002
998
1003 var cleanContext = {
999 var cleanContext = {
1004 repo_view_type: null,
1000 repo_view_type: null,
1005
1001
1006 repo_id: null,
1002 repo_id: null,
1007 repo_name: "",
1003 repo_name: "",
1008
1004
1009 repo_group_id: null,
1005 repo_group_id: null,
1010 repo_group_name: null
1006 repo_group_name: null
1011 };
1007 };
1012 var removeGoToFilter = function () {
1008 var removeGoToFilter = function () {
1013 $('.searchTagHidable').hide();
1009 $('.searchTagHidable').hide();
1014 $('#main_filter').autocomplete(
1010 $('#main_filter').autocomplete(
1015 'setOptions', {params:{search_context: cleanContext}});
1011 'setOptions', {params:{search_context: cleanContext}});
1016 };
1012 };
1017
1013
1018 $('#main_filter').autocomplete({
1014 $('#main_filter').autocomplete({
1019 serviceUrl: pyroutes.url('goto_switcher_data'),
1015 serviceUrl: pyroutes.url('goto_switcher_data'),
1020 params: {
1016 params: {
1021 "search_context": templateContext.search_context
1017 "search_context": templateContext.search_context
1022 },
1018 },
1023 minChars:2,
1019 minChars:2,
1024 maxHeight:400,
1020 maxHeight:400,
1025 deferRequestBy: 300, //miliseconds
1021 deferRequestBy: 300, //miliseconds
1026 tabDisabled: true,
1022 tabDisabled: true,
1027 autoSelectFirst: false,
1023 autoSelectFirst: false,
1028 containerClass: 'autocomplete-qfilter-suggestions',
1024 containerClass: 'autocomplete-qfilter-suggestions',
1029 formatResult: autocompleteMainFilterFormatResult,
1025 formatResult: autocompleteMainFilterFormatResult,
1030 lookupFilter: autocompleteMainFilterResult,
1026 lookupFilter: autocompleteMainFilterResult,
1031 onSelect: function (element, suggestion) {
1027 onSelect: function (element, suggestion) {
1032 handleSelect(element, suggestion);
1028 handleSelect(element, suggestion);
1033 return false;
1029 return false;
1034 },
1030 },
1035 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
1031 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
1036 if (jqXHR !== 'abort') {
1032 if (jqXHR !== 'abort') {
1037 alert("Error during search.\nError code: {0}".format(textStatus));
1033 alert("Error during search.\nError code: {0}".format(textStatus));
1038 window.location = '';
1034 window.location = '';
1039 }
1035 }
1040 },
1036 },
1041 onSearchStart: function (params) {
1037 onSearchStart: function (params) {
1042 $('.searchTag.searchTagIcon').html('<i class="icon-spin animate-spin"></i>')
1038 $('.searchTag.searchTagIcon').html('<i class="icon-spin animate-spin"></i>')
1043 },
1039 },
1044 onSearchComplete: function (query, suggestions) {
1040 onSearchComplete: function (query, suggestions) {
1045 $('.searchTag.searchTagIcon').html('<i class="icon-search"></i>')
1041 $('.searchTag.searchTagIcon').html('<i class="icon-search"></i>')
1046 },
1042 },
1047 });
1043 });
1048
1044
1049 showMainFilterBox = function () {
1045 showMainFilterBox = function () {
1050 $('#main_filter_help').toggle();
1046 $('#main_filter_help').toggle();
1051 };
1047 };
1052
1048
1053 $('#main_filter').on('keydown.autocomplete', function (e) {
1049 $('#main_filter').on('keydown.autocomplete', function (e) {
1054
1050
1055 var BACKSPACE = 8;
1051 var BACKSPACE = 8;
1056 var el = $(e.currentTarget);
1052 var el = $(e.currentTarget);
1057 if(e.which === BACKSPACE){
1053 if(e.which === BACKSPACE){
1058 var inputVal = el.val();
1054 var inputVal = el.val();
1059 if (inputVal === ""){
1055 if (inputVal === ""){
1060 removeGoToFilter()
1056 removeGoToFilter()
1061 }
1057 }
1062 }
1058 }
1063 });
1059 });
1064
1060
1065 </script>
1061 </script>
1066 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
1062 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
1067 </%def>
1063 </%def>
1068
1064
1069 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
1065 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
1070 <div class="modal-dialog">
1066 <div class="modal-dialog">
1071 <div class="modal-content">
1067 <div class="modal-content">
1072 <div class="modal-header">
1068 <div class="modal-header">
1073 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
1069 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
1074 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
1070 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
1075 </div>
1071 </div>
1076 <div class="modal-body">
1072 <div class="modal-body">
1077 <div class="block-left">
1073 <div class="block-left">
1078 <table class="keyboard-mappings">
1074 <table class="keyboard-mappings">
1079 <tbody>
1075 <tbody>
1080 <tr>
1076 <tr>
1081 <th></th>
1077 <th></th>
1082 <th>${_('Site-wide shortcuts')}</th>
1078 <th>${_('Site-wide shortcuts')}</th>
1083 </tr>
1079 </tr>
1084 <%
1080 <%
1085 elems = [
1081 elems = [
1086 ('/', 'Use quick search box'),
1082 ('/', 'Use quick search box'),
1087 ('g h', 'Goto home page'),
1083 ('g h', 'Goto home page'),
1088 ('g g', 'Goto my private gists page'),
1084 ('g g', 'Goto my private gists page'),
1089 ('g G', 'Goto my public gists page'),
1085 ('g G', 'Goto my public gists page'),
1090 ('g 0-9', 'Goto bookmarked items from 0-9'),
1086 ('g 0-9', 'Goto bookmarked items from 0-9'),
1091 ('n r', 'New repository page'),
1087 ('n r', 'New repository page'),
1092 ('n g', 'New gist page'),
1088 ('n g', 'New gist page'),
1093 ]
1089 ]
1094 %>
1090 %>
1095 %for key, desc in elems:
1091 %for key, desc in elems:
1096 <tr>
1092 <tr>
1097 <td class="keys">
1093 <td class="keys">
1098 <span class="key tag">${key}</span>
1094 <span class="key tag">${key}</span>
1099 </td>
1095 </td>
1100 <td>${desc}</td>
1096 <td>${desc}</td>
1101 </tr>
1097 </tr>
1102 %endfor
1098 %endfor
1103 </tbody>
1099 </tbody>
1104 </table>
1100 </table>
1105 </div>
1101 </div>
1106 <div class="block-left">
1102 <div class="block-left">
1107 <table class="keyboard-mappings">
1103 <table class="keyboard-mappings">
1108 <tbody>
1104 <tbody>
1109 <tr>
1105 <tr>
1110 <th></th>
1106 <th></th>
1111 <th>${_('Repositories')}</th>
1107 <th>${_('Repositories')}</th>
1112 </tr>
1108 </tr>
1113 <%
1109 <%
1114 elems = [
1110 elems = [
1115 ('g s', 'Goto summary page'),
1111 ('g s', 'Goto summary page'),
1116 ('g c', 'Goto changelog page'),
1112 ('g c', 'Goto changelog page'),
1117 ('g f', 'Goto files page'),
1113 ('g f', 'Goto files page'),
1118 ('g F', 'Goto files page with file search activated'),
1114 ('g F', 'Goto files page with file search activated'),
1119 ('g p', 'Goto pull requests page'),
1115 ('g p', 'Goto pull requests page'),
1120 ('g o', 'Goto repository settings'),
1116 ('g o', 'Goto repository settings'),
1121 ('g O', 'Goto repository access permissions settings'),
1117 ('g O', 'Goto repository access permissions settings'),
1122 ]
1118 ]
1123 %>
1119 %>
1124 %for key, desc in elems:
1120 %for key, desc in elems:
1125 <tr>
1121 <tr>
1126 <td class="keys">
1122 <td class="keys">
1127 <span class="key tag">${key}</span>
1123 <span class="key tag">${key}</span>
1128 </td>
1124 </td>
1129 <td>${desc}</td>
1125 <td>${desc}</td>
1130 </tr>
1126 </tr>
1131 %endfor
1127 %endfor
1132 </tbody>
1128 </tbody>
1133 </table>
1129 </table>
1134 </div>
1130 </div>
1135 </div>
1131 </div>
1136 <div class="modal-footer">
1132 <div class="modal-footer">
1137 </div>
1133 </div>
1138 </div><!-- /.modal-content -->
1134 </div><!-- /.modal-content -->
1139 </div><!-- /.modal-dialog -->
1135 </div><!-- /.modal-dialog -->
1140 </div><!-- /.modal -->
1136 </div><!-- /.modal -->
General Comments 0
You need to be logged in to leave comments. Login now