##// END OF EJS Templates
show link to usergroups if we have a create usergroup permission
marcink -
r3790:1aee8b0c beta
parent child Browse files
Show More
@@ -1,340 +1,341 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="root.html"/>
3 3
4 4 <!-- HEADER -->
5 5 <div id="header-dd"></div>
6 6 <div id="header">
7 7 <div id="header-inner" class="title">
8 8 <div id="logo">
9 9 <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1>
10 10 </div>
11 11 <!-- MENU -->
12 12 ${self.page_nav()}
13 13 <!-- END MENU -->
14 14 ${self.body()}
15 15 </div>
16 16 </div>
17 17 <!-- END HEADER -->
18 18
19 19 <!-- CONTENT -->
20 20 <div id="content">
21 21 <div class="flash_msg">
22 22 <% messages = h.flash.pop_messages() %>
23 23 % if messages:
24 24 <ul id="flash-messages">
25 25 % for message in messages:
26 26 <li class="${message.category}_msg">${message}</li>
27 27 % endfor
28 28 </ul>
29 29 % endif
30 30 </div>
31 31 <div id="main">
32 32 ${next.main()}
33 33 </div>
34 34 </div>
35 35 <!-- END CONTENT -->
36 36
37 37 <!-- FOOTER -->
38 38 <div id="footer">
39 39 <div id="footer-inner" class="title">
40 40 <div>
41 41 <p class="footer-link">
42 42 ${_('Server instance: %s') % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}
43 43 </p>
44 44 <p class="footer-link-right">
45 45 <a href="${h.url('rhodecode_official')}">RhodeCode ${c.rhodecode_version}</a>
46 46 &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski and others
47 47 &ndash; <a href="${h.url('bugtracker')}">${_('Report a bug')}</a>
48 48 </p>
49 49 </div>
50 50 </div>
51 51 </div>
52 52
53 53 <!-- END FOOTER -->
54 54
55 55 ### MAKO DEFS ###
56 56 <%def name="breadcrumbs()">
57 57 <div class="breadcrumbs">
58 58 ${self.breadcrumbs_links()}
59 59 </div>
60 60 </%def>
61 61
62 62 <%def name="context_bar(current)">
63 63 ${repo_context_bar(current)}
64 64 </%def>
65 65
66 66 <%def name="admin_menu()">
67 67 <ul class="admin_menu">
68 68 <li>${h.link_to(_('Admin journal'),h.url('admin_home'),class_='journal ')}</li>
69 69 <li>${h.link_to(_('Repositories'),h.url('repos'),class_='repos')}</li>
70 70 <li>${h.link_to(_('Repository groups'),h.url('repos_groups'),class_='repos_groups')}</li>
71 71 <li>${h.link_to(_('Users'),h.url('users'),class_='users')}</li>
72 72 <li>${h.link_to(_('User groups'),h.url('users_groups'),class_='groups')}</li>
73 73 <li>${h.link_to(_('Permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
74 74 <li>${h.link_to(_('LDAP'),h.url('ldap_home'),class_='ldap')}</li>
75 75 <li>${h.link_to(_('Defaults'),h.url('defaults'),class_='defaults')}</li>
76 76 <li class="last">${h.link_to(_('Settings'),h.url('admin_settings'),class_='settings')}</li>
77 77 </ul>
78 78 </%def>
79 79
80 80 <%def name="admin_menu_simple(repository_groups=None, user_groups=None)">
81 81 <ul>
82 82 %if repository_groups:
83 83 <li>${h.link_to(_('Repository groups'),h.url('repos_groups'),class_='repos_groups')}</li>
84 84 %endif:
85 85 %if user_groups:
86 86 <li>${h.link_to(_('User groups'),h.url('users_groups'),class_='groups')}</li>
87 87 %endif
88 88 </ul>
89 89 </%def>
90 90
91 91 <%def name="repo_context_bar(current=None)">
92 92 <%
93 93 def follow_class():
94 94 if c.repository_following:
95 95 return h.literal('following')
96 96 else:
97 97 return h.literal('follow')
98 98 %>
99 99 <%
100 100 def is_current(selected):
101 101 if selected == current:
102 102 return h.literal('class="current"')
103 103 %>
104 104
105 105 <!--- CONTEXT BAR -->
106 106 <div id="context-bar" class="box">
107 107 <div id="breadcrumbs">
108 108 ${h.link_to(_(u'Repositories'),h.url('home'))}
109 109 &raquo;
110 110 ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)}
111 111 </div>
112 112 <ul id="context-pages" class="horizontal-list">
113 113 <li ${is_current('summary')}><a href="${h.url('summary_home', repo_name=c.repo_name)}" class="summary">${_('Summary')}</a></li>
114 114 <li ${is_current('changelog')}><a href="${h.url('changelog_home', repo_name=c.repo_name)}" class="changelogs">${_('Changelog')}</a></li>
115 115 <li ${is_current('files')}><a href="${h.url('files_home', repo_name=c.repo_name)}" class="files"></span>${_('Files')}</a></li>
116 116 <li ${is_current('switch-to')}>
117 117 <a href="#" id="branch_tag_switcher_2" class="dropdown switch-to"></span>${_('Switch To')}</a>
118 118 <ul id="switch_to_list_2" class="switch_to submenu">
119 119 <li><a href="#">${_('loading...')}</a></li>
120 120 </ul>
121 121 </li>
122 122 <li ${is_current('options')}>
123 123 <a href="#" class="dropdown options"></span>${_('Options')}</a>
124 124 <ul>
125 125 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
126 126 <li>${h.link_to(_('Settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
127 127 %endif
128 128 %if c.rhodecode_db_repo.fork:
129 129 <li>${h.link_to(_('Compare fork'),h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type='branch',org_ref='default',other_repo=c.repo_name,other_ref_type='branch',other_ref=request.GET.get('branch') or 'default', merge=1),class_='compare_request')}</li>
130 130 %endif
131 131 <li>${h.link_to(_('Search'),h.url('search_repo',repo_name=c.repo_name),class_='search')}</li>
132 132
133 133 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
134 134 %if c.rhodecode_db_repo.locked[0]:
135 135 <li>${h.link_to(_('Unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li>
136 136 %else:
137 137 <li>${h.link_to(_('Lock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_add')}</li>
138 138 %endif
139 139 %endif
140 140 ## TODO: this check feels wrong, it would be better to have a check for permissions
141 141 ## also it feels like a job for the controller
142 142 %if c.rhodecode_user.username != 'default':
143 143 <li>
144 144 <a class="${follow_class()}" onclick="javascript:toggleFollowingRepo(this,${c.rhodecode_db_repo.repo_id},'${str(h.get_token())}');">
145 145 <span class="show-follow">${_('Follow')}</span>
146 146 <span class="show-following">${_('Unfollow')}</span>
147 147 </a>
148 148 </li>
149 149 <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}" class="fork">${_('Fork')}</a></li>
150 150 %if h.is_hg(c.rhodecode_repo):
151 151 <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="pull-request">${_('Create Pull Request')}</a></li>
152 152 %endif
153 153 %endif
154 154 </ul>
155 155 </li>
156 156 <li ${is_current('showpullrequest')}>
157 157 <a href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests')}" class="pull-request">${_('Pull Requests')}
158 158 %if c.repository_pull_requests:
159 159 <span>${c.repository_pull_requests}</span>
160 160 %endif
161 161 </a>
162 162 </li>
163 163 </ul>
164 164 </div>
165 165 <script type="text/javascript">
166 166 YUE.on('branch_tag_switcher_2','mouseover',function(){
167 167 var loaded = YUD.hasClass('branch_tag_switcher_2','loaded');
168 168 if(!loaded){
169 169 YUD.addClass('branch_tag_switcher_2','loaded');
170 170 ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list_2',
171 171 function(o){},
172 172 function(o){YUD.removeClass('branch_tag_switcher_2','loaded');}
173 173 ,null);
174 174 }
175 175 return false;
176 176 });
177 177 </script>
178 178 <!--- END CONTEXT BAR -->
179 179 </%def>
180 180
181 181 <%def name="usermenu()">
182 182 ## USER MENU
183 183 <li>
184 184 <a class="menu_link childs" id="quick_login_link">
185 185 <span class="icon">
186 186 <img src="${h.gravatar_url(c.rhodecode_user.email,20)}" alt="avatar">
187 187 </span>
188 188 %if c.rhodecode_user.username != 'default':
189 189 <span class="menu_link_user">${c.rhodecode_user.username}</span>
190 190 %if c.unread_notifications != 0:
191 191 <span class="menu_link_notifications">${c.unread_notifications}</span>
192 192 %endif
193 193 %else:
194 194 <span>${_('Not logged in')}</span>
195 195 %endif
196 196 </a>
197 197
198 198 <div class="user-menu">
199 199 <div id="quick_login">
200 200 %if c.rhodecode_user.username == 'default':
201 201 <h4>${_('Login to your account')}</h4>
202 202 ${h.form(h.url('login_home',came_from=h.url.current()))}
203 203 <div class="form">
204 204 <div class="fields">
205 205 <div class="field">
206 206 <div class="label">
207 207 <label for="username">${_('Username')}:</label>
208 208 </div>
209 209 <div class="input">
210 210 ${h.text('username',class_='focus')}
211 211 </div>
212 212
213 213 </div>
214 214 <div class="field">
215 215 <div class="label">
216 216 <label for="password">${_('Password')}:</label>
217 217 </div>
218 218 <div class="input">
219 219 ${h.password('password',class_='focus')}
220 220 </div>
221 221
222 222 </div>
223 223 <div class="buttons">
224 224 <div class="password_forgoten">${h.link_to(_('Forgot password ?'),h.url('reset_password'))}</div>
225 225 <div class="register">
226 226 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
227 227 ${h.link_to(_("Don't have an account ?"),h.url('register'))}
228 228 %endif
229 229 </div>
230 230 <div class="submit">
231 231 ${h.submit('sign_in',_('Log In'),class_="ui-btn xsmall")}
232 232 </div>
233 233 </div>
234 234 </div>
235 235 </div>
236 236 ${h.end_form()}
237 237 %else:
238 238 <div class="links_left">
239 239 <div class="big_gravatar"><img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,48)}" /></div>
240 240 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
241 241 <div class="email">${c.rhodecode_user.email}</div>
242 242 </div>
243 243 <div class="links_right">
244 244 <ol class="links">
245 245 <li><a href="${h.url('notifications')}">${_('Notifications')}: ${c.unread_notifications}</a></li>
246 246 <li>${h.link_to(_(u'My account'),h.url('admin_settings_my_account'))}</li>
247 247 <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li>
248 248 </ol>
249 249 </div>
250 250 %endif
251 251 </div>
252 252 </div>
253 253
254 254 </li>
255 255 </%def>
256 256
257 257 <%def name="menu(current=None)">
258 258 <%
259 259 def is_current(selected):
260 260 if selected == current:
261 261 return h.literal('class="current"')
262 262 %>
263 263 <ul id="quick" class="horizontal-list">
264 264 <!-- repo switcher -->
265 265 <li ${is_current('repositories')}>
266 266 <a class="menu_link repo_switcher childs" id="repo_switcher" title="${_('Switch repository')}" href="${h.url('home')}">
267 267 ${_('Repositories')}
268 268 </a>
269 269 <ul id="repo_switcher_list" class="repo_switcher">
270 270 <li>
271 271 <a href="#">${_('loading...')}</a>
272 272 </li>
273 273 </ul>
274 274 </li>
275 275 ##ROOT MENU
276 276 %if c.rhodecode_user.username != 'default':
277 277 <li ${is_current('journal')}>
278 278 <a class="menu_link journal" title="${_('Show recent activity')}" href="${h.url('journal')}">
279 279 ${_('Journal')}
280 280 </a>
281 281 </li>
282 282 %else:
283 283 <li ${is_current('journal')}>
284 284 <a class="menu_link journal" title="${_('Public journal')}" href="${h.url('public_journal')}">
285 285 ${_('Public journal')}
286 286 </a>
287 287 </li>
288 288 %endif
289 289 <li ${is_current('search')}>
290 290 <a class="menu_link search" title="${_('Search in repositories')}" href="${h.url('search')}">
291 291 ${_('Search')}
292 292 </a>
293 293 </li>
294 294 % if h.HasPermissionAll('hg.admin')('access admin main page'):
295 295 <li ${is_current('admin')}>
296 296 <a class="menu_link admin childs" title="${_('Admin')}" href="${h.url('admin_home')}">
297 297 ${_('Admin')}
298 298 </a>
299 299 ${admin_menu()}
300 300 </li>
301 301 % elif c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
302 302 <li ${is_current('admin')}>
303 303 <a class="menu_link admin childs" title="${_('Admin')}">
304 304 ${_('Admin')}
305 305 </a>
306 ${admin_menu_simple(c.rhodecode_user.repository_groups_admin, c.rhodecode_user.user_groups_admin)}
306 ${admin_menu_simple(c.rhodecode_user.repository_groups_admin,
307 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
307 308 </li>
308 309 % endif
309 310 ${usermenu()}
310 311 <script type="text/javascript">
311 312 YUE.on('repo_switcher','mouseover',function(){
312 313 var target = 'q_filter_rs';
313 314 var qfilter_activate = function(){
314 315 var nodes = YUQ('ul#repo_switcher_list li a.repo_name');
315 316 var func = function(node){
316 317 return node.parentNode;
317 318 }
318 319 q_filter(target,nodes,func);
319 320 }
320 321
321 322 var loaded = YUD.hasClass('repo_switcher','loaded');
322 323 if(!loaded){
323 324 YUD.addClass('repo_switcher','loaded');
324 325 ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
325 326 function(o){qfilter_activate();YUD.get(target).focus()},
326 327 function(o){YUD.removeClass('repo_switcher','loaded');}
327 328 ,null);
328 329 }else{
329 330 YUD.get(target).focus();
330 331 }
331 332 return false;
332 333 });
333 334
334 335 YUE.on('header-dd', 'click',function(e){
335 336 YUD.addClass('header-inner', 'hover');
336 337 YUD.addClass('content', 'hover');
337 338 });
338 339
339 340 </script>
340 341 </%def>
General Comments 0
You need to be logged in to leave comments. Login now