Added luna template and deps
Change-Id: Idd3dcdee3a377a75733c333d4a754632111e17ee
diff --git a/src/app/core/nav/nav.ts b/src/app/core/nav/nav.ts
index 6c6537e..edaeb24 100644
--- a/src/app/core/nav/nav.ts
+++ b/src/app/core/nav/nav.ts
@@ -1,9 +1,12 @@
import './nav.scss';
import {IXosNavigationService, IXosNavigationRoute} from '../services/navigation';
+import {StyleConfig} from '../../config/style.config';
class NavCtrl {
static $inject = ['$scope', '$state', 'NavigationService'];
public routes: IXosNavigationRoute[];
+ public navSelected: string;
+ public appName: string;
constructor(
private $scope: ng.IScope,
@@ -18,14 +21,38 @@
this.$scope.$watch(() => this.navigationService.query(), (routes) => {
this.routes = routes;
});
- }
-
- isRouteActive(route: IXosNavigationRoute) {
- return this.$state.current.url === route.url ? 'active' : '';
+ this.appName = StyleConfig.projectName;
}
activateRoute(route: IXosNavigationRoute) {
- route.opened = !route.opened;
+ this.navSelected = route.state;
+ }
+
+ includes(state: string): boolean {
+ return this.$state.includes(state);
+ }
+
+ isSelected(navId: string, navSelected: string) {
+
+ // TODO activate only one state
+
+ const activeRoute = this.$state.current.name;
+ const separateRoutes = activeRoute.split('.');
+
+ if (!navSelected) {
+ navSelected = separateRoutes[1];
+ }
+
+ if (navId === navSelected) {
+ return false;
+ }
+ else if (this.$state.current.name.indexOf(navId) === -1 && navId === navSelected ) {
+ return false;
+ }
+ else {
+ return true;
+ }
+
}
}