[Groonga-commit] groonga/gcs [ember] Move Home link into the nav list box

Back to archive index

Yoji SHIDARA null+****@clear*****
Tue Oct 2 04:10:48 JST 2012


Yoji SHIDARA	2012-10-02 04:10:48 +0900 (Tue, 02 Oct 2012)

  New Revision: 9af0e6934befc5b16d7c25d744c5821f70e6c9be
  https://github.com/groonga/gcs/commit/9af0e6934befc5b16d7c25d744c5821f70e6c9be

  Log:
    Move Home link into the nav list box

  Modified files:
    public/js/gcs/router.js
    public/js/gcs/views.js
    views/index.jade

  Modified: public/js/gcs/router.js (+3 -3)
===================================================================
--- public/js/gcs/router.js    2012-10-02 03:53:23 +0900 (37e5e79)
+++ public/js/gcs/router.js    2012-10-02 04:10:48 +0900 (5e9c48b)
@@ -7,7 +7,7 @@ App.Router = Ember.Router.extend({
       route: '/',
       connectOutlets: function(router, context) {
         var applicationController = router.get('applicationController');
-        applicationController.set('selected', null);
+        applicationController.set('selected', ['Home']);
         applicationController.connectOutlet('index');
       }
     }),
@@ -37,7 +37,7 @@ App.Router = Ember.Router.extend({
           var domainController = router.get('domainController');
           var domain = domainController.get('content');
           domainController.set('selectedAction', 'About');
-          applicationController.set('selected', domain.get('name'));
+          applicationController.set('selected', ['Domain', domain.get('name')]);
           domainController.connectOutlet('domainShow', domain);
         }
       }),
@@ -50,7 +50,7 @@ App.Router = Ember.Router.extend({
           var domainSearchController = router.get('domainSearchController');
           domainController.set('selectedAction', 'Search');
           domainSearchController.set('domain', domain);
-          applicationController.set('selected', domain.get('name'));
+          applicationController.set('selected', ['Domain', domain.get('name')]);
           domainSearchController.set('query', null);
           domainSearchController.reset();
           domainController.connectOutlet('domainSearch');

  Modified: public/js/gcs/views.js (+4 -2)
===================================================================
--- public/js/gcs/views.js    2012-10-02 03:53:23 +0900 (3bc085d)
+++ public/js/gcs/views.js    2012-10-02 04:10:48 +0900 (7aa6e21)
@@ -6,8 +6,10 @@ App.ApplicationView = Ember.View.extend({
     tagName: 'li',
     classNameBindings: 'isActive:active'.w(),
     isActive: function() {
-      return this.get('item') === this.get('parentView.selected');
-    }.property('item', 'parentView.selected')
+      var thisKey = [this.get('section'), this.get('item')||null].compact();
+      var selectedKey = this.get('parentView.selected');
+      return JSON.stringify(thisKey) === JSON.stringify(selectedKey);
+    }.property('section', 'item', 'parentView.selected')
   })
 });
 

  Modified: views/index.jade (+4 -3)
===================================================================
--- views/index.jade    2012-10-02 03:53:23 +0900 (76abf1c)
+++ views/index.jade    2012-10-02 04:10:48 +0900 (47d2d5f)
@@ -20,16 +20,17 @@ html
         .navbar-inner
           .container
             <a class="brand" href {{action showIndex}}>Groonga CloudSearch</a>
-            ul.nav
-              li <a href {{action showIndex}}>Home</a>
       .container
         .row
           .span2
             .well(style="padding: 10px 0 10px 0;")
               ul.nav.nav-list
+                {{#view view.NavItemView section="Home" item=null}}
+                <a href {{action showIndex this}}>Home</a>
+                {{/view}}
                 li.nav-header Domains
                 {{#each App.domains}}
-                {{#view view.NavItemView itemBinding="name"}}
+                {{#view view.NavItemView section="Domain" itemBinding="name"}}
                 <a href {{action showDomain this}}>{{name}}</a>
                 {{/view}}
                 {{/each}}
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index