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