From c6e5956665c43a56a4190e52e8c60905646c4084 Mon Sep 17 00:00:00 2001 From: Jasmine Woo Date: Sun, 20 Mar 2016 17:05:51 -0600 Subject: [PATCH] Correct routing for other modules, renamed settings to groups --- app/analysis/analysis.html | 22 ++++++++++++++++ app/analysis/analysis.js | 25 +++++++++++++++++++ app/app.js | 4 +++ app/display/display.html | 22 ++++++++++++++++ app/display/display.js | 25 +++++++++++++++++++ app/groups/groups.html | 22 ++++++++++++++++ app/groups/groups.js | 25 +++++++++++++++++++ .../settings.html => groups/groupsHandler.js} | 0 app/homepage/home.html | 8 +++--- app/homepage/home.js | 12 +++++++++ app/index.html | 8 ++++++ app/search/search.html | 22 ++++++++++++++++ app/search/search.js | 23 +++++++++++++++++ app/settings/settings.js | 0 app/settings/settingsHandler.js | 0 15 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 app/groups/groups.html create mode 100644 app/groups/groups.js rename app/{settings/settings.html => groups/groupsHandler.js} (100%) delete mode 100644 app/settings/settings.js delete mode 100644 app/settings/settingsHandler.js diff --git a/app/analysis/analysis.html b/app/analysis/analysis.html index e69de29..a8aefbb 100644 --- a/app/analysis/analysis.html +++ b/app/analysis/analysis.html @@ -0,0 +1,22 @@ + + + + + + Cmput391 + + + + + + + + + + + +

Analysis

+ + + + diff --git a/app/analysis/analysis.js b/app/analysis/analysis.js index e69de29..278d0b7 100644 --- a/app/analysis/analysis.js +++ b/app/analysis/analysis.js @@ -0,0 +1,25 @@ +angular.module("myApp.analysis", ["ngRoute", "LocalStorageModule"]) + +.config(["$routeProvider", function($routeProvider) { + $routeProvider.when("/analysis", { + templateUrl: "analysis/analysis.html", + controller: "analysisController" + }); +}]) + +.controller("analysisController", function($scope, $location, localStorageService) { + var usernameFromStorage, + storageKey = "user"; + + function getItem(key) { + return localStorageService.get(key); + }; + + if(!getItem(storageKey)){ + //User has not logged in yet so redirect to login + $location.url("/login"); + } + + + +}); diff --git a/app/app.js b/app/app.js index d261041..28bff09 100644 --- a/app/app.js +++ b/app/app.js @@ -4,6 +4,10 @@ angular.module("myApp", [ "LocalStorageModule", "myApp.login", "myApp.register", + "myApp.display", + "myApp.groups", + "myApp.analysis", + "myApp.search", "myApp.home" ]). config(["$routeProvider", function($routeProvider) { diff --git a/app/display/display.html b/app/display/display.html index e69de29..bb772af 100644 --- a/app/display/display.html +++ b/app/display/display.html @@ -0,0 +1,22 @@ + + + + + + Cmput391 + + + + + + + + + + + +

Display

+ + + + diff --git a/app/display/display.js b/app/display/display.js index e69de29..7e1227e 100644 --- a/app/display/display.js +++ b/app/display/display.js @@ -0,0 +1,25 @@ +angular.module("myApp.display", ["ngRoute", "LocalStorageModule"]) + +.config(["$routeProvider", function($routeProvider) { + $routeProvider.when("/display", { + templateUrl: "display/display.html", + controller: "displayController" + }); +}]) + +.controller("displayController", function($scope, $location, localStorageService) { + var usernameFromStorage, + storageKey = "user"; + + function getItem(key) { + return localStorageService.get(key); + }; + + if(!getItem(storageKey)){ + //User has not logged in yet so redirect to login + $location.url("/login"); + } + + + +}); diff --git a/app/groups/groups.html b/app/groups/groups.html new file mode 100644 index 0000000..65cdd7e --- /dev/null +++ b/app/groups/groups.html @@ -0,0 +1,22 @@ + + + + + + Cmput391 + + + + + + + + + + + +

Groups

+ + + + diff --git a/app/groups/groups.js b/app/groups/groups.js new file mode 100644 index 0000000..a1f6eeb --- /dev/null +++ b/app/groups/groups.js @@ -0,0 +1,25 @@ +angular.module("myApp.groups", ["ngRoute", "LocalStorageModule"]) + +.config(["$routeProvider", function($routeProvider) { + $routeProvider.when("/groups", { + templateUrl: "groups/groups.html", + controller: "groupsController" + }); +}]) + +.controller("groupsController", function($scope, $location, localStorageService) { + var usernameFromStorage, + storageKey = "user"; + + function getItem(key) { + return localStorageService.get(key); + }; + + if(!getItem(storageKey)){ + //User has not logged in yet so redirect to login + $location.url("/login"); + } + + + +}); diff --git a/app/settings/settings.html b/app/groups/groupsHandler.js similarity index 100% rename from app/settings/settings.html rename to app/groups/groupsHandler.js diff --git a/app/homepage/home.html b/app/homepage/home.html index 274ccdd..f438231 100644 --- a/app/homepage/home.html +++ b/app/homepage/home.html @@ -18,10 +18,10 @@

Homepage

- - - - + + + +
diff --git a/app/homepage/home.js b/app/homepage/home.js index 02a548a..368aca9 100644 --- a/app/homepage/home.js +++ b/app/homepage/home.js @@ -20,6 +20,18 @@ angular.module("myApp.home", ["ngRoute", "LocalStorageModule"]) $location.url("/login"); } + $scope.groups = function() { + $location.url("/groups"); + }; + $scope.display = function() { + $location.url("/display"); + }; + $scope.search = function() { + $location.url("/search"); + }; + $scope.analysis = function() { + $location.url("/analysis"); + }; }); diff --git a/app/index.html b/app/index.html index a1f1871..a25a64e 100644 --- a/app/index.html +++ b/app/index.html @@ -24,5 +24,13 @@ + + + + + + + + diff --git a/app/search/search.html b/app/search/search.html index e69de29..bf8394f 100644 --- a/app/search/search.html +++ b/app/search/search.html @@ -0,0 +1,22 @@ + + + + + + Cmput391 + + + + + + + + + + + +

Search

+ + + + diff --git a/app/search/search.js b/app/search/search.js index e69de29..43cf153 100644 --- a/app/search/search.js +++ b/app/search/search.js @@ -0,0 +1,23 @@ +angular.module("myApp.search", ["ngRoute", "LocalStorageModule"]) + +.config(["$routeProvider", function($routeProvider) { + $routeProvider.when("/search", { + templateUrl: "search/search.html", + controller: "searchController" + }); +}]) + +.controller("searchController", function($scope, $location, localStorageService) { + var usernameFromStorage, + storageKey = "user"; + + function getItem(key) { + return localStorageService.get(key); + }; + + if(!getItem(storageKey)){ + //User has not logged in yet so redirect to login + $location.url("/login"); + } + +}); diff --git a/app/settings/settings.js b/app/settings/settings.js deleted file mode 100644 index e69de29..0000000 diff --git a/app/settings/settingsHandler.js b/app/settings/settingsHandler.js deleted file mode 100644 index e69de29..0000000