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