Routing to dashboard by default

This commit is contained in:
Frédéric Vachon 2015-04-30 11:45:22 -04:00
parent 91c5f0dc3f
commit 0d49eb7a00
4 changed files with 8 additions and 7 deletions

View File

@ -29,7 +29,7 @@ angular.module('bansho', [
]) ])
.config(['$routeProvider', function ($routeProvider) { .config(['$routeProvider', function ($routeProvider) {
$routeProvider.otherwise({redirectTo: '/'}); $routeProvider.otherwise({redirectTo: '/view'});
}]) }])
// Reinitialise objects on url change // Reinitialise objects on url change

View File

@ -22,7 +22,7 @@
</button> </button>
<ul class="sidebar__sublist collapse in" id="shortcutList"> <ul class="sidebar__sublist collapse in" id="shortcutList">
<li class="sidebar__subitem"><a ng-class="getClass('/view?view=dashboardConfig')" href="#/view?view=dashboardConfig">Dashboard</a></li> <li class="sidebar__subitem"><a ng-class="getClass('/view')" href="#/view">Dashboard</a></li>
<li class="sidebar__subitem"><a ng-class="getClass('/view?view=hostsConfig')" href="#/view?view=hostsConfig">Hosts</a></li> <li class="sidebar__subitem"><a ng-class="getClass('/view?view=hostsConfig')" href="#/view?view=hostsConfig">Hosts</a></li>
<li class="sidebar__subitem"><a ng-class="getClass('/view?view=servicesConfig')" href="#/view?view=servicesConfig">Services</a></li> <li class="sidebar__subitem"><a ng-class="getClass('/view?view=servicesConfig')" href="#/view?view=servicesConfig">Services</a></li>
<li class="sidebar__subitem"><a href="#">Networks parents</a></li> <li class="sidebar__subitem"><a href="#">Networks parents</a></li>

View File

@ -6,7 +6,7 @@ angular.module('bansho.sidebar', [])
$scope.getClass = function (path) { $scope.getClass = function (path) {
var class_name = ""; var class_name = "";
if ($location.url().substr(0, path.length) === path) { if ($location.url() === path) {
class_name = "state--current"; class_name = "state--current";
} }

View File

@ -15,16 +15,17 @@ angular.module('bansho.view', ['ngRoute',
.controller('ViewCtrl', ['$scope', '$routeParams', 'viewsTemplate', .controller('ViewCtrl', ['$scope', '$routeParams', 'viewsTemplate',
function ($scope, $routeParams, viewsTemplate) { function ($scope, $routeParams, viewsTemplate) {
var templateName = viewsTemplate[$routeParams.view], var templateName,
templateUrl = 'templates/' + templateName + '/' + templateName + '.html'; templateUrl;
if (!!$routeParams.view) { if (!!$routeParams.view) {
$scope.viewName = $routeParams.view; $scope.viewName = $routeParams.view;
} else { } else {
throw new Error("ERROR : 'view' GET parameter must be the custom view name"); $scope.viewName = $routeParams.view = 'dashboardConfig';
} }
$scope.templateUrl = templateUrl; templateName = viewsTemplate[$scope.viewName],
$scope.templateUrl = 'templates/' + templateName + '/' + templateName + '.html';
}]) }])
.run(['readConfig', 'viewsTemplate', function (readConfig, viewsTemplate) { .run(['readConfig', 'viewsTemplate', function (readConfig, viewsTemplate) {