Commit 0b8d7cf4b3d42c5b9c4c1093f9f7166aebcfeb64
1 parent
1bcf4c991f
Exists in
master
and in
1 other branch
Moving towards a single page app
Showing 4 changed files with 113 additions and 110 deletions Side-by-side Diff
controller.js
View file @
0b8d7cf
1 | -var app = angular.module('flashy.controller', ['ui.router']); | |
1 | +var app = angular.module('flashy.controller', ['ui.router']).config(function ($locationProvider) { | |
2 | + $locationProvider.html5Mode(true); | |
3 | +}); | |
2 | 4 | |
3 | 5 | |
4 | 6 | app.controller('HomeController', ['$scope', '$state', function ($scope, $state) { |
5 | 7 | |
... | ... | @@ -6,9 +8,14 @@ |
6 | 8 | // SIGN UP |
7 | 9 | $scope.signUp = function (email, username, password) { |
8 | 10 | |
9 | - | |
10 | 11 | // make server call |
11 | 12 | console.log('go to dashboard'); |
13 | + $.post('https://flashy.cards/api/users/me', | |
14 | + {"email": email, "password": password}, | |
15 | + function (data, textStatus, jqXHR) { | |
16 | + console.log(data); | |
17 | + } | |
18 | + ); | |
12 | 19 | |
13 | 20 | // if successful, go to dashboard |
14 | 21 | $state.go('dashboard'); |
15 | 22 | |
16 | 23 | |
17 | 24 | |
18 | 25 | |
19 | 26 | |
20 | 27 | |
21 | 28 | |
22 | 29 | |
... | ... | @@ -17,26 +24,28 @@ |
17 | 24 | |
18 | 25 | |
19 | 26 | // LOGIN |
20 | - $scope.login = function (emailOrUsername, password) { | |
27 | + $scope.login = function (email, password) { | |
21 | 28 | |
22 | - console.log('LOGGING IN'); | |
29 | + console.log('go to dashboard'); | |
30 | + $.post('https://flashy.cards/api/login', | |
31 | + {"email": email, "password": password}, | |
32 | + function (data, textStatus, jqXHR) { | |
33 | + console.log(data); | |
34 | + } | |
35 | + ); | |
23 | 36 | |
24 | - // make server call | |
37 | + $state.go('dashboard'); | |
25 | 38 | |
26 | 39 | |
27 | - // if successful, go to dashboard | |
28 | - | |
29 | - | |
30 | 40 | }; |
31 | 41 | |
32 | - | |
33 | 42 | |
34 | -}]) | |
43 | +}]); | |
35 | 44 | |
36 | 45 | app.controller("DashboardController", function () { |
46 | + // This gets really annoying every time I refresh the page :( | |
47 | + //alert("HEYYYYYY"); | |
37 | 48 | |
38 | - alert("HEYYYYYY"); | |
39 | 49 | |
40 | - | |
41 | -}) | |
50 | +}); |
home.html
View file @
0b8d7cf
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html ng-app="flashy"> |
3 | - <base href="/app/"> | |
4 | - <head> | |
5 | - <link rel = "stylesheet" href ="styles/bootstrap-3.3.4-dist/css/bootstrap.css" /> | |
6 | - <link rel ="stylesheet" href="flashy.css" /> | |
7 | - </head> | |
3 | +<base href="/app/"> | |
4 | +<head> | |
5 | + <link rel="stylesheet" href="styles/bootstrap-3.3.4-dist/css/bootstrap.css"/> | |
6 | + <link rel="stylesheet" href="flashy.css"/> | |
7 | +</head> | |
8 | 8 | |
9 | - <body ng-controller="HomeController"> | |
10 | - <!-- MENU BAR --> | |
11 | - <nav class="navbar navbar-default"> | |
12 | - <div class="container-fluid"> | |
13 | - <button type="button" class="navbar-toggle collapsed" | |
14 | - data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
15 | - <span class="sr-only">Toggle navigation</span> | |
16 | - <span class="icon-bar"></span> | |
17 | - <span class="icon-bar"></span> | |
18 | - <span class="icon-bar"></span> | |
19 | - </button> | |
20 | - <a class="navbar-brand" href="#">Flashy</a> | |
21 | - </div> | |
22 | - </nav> | |
9 | +<body ng-controller="HomeController"> | |
23 | 10 | |
24 | - <div class="container"> | |
25 | - <h1 class="text-success heading">Create and share flashcards in real time!</h1> | |
26 | - <blockquote class="pull-left"> | |
11 | +<!-- MENU BAR --> | |
12 | +<nav class="navbar navbar-default"> | |
13 | + <div class="container-fluid"> | |
14 | + <button type="button" class="navbar-toggle collapsed" | |
15 | + data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
16 | + <span class="sr-only">Toggle navigation</span> | |
17 | + <span class="icon-bar"></span> | |
18 | + <span class="icon-bar"></span> | |
19 | + <span class="icon-bar"></span> | |
20 | + </button> | |
21 | + <a class="navbar-brand" href="#">Flashy</a> | |
22 | + </div> | |
23 | +</nav> | |
24 | +<ui-view> | |
25 | + <div class="container"> | |
26 | + <h1 class="text-success heading">Create and share flashcards in real time!</h1> | |
27 | + <blockquote class="pull-left"> | |
27 | 28 | <p>The System shall enlighten you.</p> |
28 | 29 | <small>SWAG</small> |
29 | - </blockquote> | |
30 | + </blockquote> | |
31 | + </div> | |
32 | + | |
33 | + <div class="container"> | |
34 | + <!-- REGISTRATION TABS --> | |
35 | + <div class="tabbable"> | |
36 | + <ul class="nav nav-tabs"> | |
37 | + <li role="presentation" class="active"><a href="" | |
38 | + data-toggle="tab">SIGN UP</a></li> | |
39 | + <li role="presentation"><a href="login" data-toggle="tab">LOGIN</a></li> | |
40 | + </ul> | |
30 | 41 | </div> |
31 | 42 | |
32 | - <div class="container"> | |
33 | - <!-- REGISTRATION TABS --> | |
34 | - <div class="tabbable"> | |
35 | - <ul class="nav nav-tabs"> | |
36 | - <li role="presentation" class="active"><a href="#tab1" | |
37 | - data-toggle="tab">SIGN UP</a></li> | |
38 | - <li role="presentation"><a href="#tab2" data-toggle="tab">LOGIN</a></li> | |
39 | - </ul> | |
43 | + <!-- REGISTRATION TAB PANES --> | |
44 | + <div class="tab-content"> | |
45 | + <!-- SIGN UP FORM --> | |
46 | + <div class="tab-pane active myform" id="tab1"> | |
47 | + <form> | |
48 | + <div class="form-group"> | |
49 | + <input type="email" class="form-control" ng-model="signUpEmail" placeholder="Email"/> | |
50 | + </div> | |
51 | + | |
52 | + <div class="form-group"> | |
53 | + <input type="password" class="form-control" ng-model="signUpPassword" placeholder="Password"/> | |
54 | + </div> | |
55 | + <input type="submit" class="btn btn-primary" ng-click="signUp(signUpEmail,signUpPassword)" | |
56 | + value="GET STARTED!"/> | |
57 | + </form> | |
40 | 58 | </div> |
41 | - | |
42 | - <!-- REGISTRATION TAB PANES --> | |
43 | - <div class="tab-content"> | |
44 | - <!-- SIGN UP FORM --> | |
45 | - <div class="tab-pane active myform" id="tab1"> | |
46 | - <form> | |
47 | - <div class="form-group"> | |
48 | - <input type="email" class="form-control" ng-model="signUpEmail" placeholder="Email" /> | |
49 | - </div> | |
50 | - | |
51 | - <div class="form-group"> | |
52 | - <input type="text" class="form-control" ng-model="signUpUsername" placeholder="Username" /> | |
53 | - </div> | |
54 | - | |
55 | - <div class="form-group"> | |
56 | - <input type="password" class="form-control" ng-model="signUpPassword" placeholder="Password" /> | |
57 | - </div> | |
58 | - <input type="submit" class="btn btn-primary" ng-click="signUp(signUpEmail, signUpUsername, signUpPassword)" value="GET STARTED!" /> | |
59 | - </form> | |
60 | - </div> | |
61 | - | |
62 | - <!-- LOGIN FORM --> | |
63 | - <div class="tab-pane myform" id="tab2"> | |
64 | - <form> | |
65 | - <div class="form-group"> | |
66 | - <input type="email" class="form-control" ng-model="loginEmailOrUsername" placeholder="Email or username" /> | |
67 | - </div> | |
68 | - <div class="form-group"> | |
69 | - <input type="password" class="form-control" ng-model="loginPassword" placeholder="Password" /> | |
70 | - </div> | |
71 | - <input type="submit" class="btn btn-primary" ng-click="login(loginEmailOrUsername, loginPassword)" value="LOGIN" /> | |
72 | - </form> | |
73 | - </div> | |
59 | + | |
60 | + <!-- LOGIN FORM --> | |
61 | + <div class="tab-pane myform" id="tab2"> | |
62 | + <form> | |
63 | + <div class="form-group"> | |
64 | + <input type="email" class="form-control" ng-model="loginEmail" placeholder="Email"/> | |
65 | + </div> | |
66 | + <div class="form-group"> | |
67 | + <input type="password" class="form-control" ng-model="loginPassword" placeholder="Password"/> | |
68 | + </div> | |
69 | + <input type="submit" class="btn btn-primary" ng-click="login(loginEmail, loginPassword)" | |
70 | + value="LOGIN"/> | |
71 | + </form> | |
74 | 72 | </div> |
75 | 73 | </div> |
74 | + </div> | |
75 | +</ui-view> | |
76 | +<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> | |
77 | +<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.js"></script> | |
78 | +<script src="config.js"></script> | |
79 | +<script src="controller.js"></script> | |
76 | 80 | |
77 | - <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> | |
78 | - <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.js"></script> | |
79 | - <script src="config.js"></script> | |
80 | - <script src="controller.js"></script> | |
81 | +<script src="scripts/jquery-2.1.3.min.js"></script> | |
82 | +<script src="scripts/bootstrap.js"></script> | |
81 | 83 | |
82 | - <script src="scripts/jquery-2.1.3.min.js"></script> | |
83 | - <script src="scripts/bootstrap.js"></script> | |
84 | - | |
85 | - </body> | |
84 | +</body> | |
86 | 85 | </html> |
templates/dashboard.html
View file @
0b8d7cf
1 | -<!DOCTYPE html> | |
2 | - | |
3 | -<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
4 | - <base href="/app/"> | |
5 | - <head> | |
6 | - <link rel = "stylesheet" href ="styles/bootstrap-3.3.4-dist/css/bootstrap.css" /> | |
7 | - <link rel ="stylesheet" href="flashy.css" /> | |
8 | - </head> | |
9 | - | |
10 | - <body> | |
11 | - <nav class="navbar navbar-default"> | |
12 | - <a class="navbar-brand" href="#">Flashy</a> | |
13 | - </nav> | |
14 | - | |
15 | - Add a class lol | |
16 | - </body> | |
17 | -</html> | |
1 | +<div class="sidebar"> | |
2 | + <ul> | |
3 | + <li>CSE 110</li> | |
4 | + </ul> | |
5 | +</div> |
templates/feed.html
View file @
0b8d7cf
1 | 1 | <!DOCTYPE html> |
2 | -<html> | |
3 | -<head lang="en"> | |
4 | - <meta charset="UTF-8"> | |
5 | - <title></title> | |
6 | -</head> | |
7 | -<body> | |
8 | 2 | |
9 | -</body> | |
3 | +<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
4 | + <base href="/app/"> | |
5 | + <head> | |
6 | + <link rel = "stylesheet" href ="styles/bootstrap-3.3.4-dist/css/bootstrap.css" /> | |
7 | + <link rel ="stylesheet" href="styles/feed.css" /> | |
8 | + </head> | |
9 | + | |
10 | + <body> | |
11 | + <nav class="navbar navbar-default"> | |
12 | + <a class="navbar-brand" href="#">Flashy</a> | |
13 | + </nav> | |
14 | + | |
15 | + Add a class lol | |
16 | + </body> | |
10 | 17 | </html> |