Commit b485ee35d5fbc20360258c1ee5711696bb0d5605
1 parent
35387f3081
Exists in
master
and in
1 other branch
more tweaks
Showing 5 changed files with 43 additions and 44 deletions Side-by-side Diff
home.html
View file @
b485ee3
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | <header> |
17 | 17 | <nav> |
18 | 18 | <div class="nav-wrapper"> |
19 | - <a ng-show="user" href="#" data-activates="mobile-demo" class="left button-collapse hide-on-med-and-up"><i | |
19 | + <a ng-show="UserService.isLoggedIn()" href="#" data-activates="mobile-demo" class="left button-collapse hide-on-med-and-up"><i | |
20 | 20 | class="mdi-navigation-menu"></i></a> |
21 | 21 | <ul ng-show="currentSection.id && UserService.isLoggedIn()" class="left hide-on-small-and-down"> |
22 | 22 | <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" class="tooltipped" |
... | ... | @@ -50,8 +50,8 @@ |
50 | 50 | </ul> |
51 | 51 | |
52 | 52 | <!-- Slide-in side-nav for small screens --> |
53 | - <ul class="side-nav" id="mobile-demo"> | |
54 | - <span ng-show="currentSection.id && UserService.isLoggedIn()"> | |
53 | + <ul ng-show="UserService.isLoggedIn()" class="side-nav" id="mobile-demo"> | |
54 | + <span ng-show="currentSection.id"> | |
55 | 55 | <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" class="tooltipped" |
56 | 56 | ><i |
57 | 57 | class="mdi-action-view-module left"></i>Feed</a></li> |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | </li> |
75 | 75 | <div class="collapsible-body" style="display: block"> |
76 | 76 | <ul> |
77 | - <li ui-sref-active="active" ng-repeat="section in sections"> | |
77 | + <li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections"> | |
78 | 78 | <a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a> |
79 | 79 | </li> |
80 | 80 | <hr> |
scripts/LoginController.js
View file @
b485ee3
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | 'password': password |
14 | 14 | })). |
15 | 15 | success(function(data) { |
16 | - UserService.setUserData(data); | |
16 | + UserService.login(data); | |
17 | 17 | if (angular.isDefined($scope.returnToState)) |
18 | 18 | $state.go($scope.returnToState.name, $scope.returnToStateParams); |
19 | 19 | else $state.go('addclass'); |
scripts/UserService.js
View file @
b485ee3
... | ... | @@ -9,7 +9,8 @@ |
9 | 9 | }).error(function(data) { |
10 | 10 | console.log(data); |
11 | 11 | console.log('not logged in yet: ' + data.detail); |
12 | - deferred.resolve({email: false}); | |
12 | + _user = {email:false}; | |
13 | + deferred.resolve(_user); | |
13 | 14 | }); |
14 | 15 | |
15 | 16 | this.isResolved = function() { |
... | ... | @@ -19,7 +20,7 @@ |
19 | 20 | if (this.isResolved()) return _user; |
20 | 21 | else return deferred.promise; |
21 | 22 | }; |
22 | - this.setUserData = function(data) { | |
23 | + this.login = function(data) { | |
23 | 24 | _user = data; |
24 | 25 | deferred.resolve(data); |
25 | 26 | }; |
templates/addclass.html
View file @
b485ee3
1 | -<div class=""> | |
2 | - <div class="row" style="margin-top:64px;"> | |
3 | - <div class="offset-m2 col m8"> | |
4 | - <h2 class="header">Add a class</h2> | |
5 | - <md-content layout-padding="" layout="column" style="overflow:hidden"> | |
1 | +<div class="" style="margin-top:32px;"> | |
2 | + <div class="row" style="max-width:800px; width:90%; min-width:512px; margin: 0 auto"> | |
3 | + <h2 class="header">Add a class</h2> | |
4 | + <md-content layout-padding="" layout="column" style="overflow:hidden"> | |
6 | 5 | |
7 | - <form ng-submit="$event.preventDefault()"> | |
8 | - <div layout="row"> | |
9 | - <md-autocomplete flex="" | |
10 | - md-autofocus="true" | |
11 | - md-selected-item="selectedItem" | |
12 | - md-search-text="searchText" | |
13 | - md-items="item in trySearch(searchText)" | |
14 | - md-item-text="item.short_name" | |
15 | - md-selected-item-change="selectObject(event)" | |
16 | - md-autoselect="true" | |
17 | - > | |
18 | - <md-item-template> | |
19 | - <div layout="row"> | |
20 | - <div>{{item.short_name}}: {{item.course_title}} | |
21 | - ({{item.instructor}}) | |
22 | - </div> | |
23 | - <div style="margin-left:auto;text-align:right;padding-left:30px"> | |
24 | - {{item.lecture_times}} | |
25 | - </div> | |
6 | + <form ng-submit="$event.preventDefault()"> | |
7 | + <div layout="row"> | |
8 | + <md-autocomplete flex="" | |
9 | + md-autofocus="true" | |
10 | + md-selected-item="selectedItem" | |
11 | + md-search-text="searchText" | |
12 | + md-items="item in trySearch(searchText)" | |
13 | + md-item-text="item.short_name" | |
14 | + md-selected-item-change="selectObject(event)" | |
15 | + md-autoselect="true" | |
16 | + > | |
17 | + <md-item-template> | |
18 | + <div layout="row"> | |
19 | + <div>{{item.short_name}}: {{item.course_title}} | |
20 | + ({{item.instructor}}) | |
26 | 21 | </div> |
27 | - </md-item-template> | |
28 | - <md-not-found> | |
29 | - No classes match "{{searchText}}". | |
30 | - </md-not-found> | |
31 | - </md-autocomplete> | |
32 | - <button class="btn waves-effect waves-light" type="submit" name="add" ng-click="submit()">Add | |
33 | - <i class="mdi-content-add right"></i> | |
34 | - </button> | |
35 | - </div> | |
22 | + <div style="margin-left:auto;text-align:right;padding-left:30px"> | |
23 | + {{item.lecture_times}} | |
24 | + </div> | |
25 | + </div> | |
26 | + </md-item-template> | |
27 | + <md-not-found> | |
28 | + No classes match "{{searchText}}". | |
29 | + </md-not-found> | |
30 | + </md-autocomplete> | |
31 | + <button class="btn waves-effect waves-light" type="submit" name="add" ng-click="submit()">Add | |
32 | + <i class="mdi-content-add right"></i> | |
33 | + </button> | |
34 | + </div> | |
36 | 35 | |
37 | - </form> | |
38 | - </md-content> | |
39 | - </div> | |
36 | + </form> | |
37 | + </md-content> | |
40 | 38 | </div> |
41 | 39 | </div> |
templates/login.html
View file @
b485ee3
1 | 1 | <div class="" style="margin-top:32px;"> |
2 | - <div class="row" style="max-width:500px; width:50%;margin: 0 auto"> | |
2 | + <div class="row" style="max-width:512px; width:50%; min-width:256px; margin: 0 auto"> | |
3 | 3 | <ul class="tabs"> |
4 | 4 | <li class="tab col s6"><a href="#register-tab">Sign Up</a></li> |
5 | 5 | <li class="tab col s6"><a class="active" href="#login-tab">Login</a></li> |