Show More
@@ -1,652 +1,652 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="root.html"/> |
|
3 | 3 | |
|
4 | 4 | <div class="outerwrapper"> |
|
5 | 5 | <!-- HEADER --> |
|
6 | 6 | <div class="header"> |
|
7 | 7 | <div id="header-inner" class="wrapper"> |
|
8 | 8 | <div id="logo"> |
|
9 | 9 | <div class="logo-wrapper"> |
|
10 | 10 | <a href="${h.url('home')}"><img src="${h.url('/images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a> |
|
11 | 11 | </div> |
|
12 | 12 | %if c.rhodecode_name: |
|
13 | 13 | <div class="branding">- ${h.branding(c.rhodecode_name)}</div> |
|
14 | 14 | %endif |
|
15 | 15 | </div> |
|
16 | 16 | <!-- MENU BAR NAV --> |
|
17 | 17 | ${self.menu_bar_nav()} |
|
18 | 18 | <!-- END MENU BAR NAV --> |
|
19 | 19 | ${self.body()} |
|
20 | 20 | </div> |
|
21 | 21 | </div> |
|
22 | 22 | ${self.menu_bar_subnav()} |
|
23 | 23 | <!-- END HEADER --> |
|
24 | 24 | |
|
25 | 25 | <!-- CONTENT --> |
|
26 | 26 | <div id="content" class="wrapper"> |
|
27 | 27 | ${self.flash_msg()} |
|
28 | 28 | <div class="main"> |
|
29 | 29 | ${next.main()} |
|
30 | 30 | </div> |
|
31 | 31 | </div> |
|
32 | 32 | <!-- END CONTENT --> |
|
33 | 33 | |
|
34 | 34 | </div> |
|
35 | 35 | <!-- FOOTER --> |
|
36 | 36 | <div id="footer"> |
|
37 | 37 | <div id="footer-inner" class="title wrapper"> |
|
38 | 38 | <div> |
|
39 | 39 | <p class="footer-link-right"> |
|
40 | 40 | % if c.visual.show_version: |
|
41 | 41 | RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition} |
|
42 | 42 | % endif |
|
43 | 43 | © 2010-${h.datetime.today().year}, <a href="${h.url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved. |
|
44 | 44 | % if c.visual.rhodecode_support_url: |
|
45 | 45 | <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a> |
|
46 | 46 | % endif |
|
47 | 47 | </p> |
|
48 | 48 | <% sid = 'block' if request.GET.get('showrcid') else 'none' %> |
|
49 | 49 | <p class="server-instance" style="display:${sid}"> |
|
50 | 50 | ## display hidden instance ID if specially defined |
|
51 | 51 | % if c.rhodecode_instanceid: |
|
52 | 52 | ${_('RhodeCode instance id: %s') % c.rhodecode_instanceid} |
|
53 | 53 | % endif |
|
54 | 54 | </p> |
|
55 | 55 | </div> |
|
56 | 56 | </div> |
|
57 | 57 | </div> |
|
58 | 58 | |
|
59 | 59 | <!-- END FOOTER --> |
|
60 | 60 | |
|
61 | 61 | ### MAKO DEFS ### |
|
62 | 62 | |
|
63 | 63 | <%def name="menu_bar_subnav()"> |
|
64 | 64 | </%def> |
|
65 | 65 | |
|
66 | 66 | <%def name="flash_msg()"> |
|
67 | 67 | <%include file="/base/flash_msg.html"/> |
|
68 | 68 | </%def> |
|
69 | 69 | |
|
70 | 70 | <%def name="breadcrumbs(class_='breadcrumbs')"> |
|
71 | 71 | <div class="${class_}"> |
|
72 | 72 | ${self.breadcrumbs_links()} |
|
73 | 73 | </div> |
|
74 | 74 | </%def> |
|
75 | 75 | |
|
76 | 76 | <%def name="admin_menu()"> |
|
77 | 77 | <ul class="admin_menu submenu"> |
|
78 | 78 | <li><a href="${h.url('admin_home')}">${_('Admin journal')}</a></li> |
|
79 | 79 | <li><a href="${h.url('repos')}">${_('Repositories')}</a></li> |
|
80 | 80 | <li><a href="${h.url('repo_groups')}">${_('Repository groups')}</a></li> |
|
81 | 81 | <li><a href="${h.url('users')}">${_('Users')}</a></li> |
|
82 | 82 | <li><a href="${h.url('users_groups')}">${_('User groups')}</a></li> |
|
83 | 83 | <li><a href="${h.url('admin_permissions_application')}">${_('Permissions')}</a></li> |
|
84 | 84 | <li><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li> |
|
85 | 85 | <li><a href="${h.url('admin_defaults_repositories')}">${_('Defaults')}</a></li> |
|
86 | 86 | <li class="last"><a href="${h.url('admin_settings')}">${_('Settings')}</a></li> |
|
87 | 87 | </ul> |
|
88 | 88 | </%def> |
|
89 | 89 | |
|
90 | 90 | |
|
91 | 91 | <%def name="dt_info_panel(elements)"> |
|
92 | 92 | <dl class="dl-horizontal"> |
|
93 | 93 | %for dt, dd, title, show_items in elements: |
|
94 | 94 | <dt>${dt}:</dt> |
|
95 | 95 | <dd title="${title}"> |
|
96 | 96 | %if callable(dd): |
|
97 | 97 | ## allow lazy evaluation of elements |
|
98 | 98 | ${dd()} |
|
99 | 99 | %else: |
|
100 | 100 | ${dd} |
|
101 | 101 | %endif |
|
102 | 102 | %if show_items: |
|
103 | 103 | <span class="btn-collapse" data-toggle="item-${h.md5(dt)[:6]}-details">${_('Show More')} </span> |
|
104 | 104 | %endif |
|
105 | 105 | </dd> |
|
106 | 106 | |
|
107 | 107 | %if show_items: |
|
108 | 108 | <div class="collapsable-content" data-toggle="item-${h.md5(dt)[:6]}-details" style="display: none"> |
|
109 | 109 | %for item in show_items: |
|
110 | 110 | <dt></dt> |
|
111 | 111 | <dd>${item}</dd> |
|
112 | 112 | %endfor |
|
113 | 113 | </div> |
|
114 | 114 | %endif |
|
115 | 115 | |
|
116 | 116 | %endfor |
|
117 | 117 | </dl> |
|
118 | 118 | </%def> |
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | <%def name="gravatar(email, size=16)"> |
|
122 | 122 | <% |
|
123 | 123 | if (size > 16): |
|
124 | 124 | gravatar_class = 'gravatar gravatar-large' |
|
125 | 125 | else: |
|
126 | 126 | gravatar_class = 'gravatar' |
|
127 | 127 | %> |
|
128 | 128 | <%doc> |
|
129 | 129 | TODO: johbo: For now we serve double size images to make it smooth |
|
130 | 130 | for retina. This is how it worked until now. Should be replaced |
|
131 | 131 | with a better solution at some point. |
|
132 | 132 | </%doc> |
|
133 | 133 | <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}"> |
|
134 | 134 | </%def> |
|
135 | 135 | |
|
136 | 136 | |
|
137 | 137 | <%def name="gravatar_with_user(contact, size=16)"> |
|
138 | 138 | <div class="rc-user tooltip" title="${contact}"> |
|
139 | 139 | ${self.gravatar(h.email_or_none(contact), size)} |
|
140 | 140 | <span class="user"> ${h.link_to_user(contact)}</span> |
|
141 | 141 | </div> |
|
142 | 142 | </%def> |
|
143 | 143 | |
|
144 | 144 | |
|
145 | 145 | ## admin menu used for people that have some admin resources |
|
146 | 146 | <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)"> |
|
147 | 147 | <ul class="submenu"> |
|
148 | 148 | %if repositories: |
|
149 | 149 | <li><a href="${h.url('repos')}">${_('Repositories')}</a></li> |
|
150 | 150 | %endif |
|
151 | 151 | %if repository_groups: |
|
152 | 152 | <li><a href="${h.url('repo_groups')}">${_('Repository groups')}</a></li> |
|
153 | 153 | %endif |
|
154 | 154 | %if user_groups: |
|
155 | 155 | <li><a href="${h.url('users_groups')}">${_('User groups')}</a></li> |
|
156 | 156 | %endif |
|
157 | 157 | </ul> |
|
158 | 158 | </%def> |
|
159 | 159 | |
|
160 | 160 | <%def name="repo_page_title(repo_instance)"> |
|
161 | 161 | <div class="title-content"> |
|
162 | 162 | <div class="title-main"> |
|
163 | 163 | ## SVN/HG/GIT icons |
|
164 | 164 | %if h.is_hg(repo_instance): |
|
165 | 165 | <i class="icon-hg"></i> |
|
166 | 166 | %endif |
|
167 | 167 | %if h.is_git(repo_instance): |
|
168 | 168 | <i class="icon-git"></i> |
|
169 | 169 | %endif |
|
170 | 170 | %if h.is_svn(repo_instance): |
|
171 | 171 | <i class="icon-svn"></i> |
|
172 | 172 | %endif |
|
173 | 173 | |
|
174 | 174 | ## public/private |
|
175 | 175 | %if repo_instance.private: |
|
176 | 176 | <i class="icon-repo-private"></i> |
|
177 | 177 | %else: |
|
178 | 178 | <i class="icon-repo-public"></i> |
|
179 | 179 | %endif |
|
180 | 180 | |
|
181 | 181 | ## repo name with group name |
|
182 | 182 | ${h.breadcrumb_repo_link(c.rhodecode_db_repo)} |
|
183 | 183 | |
|
184 | 184 | </div> |
|
185 | 185 | |
|
186 | 186 | ## FORKED |
|
187 | 187 | %if repo_instance.fork: |
|
188 | 188 | <p> |
|
189 | 189 | <i class="icon-code-fork"></i> ${_('Fork of')} |
|
190 | 190 | <a href="${h.url('summary_home',repo_name=repo_instance.fork.repo_name)}">${repo_instance.fork.repo_name}</a> |
|
191 | 191 | </p> |
|
192 | 192 | %endif |
|
193 | 193 | |
|
194 | 194 | ## IMPORTED FROM REMOTE |
|
195 | 195 | %if repo_instance.clone_uri: |
|
196 | 196 | <p> |
|
197 | 197 | <i class="icon-code-fork"></i> ${_('Clone from')} |
|
198 | 198 | <a href="${h.url(str(h.hide_credentials(repo_instance.clone_uri)))}">${h.hide_credentials(repo_instance.clone_uri)}</a> |
|
199 | 199 | </p> |
|
200 | 200 | %endif |
|
201 | 201 | |
|
202 | 202 | ## LOCKING STATUS |
|
203 | 203 | %if repo_instance.locked[0]: |
|
204 | 204 | <p class="locking_locked"> |
|
205 | 205 | <i class="icon-repo-lock"></i> |
|
206 | 206 | ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}} |
|
207 | 207 | </p> |
|
208 | 208 | %elif repo_instance.enable_locking: |
|
209 | 209 | <p class="locking_unlocked"> |
|
210 | 210 | <i class="icon-repo-unlock"></i> |
|
211 | 211 | ${_('Repository not locked. Pull repository to lock it.')} |
|
212 | 212 | </p> |
|
213 | 213 | %endif |
|
214 | 214 | |
|
215 | 215 | </div> |
|
216 | 216 | </%def> |
|
217 | 217 | |
|
218 | 218 | <%def name="repo_menu(active=None)"> |
|
219 | 219 | <% |
|
220 | 220 | def is_active(selected): |
|
221 | 221 | if selected == active: |
|
222 | 222 | return "active" |
|
223 | 223 | %> |
|
224 | 224 | |
|
225 | 225 | <!--- CONTEXT BAR --> |
|
226 | 226 | <div id="context-bar"> |
|
227 | 227 | <div class="wrapper"> |
|
228 | 228 | <ul id="context-pages" class="horizontal-list navigation"> |
|
229 | 229 | <li class="${is_active('summary')}"><a class="menulink" href="${h.url('summary_home', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li> |
|
230 | 230 | <li class="${is_active('changelog')}"><a class="menulink" href="${h.url('changelog_home', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li> |
|
231 | 231 | <li class="${is_active('files')}"><a class="menulink" href="${h.url('files_home', repo_name=c.repo_name, revision=c.rhodecode_db_repo.landing_rev[1])}"><div class="menulabel">${_('Files')}</div></a></li> |
|
232 | 232 | <li class="${is_active('compare')}"> |
|
233 | 233 | <a class="menulink" href="${h.url('compare_home',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a> |
|
234 | 234 | </li> |
|
235 | 235 | ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()" |
|
236 | 236 | %if c.rhodecode_db_repo.repo_type in ['git','hg']: |
|
237 | 237 | <li class="${is_active('showpullrequest')}"> |
|
238 | 238 | <a class="menulink" href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests for %s') % c.repo_name}"> |
|
239 | 239 | %if c.repository_pull_requests: |
|
240 | 240 | <span class="pr_notifications">${c.repository_pull_requests}</span> |
|
241 | 241 | %endif |
|
242 | 242 | <div class="menulabel">${_('Pull Requests')}</div> |
|
243 | 243 | </a> |
|
244 | 244 | </li> |
|
245 | 245 | %endif |
|
246 | 246 | <li class="${is_active('options')}"> |
|
247 | 247 | <a class="menulink" href="#" class="dropdown"><div class="menulabel">${_('Options')} <div class="show_more"></div></div></a> |
|
248 | 248 | <ul class="submenu"> |
|
249 | 249 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
250 | 250 | <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}">${_('Settings')}</a></li> |
|
251 | 251 | %endif |
|
252 | 252 | %if c.rhodecode_db_repo.fork: |
|
253 | 253 | <li><a href="${h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,source_ref_type=c.rhodecode_db_repo.landing_rev[0],source_ref=c.rhodecode_db_repo.landing_rev[1], target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1], merge=1)}"> |
|
254 | 254 | ${_('Compare fork')}</a></li> |
|
255 | 255 | %endif |
|
256 | 256 | |
|
257 | 257 | <li><a href="${h.url('search_repo_home',repo_name=c.repo_name)}">${_('Search')}</a></li> |
|
258 | 258 | |
|
259 | 259 | %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: |
|
260 | 260 | %if c.rhodecode_db_repo.locked[0]: |
|
261 | 261 | <li><a class="locking_del" href="${h.url('toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li> |
|
262 | 262 | %else: |
|
263 | 263 | <li><a class="locking_add" href="${h.url('toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li> |
|
264 | 264 | %endif |
|
265 | 265 | %endif |
|
266 | 266 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
267 | 267 | %if c.rhodecode_db_repo.repo_type in ['git','hg']: |
|
268 | 268 | <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}">${_('Fork')}</a></li> |
|
269 | 269 | <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li> |
|
270 | 270 | %endif |
|
271 | 271 | %endif |
|
272 | 272 | </ul> |
|
273 | 273 | </li> |
|
274 | 274 | </ul> |
|
275 | 275 | </div> |
|
276 | 276 | <div class="clear"></div> |
|
277 | 277 | </div> |
|
278 | 278 | <!--- END CONTEXT BAR --> |
|
279 | 279 | |
|
280 | 280 | </%def> |
|
281 | 281 | |
|
282 | 282 | <%def name="usermenu()"> |
|
283 | 283 | ## USER MENU |
|
284 | 284 | <li id="quick_login_li"> |
|
285 | 285 | <a id="quick_login_link" class="menulink childs"> |
|
286 | 286 | ${gravatar(c.rhodecode_user.email, 20)} |
|
287 | 287 | <span class="user"> |
|
288 | 288 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
289 | 289 | <span class="menu_link_user">${c.rhodecode_user.username}</span><div class="show_more"></div> |
|
290 | 290 | %else: |
|
291 | 291 | <span>${_('Sign in')}</span> |
|
292 | 292 | %endif |
|
293 | 293 | </span> |
|
294 | 294 | </a> |
|
295 | 295 | |
|
296 | 296 | <div class="user-menu submenu"> |
|
297 | 297 | <div id="quick_login"> |
|
298 | 298 | %if c.rhodecode_user.username == h.DEFAULT_USER: |
|
299 | 299 | <h4>${_('Sign in to your account')}</h4> |
|
300 |
${h.form(h. |
|
|
300 | ${h.form(h.route_path('login', _query={'came_from': h.url.current()}), needs_csrf_token=False)} | |
|
301 | 301 | <div class="form form-vertical"> |
|
302 | 302 | <div class="fields"> |
|
303 | 303 | <div class="field"> |
|
304 | 304 | <div class="label"> |
|
305 | 305 | <label for="username">${_('Username')}:</label> |
|
306 | 306 | </div> |
|
307 | 307 | <div class="input"> |
|
308 | 308 | ${h.text('username',class_='focus',tabindex=1)} |
|
309 | 309 | </div> |
|
310 | 310 | |
|
311 | 311 | </div> |
|
312 | 312 | <div class="field"> |
|
313 | 313 | <div class="label"> |
|
314 | 314 | <label for="password">${_('Password')}:</label> |
|
315 |
<span class="forgot_password">${h.link_to(_('(Forgot password?)'),h. |
|
|
315 | <span class="forgot_password">${h.link_to(_('(Forgot password?)'),h.route_path('reset_password'))}</span> | |
|
316 | 316 | </div> |
|
317 | 317 | <div class="input"> |
|
318 | 318 | ${h.password('password',class_='focus',tabindex=2)} |
|
319 | 319 | </div> |
|
320 | 320 | </div> |
|
321 | 321 | <div class="buttons"> |
|
322 | 322 | <div class="register"> |
|
323 | 323 | %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): |
|
324 |
${h.link_to(_("Don't have an account ?"),h. |
|
|
324 | ${h.link_to(_("Don't have an account ?"),h.route_path('register'))} | |
|
325 | 325 | %endif |
|
326 | 326 | </div> |
|
327 | 327 | <div class="submit"> |
|
328 | 328 | ${h.submit('sign_in',_('Sign In'),class_="btn btn-small",tabindex=3)} |
|
329 | 329 | </div> |
|
330 | 330 | </div> |
|
331 | 331 | </div> |
|
332 | 332 | </div> |
|
333 | 333 | ${h.end_form()} |
|
334 | 334 | %else: |
|
335 | 335 | <div class=""> |
|
336 | 336 | <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div> |
|
337 | 337 | <div class="full_name">${c.rhodecode_user.full_name_or_username}</div> |
|
338 | 338 | <div class="email">${c.rhodecode_user.email}</div> |
|
339 | 339 | </div> |
|
340 | 340 | <div class=""> |
|
341 | 341 | <ol class="links"> |
|
342 | 342 | <li>${h.link_to(_(u'My account'),h.url('my_account'))}</li> |
|
343 | 343 | <li class="logout"> |
|
344 |
${h.secure_form(h. |
|
|
344 | ${h.secure_form(h.route_path('logout'))} | |
|
345 | 345 | ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")} |
|
346 | 346 | ${h.end_form()} |
|
347 | 347 | </li> |
|
348 | 348 | </ol> |
|
349 | 349 | </div> |
|
350 | 350 | %endif |
|
351 | 351 | </div> |
|
352 | 352 | </div> |
|
353 | 353 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
354 | 354 | <div class="pill_container"> |
|
355 | 355 | % if c.unread_notifications == 0: |
|
356 | 356 | <a class="menu_link_notifications empty" href="${h.url('notifications')}">${c.unread_notifications}</a> |
|
357 | 357 | % else: |
|
358 | 358 | <a class="menu_link_notifications" href="${h.url('notifications')}">${c.unread_notifications}</a> |
|
359 | 359 | % endif |
|
360 | 360 | </div> |
|
361 | 361 | % endif |
|
362 | 362 | </li> |
|
363 | 363 | </%def> |
|
364 | 364 | |
|
365 | 365 | <%def name="menu_items(active=None)"> |
|
366 | 366 | <% |
|
367 | 367 | def is_active(selected): |
|
368 | 368 | if selected == active: |
|
369 | 369 | return "active" |
|
370 | 370 | return "" |
|
371 | 371 | %> |
|
372 | 372 | <ul id="quick" class="main_nav navigation horizontal-list"> |
|
373 | 373 | <!-- repo switcher --> |
|
374 | 374 | <li class="${is_active('repositories')} repo_switcher_li has_select2"> |
|
375 | 375 | <input id="repo_switcher" name="repo_switcher" type="hidden"> |
|
376 | 376 | </li> |
|
377 | 377 | |
|
378 | 378 | ## ROOT MENU |
|
379 | 379 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
380 | 380 | <li class="${is_active('journal')}"> |
|
381 | 381 | <a class="menulink" title="${_('Show activity journal')}" href="${h.url('journal')}"> |
|
382 | 382 | <div class="menulabel">${_('Journal')}</div> |
|
383 | 383 | </a> |
|
384 | 384 | </li> |
|
385 | 385 | %else: |
|
386 | 386 | <li class="${is_active('journal')}"> |
|
387 | 387 | <a class="menulink" title="${_('Show Public activity journal')}" href="${h.url('public_journal')}"> |
|
388 | 388 | <div class="menulabel">${_('Public journal')}</div> |
|
389 | 389 | </a> |
|
390 | 390 | </li> |
|
391 | 391 | %endif |
|
392 | 392 | <li class="${is_active('gists')}"> |
|
393 | 393 | <a class="menulink childs" title="${_('Show Gists')}" href="${h.url('gists')}"> |
|
394 | 394 | <div class="menulabel">${_('Gists')}</div> |
|
395 | 395 | </a> |
|
396 | 396 | </li> |
|
397 | 397 | <li class="${is_active('search')}"> |
|
398 | 398 | <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.url('search')}"> |
|
399 | 399 | <div class="menulabel">${_('Search')}</div> |
|
400 | 400 | </a> |
|
401 | 401 | </li> |
|
402 | 402 | % if h.HasPermissionAll('hg.admin')('access admin main page'): |
|
403 | 403 | <li class="${is_active('admin')}"> |
|
404 | 404 | <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;"> |
|
405 | 405 | <div class="menulabel">${_('Admin')} <div class="show_more"></div></div> |
|
406 | 406 | </a> |
|
407 | 407 | ${admin_menu()} |
|
408 | 408 | </li> |
|
409 | 409 | % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin: |
|
410 | 410 | <li class="${is_active('admin')}"> |
|
411 | 411 | <a class="menulink childs" title="${_('Delegated Admin settings')}"> |
|
412 | 412 | <div class="menulabel">${_('Admin')} <div class="show_more"></div></div> |
|
413 | 413 | </a> |
|
414 | 414 | ${admin_menu_simple(c.rhodecode_user.repositories_admin, |
|
415 | 415 | c.rhodecode_user.repository_groups_admin, |
|
416 | 416 | c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())} |
|
417 | 417 | </li> |
|
418 | 418 | % endif |
|
419 | 419 | % if c.debug_style: |
|
420 | 420 | <li class="${is_active('debug_style')}"> |
|
421 | 421 | <a class="menulink" title="${_('Style')}" href="${h.url('debug_style_home')}"> |
|
422 | 422 | <div class="menulabel">${_('Style')}</div> |
|
423 | 423 | </a> |
|
424 | 424 | </li> |
|
425 | 425 | % endif |
|
426 | 426 | ## render extra user menu |
|
427 | 427 | ${usermenu()} |
|
428 | 428 | </ul> |
|
429 | 429 | |
|
430 | 430 | <script type="text/javascript"> |
|
431 | 431 | var visual_show_public_icon = "${c.visual.show_public_icon}" == "True"; |
|
432 | 432 | |
|
433 | 433 | /*format the look of items in the list*/ |
|
434 | 434 | var format = function(state, escapeMarkup){ |
|
435 | 435 | if (!state.id){ |
|
436 | 436 | return state.text; // optgroup |
|
437 | 437 | } |
|
438 | 438 | var obj_dict = state.obj; |
|
439 | 439 | var tmpl = ''; |
|
440 | 440 | |
|
441 | 441 | if(obj_dict && state.type == 'repo'){ |
|
442 | 442 | if(obj_dict['repo_type'] === 'hg'){ |
|
443 | 443 | tmpl += '<i class="icon-hg"></i> '; |
|
444 | 444 | } |
|
445 | 445 | else if(obj_dict['repo_type'] === 'git'){ |
|
446 | 446 | tmpl += '<i class="icon-git"></i> '; |
|
447 | 447 | } |
|
448 | 448 | else if(obj_dict['repo_type'] === 'svn'){ |
|
449 | 449 | tmpl += '<i class="icon-svn"></i> '; |
|
450 | 450 | } |
|
451 | 451 | if(obj_dict['private']){ |
|
452 | 452 | tmpl += '<i class="icon-lock" ></i> '; |
|
453 | 453 | } |
|
454 | 454 | else if(visual_show_public_icon){ |
|
455 | 455 | tmpl += '<i class="icon-unlock-alt"></i> '; |
|
456 | 456 | } |
|
457 | 457 | } |
|
458 | 458 | if(obj_dict && state.type == 'group'){ |
|
459 | 459 | tmpl += '<i class="icon-folder-close"></i> '; |
|
460 | 460 | } |
|
461 | 461 | tmpl += escapeMarkup(state.text); |
|
462 | 462 | return tmpl; |
|
463 | 463 | }; |
|
464 | 464 | |
|
465 | 465 | var formatResult = function(result, container, query, escapeMarkup) { |
|
466 | 466 | return format(result, escapeMarkup); |
|
467 | 467 | }; |
|
468 | 468 | |
|
469 | 469 | var formatSelection = function(data, container, escapeMarkup) { |
|
470 | 470 | return format(data, escapeMarkup); |
|
471 | 471 | }; |
|
472 | 472 | |
|
473 | 473 | $("#repo_switcher").select2({ |
|
474 | 474 | cachedDataSource: {}, |
|
475 | 475 | minimumInputLength: 2, |
|
476 | 476 | placeholder: '<div class="menulabel">${_('Go to')} <div class="show_more"></div></div>', |
|
477 | 477 | dropdownAutoWidth: true, |
|
478 | 478 | formatResult: formatResult, |
|
479 | 479 | formatSelection: formatSelection, |
|
480 | 480 | containerCssClass: "repo-switcher", |
|
481 | 481 | dropdownCssClass: "repo-switcher-dropdown", |
|
482 | 482 | escapeMarkup: function(m){ |
|
483 | 483 | // don't escape our custom placeholder |
|
484 | 484 | if(m.substr(0,23) == '<div class="menulabel">'){ |
|
485 | 485 | return m; |
|
486 | 486 | } |
|
487 | 487 | |
|
488 | 488 | return Select2.util.escapeMarkup(m); |
|
489 | 489 | }, |
|
490 | 490 | query: $.debounce(250, function(query){ |
|
491 | 491 | self = this; |
|
492 | 492 | var cacheKey = query.term; |
|
493 | 493 | var cachedData = self.cachedDataSource[cacheKey]; |
|
494 | 494 | |
|
495 | 495 | if (cachedData) { |
|
496 | 496 | query.callback({results: cachedData.results}); |
|
497 | 497 | } else { |
|
498 | 498 | $.ajax({ |
|
499 | 499 | url: "${h.url('repo_switcher_data')}", |
|
500 | 500 | data: {'query': query.term}, |
|
501 | 501 | dataType: 'json', |
|
502 | 502 | type: 'GET', |
|
503 | 503 | success: function(data) { |
|
504 | 504 | self.cachedDataSource[cacheKey] = data; |
|
505 | 505 | query.callback({results: data.results}); |
|
506 | 506 | }, |
|
507 | 507 | error: function(data, textStatus, errorThrown) { |
|
508 | 508 | alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText)); |
|
509 | 509 | } |
|
510 | 510 | }) |
|
511 | 511 | } |
|
512 | 512 | }) |
|
513 | 513 | }); |
|
514 | 514 | |
|
515 | 515 | $("#repo_switcher").on('select2-selecting', function(e){ |
|
516 | 516 | e.preventDefault(); |
|
517 | 517 | window.location = pyroutes.url('summary_home', {'repo_name': e.val}); |
|
518 | 518 | }); |
|
519 | 519 | |
|
520 | 520 | ## Global mouse bindings ## |
|
521 | 521 | |
|
522 | 522 | // general help "?" |
|
523 | 523 | Mousetrap.bind(['?'], function(e) { |
|
524 | 524 | $('#help_kb').modal({}) |
|
525 | 525 | }); |
|
526 | 526 | |
|
527 | 527 | // / open the quick filter |
|
528 | 528 | Mousetrap.bind(['/'], function(e) { |
|
529 | 529 | $("#repo_switcher").select2("open"); |
|
530 | 530 | |
|
531 | 531 | // return false to prevent default browser behavior |
|
532 | 532 | // and stop event from bubbling |
|
533 | 533 | return false; |
|
534 | 534 | }); |
|
535 | 535 | |
|
536 | 536 | // general nav g + action |
|
537 | 537 | Mousetrap.bind(['g h'], function(e) { |
|
538 | 538 | window.location = pyroutes.url('home'); |
|
539 | 539 | }); |
|
540 | 540 | Mousetrap.bind(['g g'], function(e) { |
|
541 | 541 | window.location = pyroutes.url('gists', {'private':1}); |
|
542 | 542 | }); |
|
543 | 543 | Mousetrap.bind(['g G'], function(e) { |
|
544 | 544 | window.location = pyroutes.url('gists', {'public':1}); |
|
545 | 545 | }); |
|
546 | 546 | Mousetrap.bind(['n g'], function(e) { |
|
547 | 547 | window.location = pyroutes.url('new_gist'); |
|
548 | 548 | }); |
|
549 | 549 | Mousetrap.bind(['n r'], function(e) { |
|
550 | 550 | window.location = pyroutes.url('new_repo'); |
|
551 | 551 | }); |
|
552 | 552 | |
|
553 | 553 | % if hasattr(c, 'repo_name') and hasattr(c, 'rhodecode_db_repo'): |
|
554 | 554 | // nav in repo context |
|
555 | 555 | Mousetrap.bind(['g s'], function(e) { |
|
556 | 556 | window.location = pyroutes.url('summary_home', {'repo_name': REPO_NAME}); |
|
557 | 557 | }); |
|
558 | 558 | Mousetrap.bind(['g c'], function(e) { |
|
559 | 559 | window.location = pyroutes.url('changelog_home', {'repo_name': REPO_NAME}); |
|
560 | 560 | }); |
|
561 | 561 | Mousetrap.bind(['g F'], function(e) { |
|
562 | 562 | window.location = pyroutes.url('files_home', {'repo_name': REPO_NAME, 'revision': '${c.rhodecode_db_repo.landing_rev[1]}', 'f_path': '', 'search': '1'}); |
|
563 | 563 | }); |
|
564 | 564 | Mousetrap.bind(['g f'], function(e) { |
|
565 | 565 | window.location = pyroutes.url('files_home', {'repo_name': REPO_NAME, 'revision': '${c.rhodecode_db_repo.landing_rev[1]}', 'f_path': ''}); |
|
566 | 566 | }); |
|
567 | 567 | Mousetrap.bind(['g p'], function(e) { |
|
568 | 568 | window.location = pyroutes.url('pullrequest_show_all', {'repo_name': REPO_NAME}); |
|
569 | 569 | }); |
|
570 | 570 | Mousetrap.bind(['g o'], function(e) { |
|
571 | 571 | window.location = pyroutes.url('edit_repo', {'repo_name': REPO_NAME}); |
|
572 | 572 | }); |
|
573 | 573 | Mousetrap.bind(['g O'], function(e) { |
|
574 | 574 | window.location = pyroutes.url('edit_repo_perms', {'repo_name': REPO_NAME}); |
|
575 | 575 | }); |
|
576 | 576 | % endif |
|
577 | 577 | |
|
578 | 578 | </script> |
|
579 | 579 | <script src="${h.url('/js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script> |
|
580 | 580 | </%def> |
|
581 | 581 | |
|
582 | 582 | <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
|
583 | 583 | <div class="modal-dialog"> |
|
584 | 584 | <div class="modal-content"> |
|
585 | 585 | <div class="modal-header"> |
|
586 | 586 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
|
587 | 587 | <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4> |
|
588 | 588 | </div> |
|
589 | 589 | <div class="modal-body"> |
|
590 | 590 | <div class="block-left"> |
|
591 | 591 | <table class="keyboard-mappings"> |
|
592 | 592 | <tbody> |
|
593 | 593 | <tr> |
|
594 | 594 | <th></th> |
|
595 | 595 | <th>${_('Site-wide shortcuts')}</th> |
|
596 | 596 | </tr> |
|
597 | 597 | <% |
|
598 | 598 | elems = [ |
|
599 | 599 | ('/', 'Open quick search box'), |
|
600 | 600 | ('g h', 'Goto home page'), |
|
601 | 601 | ('g g', 'Goto my private gists page'), |
|
602 | 602 | ('g G', 'Goto my public gists page'), |
|
603 | 603 | ('n r', 'New repository page'), |
|
604 | 604 | ('n g', 'New gist page'), |
|
605 | 605 | ] |
|
606 | 606 | %> |
|
607 | 607 | %for key, desc in elems: |
|
608 | 608 | <tr> |
|
609 | 609 | <td class="keys"> |
|
610 | 610 | <span class="key tag">${key}</span> |
|
611 | 611 | </td> |
|
612 | 612 | <td>${desc}</td> |
|
613 | 613 | </tr> |
|
614 | 614 | %endfor |
|
615 | 615 | </tbody> |
|
616 | 616 | </table> |
|
617 | 617 | </div> |
|
618 | 618 | <div class="block-left"> |
|
619 | 619 | <table class="keyboard-mappings"> |
|
620 | 620 | <tbody> |
|
621 | 621 | <tr> |
|
622 | 622 | <th></th> |
|
623 | 623 | <th>${_('Repositories')}</th> |
|
624 | 624 | </tr> |
|
625 | 625 | <% |
|
626 | 626 | elems = [ |
|
627 | 627 | ('g s', 'Goto summary page'), |
|
628 | 628 | ('g c', 'Goto changelog page'), |
|
629 | 629 | ('g f', 'Goto files page'), |
|
630 | 630 | ('g F', 'Goto files page with file search activated'), |
|
631 | 631 | ('g p', 'Goto pull requests page'), |
|
632 | 632 | ('g o', 'Goto repository settings'), |
|
633 | 633 | ('g O', 'Goto repository permissions settings'), |
|
634 | 634 | ] |
|
635 | 635 | %> |
|
636 | 636 | %for key, desc in elems: |
|
637 | 637 | <tr> |
|
638 | 638 | <td class="keys"> |
|
639 | 639 | <span class="key tag">${key}</span> |
|
640 | 640 | </td> |
|
641 | 641 | <td>${desc}</td> |
|
642 | 642 | </tr> |
|
643 | 643 | %endfor |
|
644 | 644 | </tbody> |
|
645 | 645 | </table> |
|
646 | 646 | </div> |
|
647 | 647 | </div> |
|
648 | 648 | <div class="modal-footer"> |
|
649 | 649 | </div> |
|
650 | 650 | </div><!-- /.modal-content --> |
|
651 | 651 | </div><!-- /.modal-dialog --> |
|
652 | 652 | </div><!-- /.modal --> |
General Comments 0
You need to be logged in to leave comments.
Login now