|
@@ -71,25 +71,26 @@ App.MainMenuView = Em.CollectionView.extend({
|
|
* Adds observer on lastSetURL and calls navigation sync procedure
|
|
* Adds observer on lastSetURL and calls navigation sync procedure
|
|
*/
|
|
*/
|
|
didInsertElement:function () {
|
|
didInsertElement:function () {
|
|
- App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');
|
|
|
|
this.renderOnRoute();
|
|
this.renderOnRoute();
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* Syncs navigation menu with requested URL
|
|
* Syncs navigation menu with requested URL
|
|
*/
|
|
*/
|
|
- renderOnRoute:function () {
|
|
|
|
- var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
|
|
|
|
- if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
|
|
|
|
- return;
|
|
|
|
|
|
+ renderOnRoute: function () {
|
|
|
|
+ if (App.router.get('clusterController.isLoaded')) {
|
|
|
|
+ var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
|
|
|
|
+ if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var reg = /^\/main\/([a-z]+)/g;
|
|
|
|
+ var sub_url = reg.exec(last_url);
|
|
|
|
+ var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';
|
|
|
|
+ $.each(this._childViews, function () {
|
|
|
|
+ this.set('active', this.get('content.routing') == chunk ? "active" : "");
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- var reg = /^\/main\/([a-z]+)/g;
|
|
|
|
- var sub_url = reg.exec(last_url);
|
|
|
|
- var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';
|
|
|
|
- $.each(this._childViews, function () {
|
|
|
|
- this.set('active', this.get('content.routing') == chunk ? "active" : "");
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ }.observes('App.router.location.lastSetURL', 'App.router.clusterController.isLoaded'),
|
|
|
|
|
|
itemViewClass:Em.View.extend({
|
|
itemViewClass:Em.View.extend({
|
|
|
|
|