##// END OF EJS Templates
templates: add ARIA markup to dropdown menus...
Andrew Shadura -
r6209:24a0c176 default
parent child Browse files
Show More
@@ -1,534 +1,549 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="root.html"/>
3 3
4 4 <!-- CONTENT -->
5 5 <div id="content">
6 6 ${self.flash_msg()}
7 7 <div id="main">
8 8 ${next.main()}
9 9 </div>
10 10 </div>
11 11 <!-- END CONTENT -->
12 12
13 13 <!-- FOOTER -->
14 14 <div id="footer">
15 15 <div id="footer-inner" class="title">
16 16 <div>
17 17 <p class="footer-link">
18 18 ${_('Server instance: %s') % c.instance_id if c.instance_id else ''}
19 19 </p>
20 20 <p class="footer-link-right">
21 21 This site is powered by
22 22 %if c.visual.show_version:
23 23 <a href="${h.url('kallithea_project_url')}" target="_blank">Kallithea</a> ${c.kallithea_version},
24 24 %else:
25 25 <a href="${h.url('kallithea_project_url')}" target="_blank">Kallithea</a>,
26 26 %endif
27 27 which is
28 28 <a href="${h.canonical_url('about')}#copyright">&copy; 2010&ndash;2016 by various authors &amp; licensed under GPLv3</a>.
29 29 %if c.issues_url:
30 30 &ndash; <a href="${c.issues_url}" target="_blank">${_('Support')}</a>
31 31 %endif
32 32 </p>
33 33 </div>
34 34 </div>
35 35 </div>
36 36
37 37 <!-- END FOOTER -->
38 38
39 39 ### MAKO DEFS ###
40 40
41 41 <%block name="branding_title">
42 42 %if c.site_name:
43 43 &middot; ${c.site_name}
44 44 %endif
45 45 </%block>
46 46
47 47 <%def name="flash_msg()">
48 48 <%include file="/base/flash_msg.html"/>
49 49 </%def>
50 50
51 51 <%def name="breadcrumbs()">
52 52 <div class="breadcrumbs">
53 53 ${self.breadcrumbs_links()}
54 54 </div>
55 55 </%def>
56 56
57 57 <%def name="admin_menu()">
58 58 <ul class="dropdown-menu" role="menu">
59 59 <li><a href="${h.url('admin_home')}"><i class="icon-book"></i> ${_('Admin Journal')}</a></li>
60 60 <li><a href="${h.url('repos')}"><i class="icon-database"></i> ${_('Repositories')}</a></li>
61 61 <li><a href="${h.url('repos_groups')}"><i class="icon-folder"></i> ${_('Repository Groups')}</a></li>
62 62 <li><a href="${h.url('users')}"><i class="icon-user"></i> ${_('Users')}</a></li>
63 63 <li><a href="${h.url('users_groups')}"><i class="icon-users"></i> ${_('User Groups')}</a></li>
64 64 <li><a href="${h.url('admin_permissions')}"><i class="icon-block"></i> ${_('Default Permissions')}</a></li>
65 65 <li><a href="${h.url('auth_home')}"><i class="icon-key"></i> ${_('Authentication')}</a></li>
66 66 <li><a href="${h.url('defaults')}"><i class="icon-wrench"></i> ${_('Repository Defaults')}</a></li>
67 67 <li class="last"><a href="${h.url('admin_settings')}"><i class="icon-gear"></i> ${_('Settings')}</a></li>
68 68 </ul>
69 69
70 70 </%def>
71 71
72 72
73 73 ## admin menu used for people that have some admin resources
74 74 <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)">
75 75 <ul class="dropdown-menu" role="menu">
76 76 %if repositories:
77 77 <li><a href="${h.url('repos')}"><i class="icon-database"></i> ${_('Repositories')}</a></li>
78 78 %endif
79 79 %if repository_groups:
80 80 <li><a href="${h.url('repos_groups')}"><i class="icon-folder"></i> ${_('Repository Groups')}</a></li>
81 81 %endif
82 82 %if user_groups:
83 83 <li><a href="${h.url('users_groups')}"><i class="icon-users"></i> ${_('User Groups')}</a></li>
84 84 %endif
85 85 </ul>
86 86 </%def>
87 87
88 88 <%def name="repotag(repo)">
89 89 %if h.is_hg(repo):
90 90 <span class="repotag" title="${_('Mercurial repository')}">hg</span>
91 91 %endif
92 92 %if h.is_git(repo):
93 93 <span class="repotag" title="${_('Git repository')}">git</span>
94 94 %endif
95 95 </%def>
96 96
97 97 <%def name="repo_context_bar(current=None, rev=None)">
98 98 <% rev = None if rev == 'tip' else rev %>
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 <h2>
108 108 ${repotag(c.db_repo)}
109 109
110 110 ## public/private
111 111 %if c.db_repo.private:
112 112 <i class="icon-keyhole-circled"></i>
113 113 %else:
114 114 <i class="icon-globe"></i>
115 115 %endif
116 116 ${h.repo_breadcrumbs(c.db_repo.groups_and_repo)}
117 117
118 118 %if current == 'createfork':
119 119 - ${_('Create Fork')}
120 120 %endif
121 121 </h2>
122 122 <!--
123 123 <div id="breadcrumbs">
124 124 ${h.link_to(_('Repositories'),h.url('home'))}
125 125 &raquo;
126 126 ${h.repo_breadcrumbs(c.db_repo.groups_and_repo)}
127 127 </div>
128 128 -->
129 129 <ul id="context-pages" class="horizontal-list">
130 130 <li ${is_current('summary')} data-context="summary"><a href="${h.url('summary_home', repo_name=c.repo_name)}"><i class="icon-doc-text"></i> ${_('Summary')}</a></li>
131 131 %if rev:
132 132 <li ${is_current('changelog')} data-context="changelog"><a href="${h.url('changelog_file_home', repo_name=c.repo_name, revision=rev, f_path='')}"><i class="icon-clock"></i> ${_('Changelog')}</a></li>
133 133 %else:
134 134 <li ${is_current('changelog')} data-context="changelog"><a href="${h.url('changelog_home', repo_name=c.repo_name)}"><i class="icon-clock"></i> ${_('Changelog')}</a></li>
135 135 %endif
136 136 <li ${is_current('files')} data-context="files"><a href="${h.url('files_home', repo_name=c.repo_name, revision=rev or 'tip')}"><i class="icon-doc-inv"></i> ${_('Files')}</a></li>
137 137 <li ${is_current('switch-to')} data-context="switch-to">
138 138 <input id="branch_switcher" name="branch_switcher" type="hidden">
139 139 </li>
140 140 <li ${is_current('options')} data-context="options" class="dropdown">
141 141 %if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
142 <a href="${h.url('edit_repo',repo_name=c.repo_name)}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
142 <a href="${h.url('edit_repo',repo_name=c.repo_name)}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
143 143 %else:
144 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
144 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
145 145 %endif
146 <ul class="dropdown-menu" role="menu">
146 <ul class="dropdown-menu" role="menu" aria-hidden="yes">
147 147 %if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
148 148 <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}"><i class="icon-gear"></i> ${_('Settings')}</a></li>
149 149 %endif
150 150 %if c.db_repo.fork:
151 151 <li><a href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1], other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}">
152 152 <i class="icon-git-compare"></i> ${_('Compare Fork')}</a></li>
153 153 %endif
154 154 <li><a href="${h.url('compare_home',repo_name=c.repo_name)}"><i class="icon-git-compare"></i> ${_('Compare')}</a></li>
155 155
156 156 <li><a href="${h.url('search_repo',repo_name=c.repo_name)}"><i class="icon-search"></i> ${_('Search')}</a></li>
157 157
158 158 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.db_repo.enable_locking:
159 159 %if c.db_repo.locked[0]:
160 160 <li><a href="${h.url('toggle_locking', repo_name=c.repo_name)}"><i class="icon-lock"></i> ${_('Unlock')}</a></li>
161 161 %else:
162 162 <li><a href="${h.url('toggle_locking', repo_name=c.repo_name)}"><i class="icon-lock-open-alt"></i> ${_('Lock')}</li>
163 163 %endif
164 164 %endif
165 165 ## TODO: this check feels wrong, it would be better to have a check for permissions
166 166 ## also it feels like a job for the controller
167 167 %if c.authuser.username != 'default':
168 168 <li>
169 169 <a class="${'following' if c.repository_following else 'follow'}" onclick="toggleFollowingRepo(this, ${c.db_repo.repo_id});">
170 170 <span class="show-follow"><i class="icon-heart-empty"></i> ${_('Follow')}</span>
171 171 <span class="show-following"><i class="icon-heart"></i> ${_('Unfollow')}</span>
172 172 </a>
173 173 </li>
174 174 <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}"><i class="icon-git-pull-request"></i> ${_('Fork')}</a></li>
175 175 <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}"><i class="icon-git-pull-request"></i> ${_('Create Pull Request')}</a></li>
176 176 %endif
177 177 </ul>
178 178 </li>
179 179 <li ${is_current('showpullrequest')} data-context="showpullrequest">
180 180 <a href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests for %s') % c.repo_name}"> <i class="icon-git-pull-request"></i> ${_('Pull Requests')}
181 181 %if c.repository_pull_requests:
182 182 <span class="badge">${c.repository_pull_requests}</span>
183 183 %endif
184 184 </a>
185 185 </li>
186 186 </ul>
187 187 </div>
188 188 <script type="text/javascript">
189 189 $(document).ready(function() {
190 190 var bcache = {};
191 191
192 192 $("#branch_switcher").select2({
193 193 placeholder: '<i class="icon-exchange"></i> ${_('Switch To')} <span class="caret"></span>',
194 194 dropdownAutoWidth: true,
195 195 sortResults: prefixFirstSort,
196 196 formatResult: function(obj) {
197 197 return obj.text;
198 198 },
199 199 formatSelection: function(obj) {
200 200 return obj.text;
201 201 },
202 202 formatNoMatches: function(term) {
203 203 return "${_('No matches found')}";
204 204 },
205 205 escapeMarkup: function(m) {
206 206 // don't escape our custom placeholder
207 207 if (m.substr(0, 29) == '<i class="icon-exchange"></i>') {
208 208 return m;
209 209 }
210 210
211 211 return Select2.util.escapeMarkup(m);
212 212 },
213 213 containerCssClass: "repo-switcher",
214 214 dropdownCssClass: "repo-switcher-dropdown",
215 215 query: function(query) {
216 216 var key = 'cache';
217 217 var cached = bcache[key];
218 218 if (cached) {
219 219 var data = {
220 220 results: []
221 221 };
222 222 // filter results
223 223 $.each(cached.results, function() {
224 224 var section = this.text;
225 225 var children = [];
226 226 $.each(this.children, function() {
227 227 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
228 228 children.push({
229 229 'id': this.id,
230 230 'text': this.text,
231 231 'type': this.type,
232 232 'obj': this.obj
233 233 });
234 234 }
235 235 });
236 236 if (children.length !== 0) {
237 237 data.results.push({
238 238 'text': section,
239 239 'children': children
240 240 });
241 241 }
242 242
243 243 });
244 244 query.callback(data);
245 245 } else {
246 246 $.ajax({
247 247 url: pyroutes.url('repo_refs_data', {
248 248 'repo_name': '${c.repo_name}'
249 249 }),
250 250 data: {},
251 251 dataType: 'json',
252 252 type: 'GET',
253 253 success: function(data) {
254 254 bcache[key] = data;
255 255 query.callback(data);
256 256 }
257 257 });
258 258 }
259 259 }
260 260 });
261 261
262 262 $("#branch_switcher").on('select2-selecting', function(e) {
263 263 e.preventDefault();
264 264 var context = $('#context-bar .current').data('context');
265 265 if (context == 'files') {
266 266 window.location = pyroutes.url('files_home', {
267 267 'repo_name': REPO_NAME,
268 268 'revision': e.choice.id,
269 269 'f_path': '',
270 270 'at': e.choice.text
271 271 });
272 272 } else if (context == 'changelog') {
273 273 if (e.choice.type == 'tag' || e.choice.type == 'book') {
274 274 $("#branch_filter").append($('<'+'option/>').val(e.choice.text));
275 275 }
276 276 $("#branch_filter").val(e.choice.text).change();
277 277 } else {
278 278 window.location = pyroutes.url('changelog_home', {
279 279 'repo_name': '${c.repo_name}',
280 280 'branch': e.choice.text
281 281 });
282 282 }
283 283 });
284 284 });
285 285 </script>
286 286 <!--- END CONTEXT BAR -->
287 287 </%def>
288 288
289 289 <%def name="menu(current=None)">
290 290 <%
291 291 def is_current(selected):
292 292 if selected == current:
293 293 return h.literal('class="current"')
294 294 %>
295 295
296 296 <ul id="quick" class="horizontal-list">
297 297 <!-- repo switcher -->
298 298 <li ${is_current('repositories')}>
299 299 <input id="repo_switcher" name="repo_switcher" type="hidden">
300 300 </li>
301 301
302 302 ##ROOT MENU
303 303 %if c.authuser.username != 'default':
304 304 <li ${is_current('journal')}>
305 305 <a class="menu_link" title="${_('Show recent activity')}" href="${h.url('journal')}">
306 306 <i class="icon-book"></i> ${_('Journal')}
307 307 </a>
308 308 </li>
309 309 %else:
310 310 <li ${is_current('journal')}>
311 311 <a class="menu_link" title="${_('Public journal')}" href="${h.url('public_journal')}">
312 312 <i class="icon-book"></i> ${_('Public journal')}
313 313 </a>
314 314 </li>
315 315 %endif
316 316 <li ${is_current('gists')} class="dropdown">
317 317 <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" title="${_('Show public gists')}" href="${h.url('gists')}">
318 318 <i class="icon-clippy"></i> ${_('Gists')} <span class="caret"></span>
319 319 </a>
320 320 <ul class="dropdown-menu" role="menu">
321 321 <li><a href="${h.url('new_gist', public=1)}"><i class="icon-paste"></i> ${_('Create New Gist')}</a></li>
322 322 <li><a href="${h.url('gists')}"><i class="icon-globe"></i> ${_('All Public Gists')}</a></li>
323 323 %if c.authuser.username != 'default':
324 324 <li><a href="${h.url('gists', public=1)}"><i class="icon-user"></i> ${_('My Public Gists')}</a></li>
325 325 <li><a href="${h.url('gists', private=1)}"><i class="icon-keyhole-circled"></i> ${_('My Private Gists')}</a></li>
326 326 %endif
327 327 </ul>
328 328 </li>
329 329 <li ${is_current('search')}>
330 330 <a class="menu_link" title="${_('Search in repositories')}" href="${h.url('search')}">
331 331 <i class="icon-search"></i> ${_('Search')}
332 332 </a>
333 333 </li>
334 334 % if h.HasPermissionAny('hg.admin')('access admin main page'):
335 335 <li ${is_current('admin')} class="dropdown">
336 336 <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" title="${_('Admin')}" href="${h.url('admin_home')}">
337 337 <i class="icon-gear"></i> ${_('Admin')} <span class="caret"></span>
338 338 </a>
339 339 ${admin_menu()}
340 340 </li>
341 341 % elif c.authuser.repositories_admin or c.authuser.repository_groups_admin or c.authuser.user_groups_admin:
342 342 <li ${is_current('admin')} class="dropdown">
343 343 <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" title="${_('Admin')}">
344 344 <i class="icon-gear"></i> ${_('Admin')}
345 345 </a>
346 346 ${admin_menu_simple(c.authuser.repositories_admin,
347 347 c.authuser.repository_groups_admin,
348 348 c.authuser.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
349 349 </li>
350 350 % endif
351 351
352 352 <li ${is_current('my_pullrequests')}>
353 353 <a class="menu_link" title="${_('My Pull Requests')}" href="${h.url('my_pullrequests')}">
354 354 <i class="icon-git-pull-request"></i> ${_('My Pull Requests')}
355 355 %if c.my_pr_count != 0:
356 356 <span class="badge">${c.my_pr_count}</span>
357 357 %endif
358 358 </a>
359 359 </li>
360 360
361 361 ## USER MENU
362 362 <li class="dropdown">
363 363 <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" id="quick_login_link"
364 aria-expanded="false" aria-controls="quick_login"
364 365 %if c.authuser.username != 'default':
365 366 href="${h.url('notifications')}"
366 367 %endif
367 368 >
368 ${h.gravatar_div(c.authuser.email, size=20, div_class="icon", div_style="display:inline")}
369 ${h.gravatar_div(c.authuser.email, size=20, div_class="icon", div_style="display:inline", div_aria_hidden="true")}
369 370 %if c.authuser.username != 'default':
370 371 <span class="menu_link_user">${c.authuser.username}</span>
371 372 %if c.unread_notifications != 0:
372 373 <span class="badge">${c.unread_notifications}</span>
373 374 %endif
374 375 %else:
375 376 <span>${_('Not Logged In')}</span>
376 377 %endif
377 378 </a>
378 379
379 <div class="user-menu">
380 <div id="quick_login" class="dropdown-menu">
380 <div class="user-menu" role="menu">
381 <div id="quick_login" role="form" aria-describedby="quick_login_h" aria-hidden="true" class="dropdown-menu">
381 382 %if c.authuser.username == 'default' or c.authuser.user_id is None:
382 <h4>${_('Login to Your Account')}</h4>
383 <h4 id="quick_login_h">${_('Login to Your Account')}</h4>
383 384 ${h.form(h.url('login_home', came_from=request.path_qs))}
384 385 <div class="form">
385 386 <div class="fields">
386 387 <div class="field">
387 388 <div class="label">
388 389 <label for="username">${_('Username')}:</label>
389 390 </div>
390 391 <div class="input">
391 392 ${h.text('username',class_='focus')}
392 393 </div>
393 394
394 395 </div>
395 396 <div class="field">
396 397 <div class="label">
397 398 <label for="password">${_('Password')}:</label>
398 399 </div>
399 400 <div class="input">
400 401 ${h.password('password',class_='focus')}
401 402 </div>
402 403
403 404 </div>
404 405 <div class="buttons">
405 406 <div class="password_forgoten">${h.link_to(_('Forgot password ?'),h.url('reset_password'))}</div>
406 407 <div class="register">
407 408 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
408 409 ${h.link_to(_("Don't have an account ?"),h.url('register'))}
409 410 %endif
410 411 </div>
411 412 <div class="submit">
412 413 ${h.submit('sign_in',_('Log In'),class_="btn btn-mini")}
413 414 </div>
414 415 </div>
415 416 </div>
416 417 </div>
417 418 ${h.end_form()}
418 419 %else:
419 420 <div class="links_left">
420 421 ${h.gravatar_div(c.authuser.email, size=48, div_class="big_gravatar")}
421 422 <div class="full_name">${c.authuser.full_name_or_username}</div>
422 423 <div class="email">${c.authuser.email}</div>
423 424 </div>
424 425 <div class="links_right">
425 426 <ol class="links">
426 427 <li><a href="${h.url('notifications')}">${_('Notifications')}: ${c.unread_notifications}</a></li>
427 428 <li>${h.link_to(_('My Account'),h.url('my_account'))}</li>
428 429 %if not c.authuser.is_external_auth:
429 430 ## Cannot log out if using external (container) authentication.
430 431 <li class="logout">${h.link_to(_('Log Out'), h.url('logout_home'))}</li>
431 432 %endif
432 433 </ol>
433 434 </div>
434 435 %endif
435 436 </div>
436 437 </div>
437 438 </li>
438 439
439 440 <script type="text/javascript">
440 441 $(document).ready(function(){
441 442 var visual_show_public_icon = "${c.visual.show_public_icon}" == "True";
442 443 var cache = {}
443 444 /*format the look of items in the list*/
444 445 var format = function(state){
445 446 if (!state.id){
446 447 return state.text; // optgroup
447 448 }
448 449 var obj_dict = state.obj;
449 450 var tmpl = '';
450 451
451 452 if(obj_dict && state.type == 'repo'){
452 453 tmpl += '<span class="repo-icons">';
453 454 if(obj_dict['repo_type'] === 'hg'){
454 455 tmpl += '<span class="repotag">hg</span> ';
455 456 }
456 457 else if(obj_dict['repo_type'] === 'git'){
457 458 tmpl += '<span class="repotag">git</span> ';
458 459 }
459 460 if(obj_dict['private']){
460 461 tmpl += '<i class="icon-keyhole-circled"></i> ';
461 462 }
462 463 else if(visual_show_public_icon){
463 464 tmpl += '<i class="icon-globe"></i> ';
464 465 }
465 466 tmpl += '</span>';
466 467 }
467 468 if(obj_dict && state.type == 'group'){
468 469 tmpl += '<i class="icon-folder"></i> ';
469 470 }
470 471 tmpl += state.text;
471 472 return tmpl;
472 473 }
473 474
474 475 $("#repo_switcher").select2({
475 476 placeholder: '<i class="icon-database"></i> ${_('Repositories')} <span class="caret"></span>',
476 477 dropdownAutoWidth: true,
477 478 sortResults: prefixFirstSort,
478 479 formatResult: format,
479 480 formatSelection: format,
480 481 formatNoMatches: function(term){
481 482 return "${_('No matches found')}";
482 483 },
483 484 containerCssClass: "repo-switcher",
484 485 dropdownCssClass: "repo-switcher-dropdown",
485 486 escapeMarkup: function(m){
486 487 // don't escape our custom placeholder
487 488 if(m.substr(0,29) == '<i class="icon-database"></i>'){
488 489 return m;
489 490 }
490 491
491 492 return Select2.util.escapeMarkup(m);
492 493 },
493 494 query: function(query){
494 495 var key = 'cache';
495 496 var cached = cache[key] ;
496 497 if(cached) {
497 498 var data = {results: []};
498 499 //filter results
499 500 $.each(cached.results, function(){
500 501 var section = this.text;
501 502 var children = [];
502 503 $.each(this.children, function(){
503 504 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
504 505 children.push({'id': this.id, 'text': this.text, 'type': this.type, 'obj': this.obj});
505 506 }
506 507 });
507 508 if(children.length !== 0){
508 509 data.results.push({'text': section, 'children': children});
509 510 }
510 511
511 512 });
512 513 query.callback(data);
513 514 }else{
514 515 $.ajax({
515 516 url: "${h.url('repo_switcher_data')}",
516 517 data: {},
517 518 dataType: 'json',
518 519 type: 'GET',
519 520 success: function(data) {
520 521 cache[key] = data;
521 522 query.callback({results: data.results});
522 523 }
523 524 });
524 525 }
525 526 }
526 527 });
527 528
528 529 $("#repo_switcher").on('select2-selecting', function(e){
529 530 e.preventDefault();
530 531 window.location = pyroutes.url('summary_home', {'repo_name': e.val});
531 532 });
533
534 $(document).on('shown.bs.dropdown', function(event) {
535 var dropdown = $(event.target);
536
537 dropdown.attr('aria-expanded', true);
538 dropdown.find('.dropdown-menu').attr('aria-hidden', false);
539 });
540
541 $(document).on('hidden.bs.dropdown', function(event) {
542 var dropdown = $(event.target);
543
544 dropdown.attr('aria-expanded', false);
545 dropdown.find('.dropdown-menu').attr('aria-hidden', true);
546 });
532 547 });
533 548 </script>
534 549 </%def>
General Comments 0
You need to be logged in to leave comments. Login now