Commit c317a9f1d7cda193ff1f27cfc9ae70e250a2bdf8
Exists in
master
and in
1 other branch
Merge branch 'master' of https://git.ucsd.edu/110swag/flashy-frontend
Showing 4 changed files Inline Diff
config.js
View file @
c317a9f
angular.module('flashy', [ | 1 | 1 | angular.module('flashy', [ | |
'flashy.LogoutController', | 2 | 2 | 'flashy.LogoutController', | |
'flashy.LoginController', | 3 | 3 | 'flashy.LoginController', | |
'flashy.RootController', | 4 | 4 | 'flashy.RootController', | |
'flashy.FeedController', | 5 | 5 | 'flashy.FeedController', | |
'flashy.DeckController', | 6 | 6 | 'flashy.DeckController', | |
'flashy.ClassAddController', | 7 | 7 | 'flashy.ClassAddController', | |
'flashy.RequestResetController', | 8 | 8 | 'flashy.RequestResetController', | |
'flashy.StudyController', | 9 | 9 | 'flashy.StudyController', | |
'flashy.UserService', | 10 | 10 | 'flashy.UserService', | |
'flashy.FlashcardDirective', | 11 | 11 | 'flashy.FlashcardDirective', | |
'flashy.ResetPasswordController', | 12 | 12 | 'flashy.ResetPasswordController', | |
'flashy.VerifyEmailController', | 13 | 13 | 'flashy.VerifyEmailController', | |
'ngCookies']). | 14 | 14 | 'ngCookies']). | |
config(['$stateProvider', '$urlRouterProvider', '$httpProvider', | 15 | 15 | config(['$stateProvider', '$urlRouterProvider', '$httpProvider', | |
'$locationProvider', | 16 | 16 | '$locationProvider', | |
function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) { | 17 | 17 | function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) { | |
'use strict'; | 18 | 18 | 'use strict'; | |
$httpProvider.defaults.withCredentials = true; | 19 | 19 | $httpProvider.defaults.withCredentials = true; | |
$httpProvider.defaults.xsrfCookieName = 'csrftoken'; | 20 | 20 | $httpProvider.defaults.xsrfCookieName = 'csrftoken'; | |
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; | 21 | 21 | $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; | |
$locationProvider.html5Mode(true); | 22 | 22 | $locationProvider.html5Mode(true); | |
$urlRouterProvider.otherwise('/home'); | 23 | 23 | $urlRouterProvider.otherwise('/home'); | |
var auth_resolve = { | 24 | 24 | var auth_resolve = { | |
authorize: ['$q', 'UserService', | 25 | 25 | authorize: ['$q', 'UserService', | |
function($q, UserService) { | 26 | 26 | function($q, UserService) { | |
console.log('resolving user before continuing'); | 27 | 27 | console.log('resolving user before continuing'); | |
return UserService.getUserData(); | 28 | 28 | return UserService.getUserData(); | |
} | 29 | 29 | } | |
] | 30 | 30 | ] | |
}; | 31 | 31 | }; | |
$stateProvider. | 32 | 32 | $stateProvider. | |
state('login', { | 33 | 33 | state('login', { | |
url: '/login', | 34 | 34 | url: '/login', | |
templateUrl: 'templates/login.html', | 35 | 35 | templateUrl: 'templates/login.html', | |
controller: 'LoginController' | 36 | 36 | controller: 'LoginController' | |
}). | 37 | 37 | }). | |
state('logout', { | 38 | 38 | state('logout', { | |
resolve: auth_resolve, | 39 | 39 | resolve: auth_resolve, | |
url: '/logout', | 40 | 40 | url: '/logout', | |
templateUrl: 'templates/logout.html', | 41 | 41 | templateUrl: 'templates/logout.html', | |
controller: 'LogoutController' | 42 | 42 | controller: 'LogoutController' | |
}). | 43 | 43 | }). | |
state('root', { | 44 | 44 | state('root', { | |
resolve: auth_resolve, | 45 | 45 | resolve: auth_resolve, | |
url: '/', | 46 | 46 | url: '/', | |
templateUrl: 'templates/root.html', | 47 | 47 | templateUrl: 'templates/root.html', | |
controller: 'RootController' | 48 | 48 | controller: 'RootController' | |
}). | 49 | 49 | }). | |
state('feed', { | 50 | 50 | state('feed', { | |
resolve: auth_resolve, | 51 | 51 | resolve: auth_resolve, | |
url: '/feed/{sectionId}', | 52 | 52 | url: '/feed/{sectionId}', | |
templateUrl: 'templates/feed.html', | 53 | 53 | templateUrl: 'templates/feed.html', | |
controller: 'FeedController' | 54 | 54 | controller: 'FeedController' | |
}). | 55 | 55 | }). | |
state('addclass', { | 56 | 56 | state('addclass', { | |
resolve: auth_resolve, | 57 | 57 | resolve: auth_resolve, | |
url: '/addclass', | 58 | 58 | url: '/addclass', | |
templateUrl: 'templates/addclass.html', | 59 | 59 | templateUrl: 'templates/addclass.html', | |
controller: 'ClassAddController' | 60 | 60 | controller: 'ClassAddController' | |
}). | 61 | 61 | }). | |
state('deck', { | 62 | 62 | state('deck', { | |
resolve: auth_resolve, | 63 | 63 | resolve: auth_resolve, | |
url: '/deck', | 64 | 64 | url: '/deck/{sectionId}', | |
templateUrl: 'templates/deck.html', | 65 | 65 | templateUrl: 'templates/deck.html', | |
controller: 'DeckController' | 66 | 66 | controller: 'DeckController' | |
}). | 67 | 67 | }). | |
state('study', { | 68 | 68 | state('study', { | |
resolve: auth_resolve, | 69 | 69 | resolve: auth_resolve, | |
url: '/study', | 70 | 70 | url: '/study', | |
templateUrl: 'templates/study.html', | 71 | 71 | templateUrl: 'templates/study.html', | |
controller: 'StudyController' | 72 | 72 | controller: 'StudyController' | |
}). | 73 | 73 | }). | |
state('flashcard', { | 74 | 74 | state('flashcard', { | |
resolve: auth_resolve, | 75 | 75 | resolve: auth_resolve, | |
url: '/flashcard', | 76 | 76 | url: '/flashcard', | |
templateUrl: 'templates/flashcard.html', | 77 | 77 | templateUrl: 'templates/flashcard.html', | |
controller: 'FlashcardController' | 78 | 78 | controller: 'FlashcardController' | |
}). | 79 | 79 | }). | |
state('requestpasswordreset', { | 80 | 80 | state('requestpasswordreset', { | |
url: '/requestpasswordreset', | 81 | 81 | url: '/requestpasswordreset', | |
templateUrl: 'templates/requestpasswordreset.html', | 82 | 82 | templateUrl: 'templates/requestpasswordreset.html', | |
controller: 'RequestResetController' | 83 | 83 | controller: 'RequestResetController' | |
}). | 84 | 84 | }). | |
state('resetpassword', { | 85 | 85 | state('resetpassword', { | |
url: '/resetpassword/{uid}/{token}', | 86 | 86 | url: '/resetpassword/{uid}/{token}', | |
templateUrl: 'templates/resetpassword.html', | 87 | 87 | templateUrl: 'templates/resetpassword.html', | |
controller: 'ResetPasswordController' | 88 | 88 | controller: 'ResetPasswordController' | |
}). | 89 | 89 | }). | |
state('verifyemail', { | 90 | 90 | state('verifyemail', { | |
resolve: auth_resolve, | 91 | 91 | resolve: auth_resolve, | |
url: '/verifyemail/{key}', | 92 | 92 | url: '/verifyemail/{key}', | |
templateUrl: 'templates/verifyemail.html', | 93 | 93 | templateUrl: 'templates/verifyemail.html', | |
controller: 'VerifyEmailController' | 94 | 94 | controller: 'VerifyEmailController' | |
}); | 95 | 95 | }); | |
}]).run(['$rootScope', '$state', '$stateParams', '$location', 'UserService', | 96 | 96 | }]).run(['$rootScope', '$state', '$stateParams', '$location', 'UserService', | |
function($rootScope, $state, $stateParams, $location, UserService) { | 97 | 97 | function($rootScope, $state, $stateParams, $location, UserService) { | |
$rootScope.$on('$stateChangeStart', function(event, toState, toStateParams) { | 98 | 98 | $rootScope.$on('$stateChangeStart', function(event, toState, toStateParams) { | |
if (UserService.isLoggedIn()) return console.log('no login required; going straight to ' + toState.name); | 99 | 99 | if (UserService.isLoggedIn()) return console.log('no login required; going straight to ' + toState.name); | |
if (toState.name == 'login') return console.log('we are going to login anyway; just let it happen :)'); | 100 | 100 | if (toState.name == 'login') return console.log('we are going to login anyway; just let it happen :)'); | |
if (!UserService.isUserResolved()) return console.log('user not yet resolved; hold off'); | 101 | 101 | if (!UserService.isUserResolved()) return console.log('user not yet resolved; hold off'); | |
$rootScope.returnToState = toState; | 102 | 102 | $rootScope.returnToState = toState; | |
$rootScope.returnToStateParams = toStateParams; | 103 | 103 | $rootScope.returnToStateParams = toStateParams; | |
console.log('going to ' + toState.name + ' after login'); | 104 | 104 | console.log('going to ' + toState.name + ' after login'); | |
$state.go('login'); | 105 | 105 | $state.go('login'); | |
}); | 106 | 106 | }); | |
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) { | 107 | 107 | $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) { | |
console.log('failed to change state: ' + error); | 108 | 108 | console.log('failed to change state: ' + error); | |
$state.go('login'); | 109 | 109 | $state.go('login'); | |
}); | 110 | 110 | }); | |
} | 111 | 111 | } | |
]); | 112 | 112 | ]); | |
113 | 113 |
flashy.css
View file @
c317a9f
๏ปฟ.angucomplete-dropdown { | 1 | 1 | ๏ปฟ.angucomplete-dropdown { | |
border-color: #ececec; | 2 | 2 | border-color: #ececec; | |
border-width: 1px; | 3 | 3 | border-width: 1px; | |
border-style: solid; | 4 | 4 | border-style: solid; | |
border-radius: 2px; | 5 | 5 | border-radius: 2px; | |
/*width: 250px;*/ | 6 | 6 | /*width: 250px;*/ | |
padding: 6px; | 7 | 7 | padding: 6px; | |
cursor: pointer; | 8 | 8 | cursor: pointer; | |
z-index: 9999; | 9 | 9 | z-index: 9999; | |
position: absolute; | 10 | 10 | position: absolute; | |
/*top: 32px; | 11 | 11 | /*top: 32px; | |
left: 0px; | 12 | 12 | left: 0px; | |
*/ | 13 | 13 | */ | |
margin-top: -6px; | 14 | 14 | margin-top: -6px; | |
background-color: #ffffff; | 15 | 15 | background-color: #ffffff; | |
} | 16 | 16 | } | |
17 | 17 | |||
.angucomplete-description { | 18 | 18 | .angucomplete-description { | |
font-size: 14px; | 19 | 19 | font-size: 14px; | |
} | 20 | 20 | } | |
21 | 21 | |||
.angucomplete-row { | 22 | 22 | .angucomplete-row { | |
padding: 5px; | 23 | 23 | padding: 5px; | |
color: #000000; | 24 | 24 | color: #000000; | |
margin-bottom: 4px; | 25 | 25 | margin-bottom: 4px; | |
clear: both; | 26 | 26 | clear: both; | |
} | 27 | 27 | } | |
28 | 28 | |||
.angucomplete-selected-row { | 29 | 29 | .angucomplete-selected-row { | |
background-color: #aaaaff; | 30 | 30 | background-color: #aaaaff; | |
} | 31 | 31 | } | |
32 | 32 | |||
.container .row { | 33 | 33 | .container .row { | |
margin-left: 0; | 34 | 34 | margin-left: 0; | |
margin-right: 0; | 35 | 35 | margin-right: 0; | |
} | 36 | 36 | } | |
37 | 37 | |||
ul.side-nav.fixed li { | 38 | 38 | ul.side-nav.fixed li { | |
/*line-height: 30px;*/ | 39 | 39 | /*line-height: 30px;*/ | |
/*font-weight:700;*/ | 40 | 40 | /*font-weight:700;*/ | |
font-size:24px; | 41 | 41 | font-size:24px; | |
} | 42 | 42 | } | |
43 | 43 | |||
ul.side-nav.fixed li a { | 44 | 44 | ul.side-nav.fixed li a { | |
/*line-height: 30px;*/ | 45 | 45 | /*line-height: 30px;*/ | |
/*font-weight:700;*/ | 46 | 46 | /*font-weight:700;*/ | |
font-size:24px; | 47 | 47 | font-size:24px; | |
} | 48 | 48 | } | |
49 | 49 | |||
50 | ul.side-nav.fixed li.class a{ | |||
51 | font-size:24px; | |||
52 | height: 36px; | |||
53 | } | |||
50 | 54 | |||
ul.side-nav.fixed li ul li { | 51 | 55 | ul.side-nav.fixed li ul li { | |
/*line-height: 30px;*/ | 52 | 56 | /*line-height: 30px;*/ | |
/*font-weight:700;*/ | 53 | 57 | /*font-weight:700;*/ | |
margin-left:20px; | 54 | 58 | margin-left:20px; | |
} | 55 | 59 | } | |
56 | 60 | |||
ul.side-nav.fixed li a { | 57 | 61 | ul.side-nav.fixed li a { | |
/*line-height: 30px;*/ | 58 | 62 | /*line-height: 30px;*/ | |
/*font-weight:700;*/ | 59 | 63 | /*font-weight:700;*/ | |
font-size:24px; | 60 | 64 | font-size:24px; | |
} | 61 | 65 | } | |
62 | 66 | |||
/* Flashcard directive css */ | 63 | 67 | /* Flashcard directive css */ | |
.card { | 64 | 68 | .card { | |
word-wrap: break-word; | 65 | 69 | word-wrap: break-word; | |
} | 66 | 70 | } | |
67 | 71 | |||
.card.flashy { | 68 | 72 | .card.flashy { | |
float: left; | 69 | 73 | float: left; | |
height: calc(3*5vw); | 70 | 74 | height: calc(3*5vw); | |
margin: 6px; | 71 | 75 | margin: 6px; | |
max-height: calc(3*60px); | 72 | 76 | max-height: calc(3*60px); | |
max-width: calc(5*60px); | 73 | 77 | max-width: calc(5*60px); | |
min-height: calc(3*50px); | 74 | 78 | min-height: calc(3*50px); | |
min-width: calc(5*50px); | 75 | 79 | min-width: calc(5*50px); | |
min-height: calc(3*50px); | 76 | 80 | min-height: calc(3*50px); | |
min-width: calc(5*50px); | 77 | 81 | min-width: calc(5*50px); | |
width: calc(5*5vw); | 78 | 82 | width: calc(5*5vw); | |
} | 79 | 83 | } | |
80 | 84 | |||
.card-overlay { | 81 | 85 | .card-overlay { | |
/* display: none; */ | 82 | 86 | /* display: none; */ | |
height: calc(3*5vw); | 83 | 87 | height: calc(3*5vw); | |
left: 0; | 84 | 88 | left: 0; | |
max-height: calc(3*60px); | 85 | 89 | max-height: calc(3*60px); | |
max-width: calc(5*60px); | 86 | 90 | max-width: calc(5*60px); | |
min-height: calc(3*50px); | 87 | 91 | min-height: calc(3*50px); | |
min-width: calc(5*50px); | 88 | 92 | min-width: calc(5*50px); | |
opacity: 0; | 89 | 93 | opacity: 0; | |
position: absolute; | 90 | 94 | position: absolute; | |
top: 0; | 91 | 95 | top: 0; | |
transition: visibility 0s cubic-bezier(0,0,0.6,1) 0.2s, | 92 | 96 | transition: visibility 0s cubic-bezier(0,0,0.6,1) 0.2s, | |
opacity 0.2s cubic-bezier(0,0,0.6,1); | 93 | 97 | opacity 0.2s cubic-bezier(0,0,0.6,1); | |
/* animation effect to appear on off-hover */ | 94 | 98 | /* animation effect to appear on off-hover */ | |
visibility: hidden; | 95 | 99 | visibility: hidden; | |
width: calc(5*5vw); | 96 | 100 | width: calc(5*5vw); | |
} | 97 | 101 | } | |
98 | 102 | |||
.card-overlay i { | 99 | 103 | .card-overlay i { | |
color: #FFF; | 100 | 104 | color: #FFF; | |
left: 50%; | 101 | 105 | left: 50%; | |
position: absolute; | 102 | 106 | position: absolute; | |
top: 50%; | 103 | 107 | top: 50%; | |
transform: translate(-50%, -50%); | 104 | 108 | transform: translate(-50%, -50%); | |
} | 105 | 109 | } | |
106 | 110 | |||
.card:hover .card-overlay { | 107 | 111 | .card:hover .card-overlay { | |
opacity: 1; | 108 | 112 | opacity: 1; | |
transition-delay: 0s; /* animation effect to appear on hover */ | 109 | 113 | transition-delay: 0s; /* animation effect to appear on hover */ | |
visibility: visible; | 110 | 114 | visibility: visible; | |
} | 111 | 115 | } | |
112 | 116 | |||
.top-box { | 113 | 117 | .top-box { | |
background-color: rgba(0,10,203,0.6); | 114 | 118 | background-color: rgba(0,10,203,0.6); | |
height: 65%; | 115 | 119 | height: 65%; | |
position: relative; | 116 | 120 | position: relative; | |
transition: all 0.2s cubic-bezier(0,0,0.6,1) 0s; | 117 | 121 | transition: all 0.2s cubic-bezier(0,0,0.6,1) 0s; | |
width: 100%; | 118 | 122 | width: 100%; | |
} | 119 | 123 | } | |
120 | 124 | |||
.top-box:hover { | 121 | 125 | .top-box:hover { | |
background-color: rgba(0,10,203,0.7); | 122 | 126 | background-color: rgba(0,10,203,0.7); | |
} | 123 | 127 | } | |
124 | 128 | |||
.bottom-box { | 125 | 129 | .bottom-box { | |
height: 35%; | 126 | 130 | height: 35%; | |
width: 100%; | 127 | 131 | width: 100%; | |
} | 128 | 132 | } | |
129 | 133 | |||
.left-box { | 130 | 134 | .left-box { | |
background-color: rgba(15,0,155,0.6); | 131 | 135 | background-color: rgba(15,0,155,0.6); | |
float: left; | 132 | 136 | float: left; | |
position: relative; | 133 | 137 | position: relative; | |
height: 100%; | 134 | 138 | height: 100%; | |
transition: all 0.2s cubic-bezier(0,0,0.6,1) 0s; | 135 | 139 | transition: all 0.2s cubic-bezier(0,0,0.6,1) 0s; | |
width: 50%; | 136 | 140 | width: 50%; | |
} | 137 | 141 | } | |
138 | 142 | |||
.left-box:hover { | 139 | 143 | .left-box:hover { | |
background-color: rgba(15,0,155,0.7); | 140 | 144 | background-color: rgba(15,0,155,0.7); | |
} | 141 | 145 | } | |
142 | 146 | |||
.right-box { | 143 | 147 | .right-box { | |
background-color: rgba(0,81,189,0.6); | 144 | 148 | background-color: rgba(0,81,189,0.6); | |
float: right; | 145 | 149 | float: right; | |
height: 100%; | 146 | 150 | height: 100%; | |
position: relative; | 147 | 151 | position: relative; | |
transition: all 0.2s cubic-bezier(0,0,0.6,1) 0s; | 148 | 152 | transition: all 0.2s cubic-bezier(0,0,0.6,1) 0s; | |
width: 50%; | 149 | 153 | width: 50%; | |
} | 150 | 154 | } | |
.right-box:hover { | 151 | 155 | .right-box:hover { | |
background-color: rgba(0,81,189,0.7); | 152 | 156 | background-color: rgba(0,81,189,0.7); | |
} | 153 | 157 | } | |
154 | 158 | |||
.center-me { | 155 | 159 | .center-me { | |
margin: 0 auto; | 156 | 160 | margin: 0 auto; | |
text-align: center; | 157 | 161 | text-align: center; | |
vertical-align: center; | 158 | 162 | vertical-align: center; | |
} | 159 | 163 | } | |
160 | 164 | |||
.container { | 161 | 165 | .container { | |
/*position: relative; | 162 | 166 | /*position: relative; | |
width: 600px; | 163 | 167 | width: 600px; | |
height: 80px;*/ | 164 | 168 | height: 80px;*/ | |
} | 165 | 169 | } | |
166 | 170 | |||
.modal.bottom-sheet { | 167 | 171 | .modal.bottom-sheet { | |
width: 40%; | 168 | 172 | width: 40%; | |
margin-left: auto; | 169 | 173 | margin-left: auto; | |
margin-right: auto; | 170 | 174 | margin-right: auto; | |
} | 171 | 175 | } | |
172 | 176 | |||
/* label color */ | 173 | 177 | /* label color */ | |
.input-field label { | 174 | 178 | .input-field label { | |
color: #673ab7; | 175 | 179 | color: #673ab7; | |
} | 176 | 180 | } | |
177 | 181 | |||
/* label focus color */ | 178 | 182 | /* label focus color */ | |
.input-field input[type]:focus + label { | 179 | 183 | .input-field input[type]:focus + label { | |
color: #b388ff; | 180 | 184 | color: #b388ff; | |
} | 181 | 185 | } | |
182 | 186 | |||
/* label underline focus color */ | 183 | 187 | /* label underline focus color */ | |
.input-field input[type]:focus { | 184 | 188 | .input-field input[type]:focus { | |
border-bottom: 1px solid #b388ff; | 185 | 189 | border-bottom: 1px solid #b388ff; | |
box-shadow: 0 1px 0 0 #b388ff; | 186 | 190 | box-shadow: 0 1px 0 0 #b388ff; | |
} | 187 | 191 | } | |
188 | 192 | |||
/* valid color */ | 189 | 193 | /* valid color */ | |
.input-field input[type].valid { | 190 | 194 | .input-field input[type].valid { | |
border-bottom: 1px solid #673ab7; | 191 | 195 | border-bottom: 1px solid #673ab7; | |
box-shadow: 0 1px 0 0 #673ab7; | 192 | 196 | box-shadow: 0 1px 0 0 #673ab7; | |
} | 193 | 197 | } | |
194 | 198 | |||
/* invalid color */ | 195 | 199 | /* invalid color */ | |
.input-field input[type].invalid { | 196 | 200 | .input-field input[type].invalid { | |
border-bottom: 1px solid #673ab7; | 197 | 201 | border-bottom: 1px solid #673ab7; | |
box-shadow: 0 1px 0 0 #673ab7; | 198 | 202 | box-shadow: 0 1px 0 0 #673ab7; | |
} | 199 | 203 | } |
home.html
View file @
c317a9f
<!DOCTYPE html> | 1 | 1 | <!DOCTYPE html> | |
<html ng-app="flashy"> | 2 | 2 | <html ng-app="flashy"> | |
<base href="/app/"> | 3 | 3 | <base href="/app/"> | |
<head> | 4 | 4 | <head> | |
<link type="text/css" rel="stylesheet" href="styles/materialize.min.css" | 5 | 5 | <link type="text/css" rel="stylesheet" href="styles/materialize.min.css" | |
media="screen,projection"/> | 6 | 6 | media="screen,projection"/> | |
<!--<link rel="stylesheet" href="styles/bootstrap-3.3.4-dist/css/bootstrap.css"/>--> | 7 | 7 | <!--<link rel="stylesheet" href="styles/bootstrap-3.3.4-dist/css/bootstrap.css"/>--> | |
<link rel="stylesheet" | 8 | 8 | <link rel="stylesheet" | |
href="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.css"> | 9 | 9 | href="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.css"> | |
10 | 10 | |||
<link rel="stylesheet" href="flashy.css"/> | 11 | 11 | <link rel="stylesheet" href="flashy.css"/> | |
</head> | 12 | 12 | </head> | |
13 | 13 | |||
<body ng-controller="RootController"> | 14 | 14 | <body ng-controller="RootController"> | |
15 | 15 | |||
<ul id="slide-out" ng-show="isLoggedIn" class="side-nav fixed"> | 16 | 16 | <ul id="slide-out" ng-show="isLoggedIn" class="side-nav fixed"> | |
<li class="logo"><a href="//flashy.cards/" id="logo-container"> | 17 | 17 | <li class="logo"><a href="//flashy.cards/" id="logo-container"> | |
18 | ||||
<h1>Flashy</h1> | 18 | 19 | <h1>Flashy</h1> | |
</a></li> | 19 | 20 | </a></li> | |
<li class="bold"> | 20 | 21 | <li class="bold"> | |
<a>Classes</a> | 21 | 22 | <a>Classes:</a></li> | |
<!--<a ui-sref="addclass"><i class="mdi-content-add"></i></a>--> | 22 | 23 | <div ng-repeat="section in sections"> | |
</li> | 23 | 24 | <li class="bold class"><a ui-sref="feed({sectionId:{{section.id}}})">{{section.short_name}}</a></li> | |
<li> | 24 | 25 | </div> | |
<ul ng-repeat="section in sections"> | 25 | |||
<li ui-sref="feed({{section.id}})">{{section.short_name}} </li> | 26 | |||
</ul> | 27 | |||
</li> | 28 | |||
<li class="bold"><a ui-sref="addclass">Add Class</a></li> | 29 | 26 | <li class="bold"><a ui-sref="addclass">Add Class</a></li> | |
<li class="bold"><a ui-sref="feed">Feed</a></li> | 30 | 27 | <li class="bold"><a ui-sref="study">Study</a></li> | |
<li class="bold"><a ui-sref="deck">Deck</a></li> | 31 | |||
<li class="bold"><a ui-sref="logout">Logout</a></li> | 32 | 28 | <li class="bold"><a ui-sref="logout">Logout</a></li> | |
</ul> | 33 | 29 | </ul> | |
34 | 30 | |||
35 | 31 | |||
<div class="container" ui-view></div> | 36 | 32 | <div class="container" ui-view></div> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> | 37 | 33 | <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.js"></script> | 38 | 34 | <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.js"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-cookies.js"></script> | 39 | 35 | <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-cookies.js"></script> | |
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script> | 40 | 36 | <script src="//code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script type="text/javascript" src="scripts/materialize.min.js"></script> | 41 | 37 | <script type="text/javascript" src="scripts/materialize.min.js"></script> | |
<script type="text/javascript" src="scripts/jquery.collapsible.js"></script> | 42 | 38 | <script type="text/javascript" src="scripts/jquery.collapsible.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.js"></script> | 43 | 39 | <script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script> | 44 | 40 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script> | 45 | 41 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script> | |
46 | 42 | |||
<script src="config.js"></script> | 47 | 43 | <script src="config.js"></script> | |
48 | 44 | |||
<!-- Controllers --> | 49 | 45 | <!-- Controllers --> | |
<script src="scripts/FeedController.js"></script> | 50 | 46 | <script src="scripts/FeedController.js"></script> | |
<script src="scripts/RootController.js"></script> | 51 | 47 | <script src="scripts/RootController.js"></script> | |
<script src="scripts/LoginController.js"></script> | 52 | 48 | <script src="scripts/LoginController.js"></script> | |
<script src="scripts/LogoutController.js"></script> | 53 | 49 | <script src="scripts/LogoutController.js"></script> | |
<script src="scripts/DeckController.js"></script> | 54 | 50 | <script src="scripts/DeckController.js"></script> | |
<script src="scripts/RequestResetController.js"></script> | 55 | 51 | <script src="scripts/RequestResetController.js"></script> | |
<script src="scripts/ClassAddController.js"></script> | 56 | 52 | <script src="scripts/ClassAddController.js"></script> | |
<script src="scripts/StudyController.js"></script> | 57 | 53 | <script src="scripts/StudyController.js"></script> | |
<script src="scripts/ResetPasswordController.js"></script> | 58 | 54 | <script src="scripts/ResetPasswordController.js"></script> | |
<script src="scripts/VerifyEmailController.js"></script> | 59 | 55 | <script src="scripts/VerifyEmailController.js"></script> | |
<!--<script src="scripts/SidebarController.js"></script>--> | 60 | 56 | <!--<script src="scripts/SidebarController.js"></script>--> | |
61 | 57 | |||
<!-- Services --> | 62 | 58 | <!-- Services --> | |
<script src="scripts/UserService.js"></script> | 63 | 59 | <script src="scripts/UserService.js"></script> | |
64 | 60 | |||
<!-- Directives --> | 65 | 61 | <!-- Directives --> | |
<script src="scripts/FlashcardDirective.js"></script> | 66 | 62 | <script src="scripts/FlashcardDirective.js"></script> |
scripts/FeedController.js
View file @
c317a9f
angular.module('flashy.FeedController', ['ui.router']). | 1 | 1 | angular.module('flashy.FeedController', ['ui.router']). | |
2 | 2 | |||
controller('FeedController', ['$scope', '$stateParams', '$state', '$http', function($scope, $stateParams, $state, $http) { | 3 | 3 | controller('FeedController', ['$scope', '$stateParams', '$state', '$http', function($scope, $stateParams, $state, $http) { | |
console.log('Hello from feed'); | 4 | 4 | console.log('Hello from feed'); | |
sectionId = $stateParams.sectionId; | 5 | 5 | sectionId = $stateParams.sectionId; | |
$scope.cards = []; | 6 | 6 | $scope.cards = []; | |
7 | 7 | |||
$scope.cards[0] = {'id': 1, 'title': 'title1', 'content': 'abchello'}; | 8 | 8 | $scope.cards[0] = {'id': 1, 'title': 'title1', 'content': 'abchello'}; | |
$scope.cards[1] = {'id': 2, 'title': 'title2', 'content': 'xyz2 2 2 2 2'}; | 9 | 9 | $scope.cards[1] = {'id': 2, 'title': 'title2', 'content': 'xyz2 2 2 2 2'}; | |
$scope.cards[2] = {'id': 2, 'title': 'title3', 'content': 'qwe 3 3 3'}; | 10 | 10 | $scope.cards[2] = {'id': 2, 'title': 'title3', 'content': 'qwe 3 3 3'}; | |
11 | 11 | |||
$http.get('/api/sections/' + sectionId + '/flashcards/'). | 12 | 12 | $http.get('/api/sections/' + sectionId + '/flashcards/'). | |
success(function(data) { | 13 | 13 | success(function(data) { | |
for (var i = 0; i < data.length; i++) { | 14 | 14 | for (var i = 0; i < data.length; i++) { | |
cards.push({'title': data[i].title, 'content': data[i].content}); | 15 | 15 | cards.push({'title': data[i].title, 'content': data[i].content}); | |
} | 16 | 16 | } | |
}). | 17 | 17 | }). | |
error(function(err) { | 18 | 18 | error(function(err) { | |
console.log('no'); | 19 | 19 | console.log('no'); | |
}); | 20 | 20 | }); | |
21 | 21 | |||
$scope.viewDeck = function() { | 22 | 22 | $scope.viewDeck = function() { | |
$state.go('deck'); | 23 | 23 | $state.go('deck', {sectionId: sectionId}); | |
console.log('go to deck'); | 24 | 24 | console.log('go to deck'); | |
}; | 25 | 25 | }; | |
26 | 26 | |||
$scope.pullCard = function(card) { | 27 | 27 | $scope.pullCard = function(card) { | |
var index = $scope.cards.indexOf(card); | 28 | 28 | var index = $scope.cards.indexOf(card); | |
29 | 29 | |||
console.log($scope.cards[index]); | 30 | 30 | console.log($scope.cards[index]); | |
}; | 31 | 31 | }; | |
32 | 32 | |||
$scope.pushCard = function() { | 33 | 33 | $scope.pushCard = function() { | |
console.log('make! card content:' + $scope.text); | 34 | 34 | console.log('make! card content:' + $scope.text); | |
var pushed = new Date(Date.now()); | 35 | 35 | var pushed = new Date(Date.now()); | |
console.log(pushed.toString()); | 36 | 36 | console.log(pushed.toString()); | |
37 | 37 | |||
// attempt to make card :( | 38 | 38 | // attempt to make card :( | |
$http.post('/api/flashcards/', {'text': $scope.text, 'pushed': pushed, 'mask': []}). | 39 | 39 | $http.post('/api/flashcards/', {'text': $scope.text, 'pushed': pushed, 'mask': []}). | |
success(function(data) { | 40 | 40 | success(function(data) { | |
console.log('No way, really?'); | 41 | 41 | console.log('No way, really?'); | |
}). | 42 | 42 | }). | |
error(function(error) { | 43 | 43 | error(function(error) { | |
console.log('haha, n00b'); | 44 | 44 | console.log('haha, n00b'); | |
}); | 45 | 45 | }); | |
46 | 46 | |||
$scope.text = ''; | 47 | 47 | $scope.text = ''; | |
}; | 48 | 48 | }; | |
49 | 49 | |||
$scope.flashcard = 'hi i am a flashcard. I need to be really long and awesome I ain\'t ' + | 50 | 50 | $scope.flashcard = 'hi i am a flashcard. I need to be really long and awesome I ain\'t ' + | |
'know how long I am right now. Is it good enough now?????????? Howz about now???'; | 51 | 51 | 'know how long I am right now. Is it good enough now?????????? Howz about now???'; | |
$scope.text = ''; | 52 | 52 | $scope.text = ''; | |
53 | 53 | |||
$(document).ready(function() { | 54 | 54 | $(document).ready(function() { | |
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered | 55 | 55 | // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered | |
$('.modal-trigger').leanModal({ | 56 | 56 | $('.modal-trigger').leanModal({ |