diff --git a/src/app/dashboard/controllers/dashboard_controller.js b/src/app/dashboard/controllers/dashboard_controller.js new file mode 100644 index 00000000..61851e80 --- /dev/null +++ b/src/app/dashboard/controllers/dashboard_controller.js @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 Hewlett-Packard Development Company, L.P. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/** + * A controller that manages our logged-in dashboard + */ +angular.module('sb.dashboard').controller('DashboardController', + function ($scope, currentUser, Story) { + 'use strict'; + + // Load the list of current assigned stories. + $scope.assignedStories = Story.query({ + assignee_id: currentUser.id, + status: 'active' + }); + }); diff --git a/src/app/dashboard/controllers/home_controller.js b/src/app/dashboard/controllers/home_controller.js index df1be152..a94fe6bf 100644 --- a/src/app/dashboard/controllers/home_controller.js +++ b/src/app/dashboard/controllers/home_controller.js @@ -15,9 +15,14 @@ */ /** - * Controller for our home(index) page, currently just a placeholder. + * Controller for our home(index) page. */ angular.module('sb.dashboard').controller('HomeController', - function () { + function ($state, sessionState, SessionState) { 'use strict'; + + // If we're logged in, go to the dashboard instead. + if (sessionState === SessionState.LOGGED_IN) { + $state.transitionTo('dashboard'); + } }); diff --git a/src/app/dashboard/module.js b/src/app/dashboard/module.js index cc03d149..bdeaed64 100644 --- a/src/app/dashboard/module.js +++ b/src/app/dashboard/module.js @@ -19,7 +19,7 @@ */ angular.module('sb.dashboard', [ 'sb.services', 'sb.templates', 'sb.auth', 'ui.router', 'ui.bootstrap']) - .config(function ($stateProvider) { + .config(function ($stateProvider, SessionResolver) { 'use strict'; // Set an initial home page. @@ -27,6 +27,18 @@ angular.module('sb.dashboard', .state('index', { url: '/', templateUrl: 'app/templates/dashboard/index.html', - controller: 'HomeController' + controller: 'HomeController', + resolve: { + sessionState: SessionResolver.resolveSessionState + } + }) + .state('dashboard', { + url: '/dashboard', + templateUrl: 'app/templates/dashboard/dashboard.html', + controller: 'DashboardController', + resolve: { + sessionState: SessionResolver.requireLoggedIn, + currentUser: SessionResolver.requireCurrentUser + } }); }); diff --git a/src/app/templates/dashboard/dashboard.html b/src/app/templates/dashboard/dashboard.html new file mode 100644 index 00000000..205334e4 --- /dev/null +++ b/src/app/templates/dashboard/dashboard.html @@ -0,0 +1,36 @@ +
Stories assigned to me | + + +|
---|---|
+ |
+
+
+ |
+ + + There are no active stories currently assigned to you. + + | + +