Browse Source

Merge "Fix for the broken header's dropdowns for both v0.11.2 and v0.13"

tags/9.0.0.0b1
Jenkins 3 years ago
parent
commit
07ac5e2e50

+ 21
- 1
horizon/static/framework/framework.module.js View File

@@ -10,13 +10,14 @@
10 10
     .config(config);
11 11
 
12 12
   config.$inject = [
13
+    '$injector',
13 14
     '$provide',
14 15
     '$interpolateProvider',
15 16
     '$httpProvider',
16 17
     '$windowProvider'
17 18
   ];
18 19
 
19
-  function config($provide, $interpolateProvider, $httpProvider, $windowProvider) {
20
+  function config($injector, $provide, $interpolateProvider, $httpProvider, $windowProvider) {
20 21
 
21 22
     var path = $windowProvider.$get().STATIC_URL + 'framework/';
22 23
     $provide.constant('horizon.framework.basePath', path);
@@ -32,6 +33,25 @@
32 33
     $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
33 34
     $httpProvider.defaults.headers.common['Content-Type'] = 'application/json;charset=utf-8';
34 35
 
36
+    // NOTE(tsufiev): angular-ui/bootstrap v0.11.2 dropdownToggle directive
37
+    // conflicts with the native Bootstrap data-toggle="dropdown" attribute
38
+    // (see https://github.com/angular-ui/bootstrap/issues/2156).
39
+    // This is fixed in 0.13, but before that it'd be valuable to ensure that
40
+    // the same html markup works the same way with both versions of
41
+    // angular-ui/bootstrap (0.11.2 and 0.13). Could be safely deleted once
42
+    // Horizon migrates to angular-ui/bootstra v0.13
43
+    if ($injector.has('dropdownToggleDirective')) {
44
+      $provide.decorator('dropdownToggleDirective', patchDropdowns);
45
+    }
46
+
47
+    patchDropdowns.$inject = ['$delegate'];
48
+
49
+    function patchDropdowns($delegate) {
50
+      var directive = $delegate[0];
51
+      directive.restrict = 'A';
52
+      return $delegate;
53
+    }
54
+
35 55
     // Global http error handler
36 56
     // if user is not authorized, log user out
37 57
     // this can happen when session expires

+ 1
- 1
horizon/templates/horizon/common/_region_selector.html View File

@@ -1,5 +1,5 @@
1 1
 {% if regions.support %}
2
-  <a href="#" class="dropdown-toggle" role="button" aria-expanded="false">
2
+  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
3 3
     {{ regions.current.name }}
4 4
     <span class="fa fa-caret-down"></span>
5 5
   </a>

+ 2
- 2
openstack_dashboard/templates/_header.html View File

@@ -20,7 +20,7 @@
20 20
     <div class="collapse navbar-collapse" id="navbar-collapse">
21 21
       <ul class="nav navbar-nav">
22 22
         <li class="dropdown">
23
-          <a href="#" class="dropdown-toggle" role="button" aria-expanded="false">
23
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
24 24
             {% show_overview %}
25 25
             <span class="fa fa-caret-down"></span>
26 26
           </a>
@@ -54,7 +54,7 @@
54 54
 
55 55
       <ul class="nav navbar-nav navbar-right">
56 56
         <li class="dropdown">
57
-          <a href="#" class="dropdown-toggle" role="button" aria-expanded="false">
57
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
58 58
             <span class="fa fa-user"></span>
59 59
             {{ request.user.username }}
60 60
             <span class="fa fa-caret-down"></span>

+ 2
- 2
openstack_dashboard/themes/material/templates/_header.html View File

@@ -29,7 +29,7 @@
29 29
     <div class="collapse navbar-collapse" id="navbar-collapse">
30 30
       <ul class="nav navbar-nav">
31 31
         <li class="dropdown">
32
-          <a href="#" class="dropdown-toggle" role="button" aria-expanded="false">
32
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
33 33
             {% show_overview %}
34 34
             <span class="fa fa-caret-down"></span>
35 35
           </a>
@@ -63,7 +63,7 @@
63 63
 
64 64
       <ul class="nav navbar-nav navbar-right">
65 65
         <li class="dropdown">
66
-          <a href="#" class="dropdown-toggle" role="button" aria-expanded="false">
66
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
67 67
             <span class="fa fa-user"></span>
68 68
             {{ request.user.username }}
69 69
             <span class="fa fa-caret-down"></span>

Loading…
Cancel
Save