ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject ambari git commit: AMBARI-9010 Nav bar dropdown does not highlight appropriate section (salvi via jaoki)
Date Fri, 16 Jan 2015 00:21:29 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c7528452c -> ad0d0b094


AMBARI-9010 Nav bar dropdown does not highlight appropriate section (salvi via jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ad0d0b09
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ad0d0b09
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ad0d0b09

Branch: refs/heads/trunk
Commit: ad0d0b094798b8cc143f7e369896b5e4803bfeac
Parents: c752845
Author: Jun Aoki <jaoki@apache.org>
Authored: Thu Jan 15 16:21:21 2015 -0800
Committer: Jun Aoki <jaoki@apache.org>
Committed: Thu Jan 15 16:21:21 2015 -0800

----------------------------------------------------------------------
 ambari-web/app/templates/main/menu_item.hbs |  4 +++-
 ambari-web/app/views/main/menu.js           | 28 +++++++++++++++++-------
 2 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad0d0b09/ambari-web/app/templates/main/menu_item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/menu_item.hbs b/ambari-web/app/templates/main/menu_item.hbs
index a135f9e..769ff7e 100644
--- a/ambari-web/app/templates/main/menu_item.hbs
+++ b/ambari-web/app/templates/main/menu_item.hbs
@@ -33,7 +33,9 @@
 {{#if view.isAdminItem}}
   <ul class="top-nav-dropdown-menu">
     {{#each category in view.dropdownCategories}}
-        <li><a href="#" {{action "goToCategory" category.url target="view"}}>{{category.label}}</a></li>
+      {{#view view.AdminDropdownItemView itemBinding="category.name" }}
+        <a href="#" {{action "goToCategory" category.url target="view"}}>{{category.label}}</a>
+      {{/view}}
     {{/each}}
   </ul>
 {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad0d0b09/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 205fe96..0108a12 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -105,13 +105,9 @@ App.MainMenuView = Em.CollectionView.extend({
       }
       App.router.route('main/' + event.context);
     },
-    goToCategory: function (event) {
-      var itemName = this.get('content').routing;
-      // route to correct category of current menu item
-      if (itemName == 'admin') {
-        App.router.route('main/admin/' + event.context);
-      }
-    },
+
+    selectedAdminItemBinding: 'App.router.mainAdminController.category',
+
     dropdownCategories: function () {
       var itemName = this.get('content').routing;
       var categories = [];
@@ -145,6 +141,22 @@ App.MainMenuView = Em.CollectionView.extend({
         }
       }
       return categories;
-    }.property('')
+    }.property(''),
+
+    AdminDropdownItemView: Ember.View.extend({
+      tagName: 'li',
+      classNameBindings: 'isActive:active'.w(),
+      isActive: function () {
+        return this.get('item').toLowerCase().contains(this.get('parentView.selectedAdminItem').toLowerCase());
+      }.property('item', 'parentView.selectedAdminItem'),
+
+      goToCategory: function (event) {
+        var itemName = this.get('parentView').get('content').routing;
+        // route to correct category of current menu item
+        if (itemName == 'admin') {
+          App.router.route('main/admin/' + event.context);
+        }
+      }
+    })
   })
 });


Mime
View raw message