Commit 5beb64379c2aa94ee5ae7e22b3840796a4000a43
1 parent
e2db4a265b
Exists in
master
and in
1 other branch
fixed feed and deck links
Showing 4 changed files with 12 additions and 12 deletions Inline Diff
config.js
View file @
5beb643
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 @
5beb643
.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.fixed-size { | 64 | 68 | .card.fixed-size { | |
height: calc(3 * 5vw); | 65 | 69 | height: calc(3 * 5vw); | |
min-height: calc(3 * 50px); | 66 | 70 | min-height: calc(3 * 50px); | |
min-width: calc(5 * 50px); | 67 | 71 | min-width: calc(5 * 50px); | |
width: calc(5 * 5vw); | 68 | 72 | width: calc(5 * 5vw); | |
} | 69 | 73 | } | |
70 | 74 | |||
.card-overlay { | 71 | 75 | .card-overlay { | |
/* display: none; */ | 72 | 76 | /* display: none; */ | |
height: calc(3 * 5vw); | 73 | 77 | height: calc(3 * 5vw); | |
left: 0; | 74 | 78 | left: 0; | |
min-height: calc(3 * 50px); | 75 | 79 | min-height: calc(3 * 50px); | |
min-width: calc(5 * 50px); | 76 | 80 | min-width: calc(5 * 50px); | |
position: absolute; | 77 | 81 | position: absolute; | |
top: 0; | 78 | 82 | top: 0; | |
width: calc(5 * 5vw); | 79 | 83 | width: calc(5 * 5vw); | |
} | 80 | 84 | } | |
81 | 85 | |||
.card-overlay i { | 82 | 86 | .card-overlay i { | |
color: #FFF; | 83 | 87 | color: #FFF; | |
} | 84 | 88 | } | |
85 | 89 | |||
.card:hover .card-overlay { | 86 | 90 | .card:hover .card-overlay { | |
display: block; | 87 | 91 | display: block; | |
} | 88 | 92 | } | |
89 | 93 | |||
.top-box { | 90 | 94 | .top-box { | |
background-color: rgba(50, 50, 90, 0.5); | 91 | 95 | background-color: rgba(50, 50, 90, 0.5); | |
height: 50%; | 92 | 96 | height: 50%; | |
position: relative; | 93 | 97 | position: relative; | |
width: 100%; | 94 | 98 | width: 100%; | |
} | 95 | 99 | } | |
96 | 100 | |||
.bottom-box { | 97 | 101 | .bottom-box { | |
height: 50%; | 98 | 102 | height: 50%; | |
position: relative; | 99 | 103 | position: relative; | |
width: 100%; | 100 | 104 | width: 100%; | |
} | 101 | 105 | } | |
102 | 106 | |||
.left-box { | 103 | 107 | .left-box { | |
background-color: rgba(90, 50, 190, 0.5); | 104 | 108 | background-color: rgba(90, 50, 190, 0.5); | |
float: left; | 105 | 109 | float: left; | |
position: relative; | 106 | 110 | position: relative; | |
width: 50%; | 107 | 111 | width: 50%; | |
} | 108 | 112 | } | |
109 | 113 | |||
.right-box { | 110 | 114 | .right-box { | |
background-color: rgba(190, 50, 90, 0.5); | 111 | 115 | background-color: rgba(190, 50, 90, 0.5); | |
float: right; | 112 | 116 | float: right; | |
width: 50%; | 113 | 117 | width: 50%; | |
} | 114 | 118 | } | |
115 | 119 | |||
.center-me { | 116 | 120 | .center-me { | |
margin: 0 auto; | 117 | 121 | margin: 0 auto; | |
} | 118 | 122 | } | |
119 | 123 | |||
.container { | 120 | 124 | .container { | |
margin-left: 250px; | 121 | 125 | margin-left: 250px; | |
/*position: relative; | 122 | 126 | /*position: relative; | |
width: 600px; | 123 | 127 | width: 600px; | |
height: 80px;*/ | 124 | 128 | height: 80px;*/ | |
} | 125 | 129 | } | |
126 | 130 | |||
.modal.bottom-sheet { | 127 | 131 | .modal.bottom-sheet { | |
width: 40%; | 128 | 132 | width: 40%; | |
margin-left: auto; | 129 | 133 | margin-left: auto; | |
margin-right: auto; | 130 | 134 | margin-right: auto; | |
} | 131 | 135 | } | |
132 | 136 | |||
/* label color */ | 133 | 137 | /* label color */ | |
.input-field label { | 134 | 138 | .input-field label { | |
color: #673ab7; | 135 | 139 | color: #673ab7; | |
} | 136 | 140 | } | |
137 | 141 | |||
/* label focus color */ | 138 | 142 | /* label focus color */ | |
.input-field input[type]:focus + label { | 139 | 143 | .input-field input[type]:focus + label { | |
color: #b388ff; | 140 | 144 | color: #b388ff; | |
} | 141 | 145 | } | |
142 | 146 | |||
/* label underline focus color */ | 143 | 147 | /* label underline focus color */ | |
.input-field input[type]:focus { | 144 | 148 | .input-field input[type]:focus { | |
border-bottom: 1px solid #b388ff; | 145 | 149 | border-bottom: 1px solid #b388ff; | |
box-shadow: 0 1px 0 0 #b388ff; | 146 | 150 | box-shadow: 0 1px 0 0 #b388ff; | |
} | 147 | 151 | } | |
148 | 152 | |||
/* valid color */ | 149 | 153 | /* valid color */ | |
.input-field input[type].valid { | 150 | 154 | .input-field input[type].valid { | |
border-bottom: 1px solid #673ab7; | 151 | 155 | border-bottom: 1px solid #673ab7; | |
box-shadow: 0 1px 0 0 #673ab7; | 152 | 156 | box-shadow: 0 1px 0 0 #673ab7; | |
} | 153 | 157 | } | |
154 | 158 | |||
/* invalid color */ | 155 | 159 | /* invalid color */ | |
.input-field input[type].invalid { | 156 | 160 | .input-field input[type].invalid { | |
border-bottom: 1px solid #673ab7; | 157 | 161 | border-bottom: 1px solid #673ab7; | |
box-shadow: 0 1px 0 0 #673ab7; | 158 | 162 | box-shadow: 0 1px 0 0 #673ab7; | |
} | 159 | 163 | } | |
160 | 164 | |||
/* icon prefix focus color */ | 161 | 165 | /* icon prefix focus color */ | |
.input-field .prefix.active { | 162 | 166 | .input-field .prefix.active { |
home.html
View file @
5beb643
<!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 @
5beb643
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': 'abc'}; | 8 | 8 | $scope.cards[0] = {'id': 1, 'title': 'title1', 'content': 'abc'}; | |
$scope.cards[1] = {'id': 2, 'title': 'title2', 'content': 'xyz'}; | 9 | 9 | $scope.cards[1] = {'id': 2, 'title': 'title2', 'content': 'xyz'}; | |
$scope.cards[2] = {'id': 2, 'title': 'title3', 'content': 'qwe'}; | 10 | 10 | $scope.cards[2] = {'id': 2, 'title': 'title3', 'content': 'qwe'}; | |
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({ |