|
29 | 29 |
|
30 | 30 | {% block extrahead %} {% endblock %} |
31 | 31 | </head> |
32 | | -<body class="hold-transition skin-blue sidebar-mini"> |
| 32 | +<body class="hold-transition skin-blue sidebar-mini fixed"> |
33 | 33 | <div class="wrapper"> |
34 | 34 |
|
35 | 35 | <header class="main-header"> |
|
328 | 328 | <!-- /.search form --> |
329 | 329 | <!-- sidebar menu: : style can be found in sidebar.less --> |
330 | 330 | <ul class="sidebar-menu"> |
331 | | - <li class="header">页面导航</li> |
332 | | - <li class="active"> |
| 331 | + <li class="header">{% trans 'MAIN NAVIGATION' %}</li> |
| 332 | + <li> |
333 | 333 | <a href="/admin/"> |
334 | 334 | <i class="fa fa-dashboard"></i> <span>{% trans 'Dashboard' %}</span> |
335 | 335 | </a> |
|
338 | 338 | {% if app_list %} |
339 | 339 | {% for app in app_list %} |
340 | 340 | <li class="treeview"> |
341 | | - <a href="#"> |
| 341 | + <a href="javascript:void(0)"> |
342 | 342 | <i class="fa fa-database"></i> |
343 | 343 | <span style="overflow: hidden; display: inline-block; vertical-align:top;">{{ app.name }}</span> |
344 | 344 | <span class="pull-right-container"> |
@@ -607,11 +607,32 @@ <h3 class="control-sidebar-heading">Chat Settings</h3> |
607 | 607 | <!-- AdminLTE for demo purposes --> |
608 | 608 | <script src={% static "admin/dist/js/demo.js" %}></script> |
609 | 609 | <script> |
610 | | -// 用来控制iframe自适应行高 |
611 | | -$("#page_content").load(function () { |
612 | | - var mainheight = $(this).contents().find("body").height() + 20; |
613 | | - $(this).height(mainheight); |
614 | | -}); |
| 610 | +// use js control active status of siderbar-menu |
| 611 | +$(function() { |
| 612 | + var menuActions = document.querySelectorAll('.sidebar-menu a') |
| 613 | + for (var i in menuActions) { |
| 614 | + try { |
| 615 | + if (window.location.pathname === '/admin/') { |
| 616 | + menuActions[i].parentNode.setAttribute('class', 'active') |
| 617 | + break |
| 618 | + } |
| 619 | + |
| 620 | + if (window.location.href.indexOf(menuActions[i].href) !== -1) { |
| 621 | + if (menuActions[i].href===window.location.origin + '/admin/') { |
| 622 | + continue |
| 623 | + } |
| 624 | + |
| 625 | + console.log('menu matched.', window.location.href, menuActions[i].href); |
| 626 | + menuActions[i].parentNode.setAttribute('class', 'active'); |
| 627 | + menuActions[i].parentNode.parentNode.setAttribute('class', 'treeview-menu menu-open'); |
| 628 | + menuActions[i].parentNode.parentNode.parentNode.setAttribute('class', 'treeview active'); |
| 629 | + // break |
| 630 | + } |
| 631 | + } catch (e) { |
| 632 | + console.log(window.location.href, menuActions[i].href, e) |
| 633 | + } |
| 634 | + } |
| 635 | +}) |
615 | 636 | </script> |
616 | 637 |
|
617 | 638 | {% block custom_js %}{% endblock %} |
|
0 commit comments