Commit 562c50ef9b5223c7d90771c7b7af7fad1661c0d3
1 parent
25f31ee2a6
Exists in
master
and in
1 other branch
removed drop class page
Showing 4 changed files with 0 additions and 56 deletions Inline Diff
config.js
View file @
562c50e
angular.module('flashy', [ | 1 | 1 | angular.module('flashy', [ | |
'flashy.LoginController', | 2 | 2 | 'flashy.LoginController', | |
'flashy.RootController', | 3 | 3 | 'flashy.RootController', | |
'flashy.FeedController', | 4 | 4 | 'flashy.FeedController', | |
'flashy.DeckController', | 5 | 5 | 'flashy.DeckController', | |
'flashy.ClassAddController', | 6 | 6 | 'flashy.ClassAddController', | |
'flashy.ClassDropController', | 7 | |||
'flashy.RequestResetController', | 8 | 7 | 'flashy.RequestResetController', | |
'flashy.StudyController', | 9 | 8 | 'flashy.StudyController', | |
'flashy.UserService', | 10 | 9 | 'flashy.UserService', | |
'flashy.FlashcardDirective', | 11 | 10 | 'flashy.FlashcardDirective', | |
'flashy.FlashcardFactory', | 12 | 11 | 'flashy.FlashcardFactory', | |
'flashy.ResetPasswordController', | 13 | 12 | 'flashy.ResetPasswordController', | |
'flashy.VerifyEmailController', | 14 | 13 | 'flashy.VerifyEmailController', | |
'flashy.CardListController', | 15 | 14 | 'flashy.CardListController', | |
'flashy.HelpController', | 16 | 15 | 'flashy.HelpController', | |
'flashy.SettingsController', | 17 | 16 | 'flashy.SettingsController', | |
'ngCookies']). | 18 | 17 | 'ngCookies']). | |
config(function($stateProvider, $urlRouterProvider, $resourceProvider, $httpProvider, $locationProvider) { | 19 | 18 | config(function($stateProvider, $urlRouterProvider, $resourceProvider, $httpProvider, $locationProvider) { | |
'use strict'; | 20 | 19 | 'use strict'; | |
$httpProvider.defaults.withCredentials = true; | 21 | 20 | $httpProvider.defaults.withCredentials = true; | |
$httpProvider.defaults.xsrfCookieName = 'csrftoken'; | 22 | 21 | $httpProvider.defaults.xsrfCookieName = 'csrftoken'; | |
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; | 23 | 22 | $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; | |
$resourceProvider.defaults.stripTrailingSlashes = false; | 24 | 23 | $resourceProvider.defaults.stripTrailingSlashes = false; | |
var arrayMethods = Object.getOwnPropertyNames(Array.prototype); | 25 | 24 | var arrayMethods = Object.getOwnPropertyNames(Array.prototype); | |
arrayMethods.forEach(attachArrayMethodsToNodeList); | 26 | 25 | arrayMethods.forEach(attachArrayMethodsToNodeList); | |
function attachArrayMethodsToNodeList(methodName) { | 27 | 26 | function attachArrayMethodsToNodeList(methodName) { | |
if (methodName !== 'length') { | 28 | 27 | if (methodName !== 'length') { | |
NodeList.prototype[methodName] = Array.prototype[methodName]; | 29 | 28 | NodeList.prototype[methodName] = Array.prototype[methodName]; | |
} | 30 | 29 | } | |
} | 31 | 30 | } | |
32 | 31 | |||
$httpProvider.interceptors.push(function($q, $rootScope) { | 33 | 32 | $httpProvider.interceptors.push(function($q, $rootScope) { | |
return { | 34 | 33 | return { | |
'responseError': function(rejection) { // need a better redirect | 35 | 34 | 'responseError': function(rejection) { // need a better redirect | |
if (rejection.status >= 500) { | 36 | 35 | if (rejection.status >= 500) { | |
console.log('got error'); | 37 | 36 | console.log('got error'); | |
console.log(rejection); | 38 | 37 | console.log(rejection); | |
$rootScope.$broadcast('server_error', rejection); | 39 | 38 | $rootScope.$broadcast('server_error', rejection); | |
} | 40 | 39 | } | |
if (rejection.status == 403) { | 41 | 40 | if (rejection.status == 403) { | |
console.log(rejection); | 42 | 41 | console.log(rejection); | |
if (rejection.data && rejection.data.detail == 'Please verify your email before continuing') { | 43 | 42 | if (rejection.data && rejection.data.detail == 'Please verify your email before continuing') { | |
UserService.showLockedMessage(); | 44 | 43 | UserService.showLockedMessage(); | |
UserService.logout(); | 45 | 44 | UserService.logout(); | |
} | 46 | 45 | } | |
} | 47 | 46 | } | |
if (rejection.status == 429) { | 48 | 47 | if (rejection.status == 429) { | |
console.log(rejection); | 49 | 48 | console.log(rejection); | |
Materialize.toast('Your enthusiasm is appreciated, but we ask that you slow down a little!', 4000); | 50 | 49 | Materialize.toast('Your enthusiasm is appreciated, but we ask that you slow down a little!', 4000); | |
} | 51 | 50 | } | |
return $q.reject(rejection); | 52 | 51 | return $q.reject(rejection); | |
} | 53 | 52 | } | |
}; | 54 | 53 | }; | |
}); | 55 | 54 | }); | |
$locationProvider.html5Mode(true); | 56 | 55 | $locationProvider.html5Mode(true); | |
$urlRouterProvider.otherwise('/404'); | 57 | 56 | $urlRouterProvider.otherwise('/404'); | |
var auth_resolve = { | 58 | 57 | var auth_resolve = { | |
authorize: function($q, $rootScope, $state, $stateParams, UserService) { | 59 | 58 | authorize: function($q, $rootScope, $state, $stateParams, UserService) { | |
console.log('do we need to authorize a user for', $rootScope.nextState.name); | 60 | 59 | console.log('do we need to authorize a user for', $rootScope.nextState.name); | |
if (UserService.noAuthRequired($rootScope.nextState)) { | 61 | 60 | if (UserService.noAuthRequired($rootScope.nextState)) { | |
console.log('no auth required for', $rootScope.nextState.name); | 62 | 61 | console.log('no auth required for', $rootScope.nextState.name); | |
return UserService.getUserData(); | 63 | 62 | return UserService.getUserData(); | |
} | 64 | 63 | } | |
console.log('resolving user before continuing to ' + $rootScope.nextState.name); | 65 | 64 | console.log('resolving user before continuing to ' + $rootScope.nextState.name); | |
var redirectAsNeeded = function() { | 66 | 65 | var redirectAsNeeded = function() { | |
if (!UserService.isLoggedIn()) { | 67 | 66 | if (!UserService.isLoggedIn()) { | |
console.log(UserService.getUserData()); | 68 | 67 | console.log(UserService.getUserData()); | |
console.log('making the user log in'); | 69 | 68 | console.log('making the user log in'); | |
$state.go('login'); | 70 | 69 | $state.go('login'); | |
} | 71 | 70 | } | |
if (!UserService.authorizedFor($rootScope.nextState, $rootScope.nextStateParams)) { | 72 | 71 | if (!UserService.authorizedFor($rootScope.nextState, $rootScope.nextStateParams)) { | |
console.log('user not authorized for ' + $rootScope.nextState.name); | 73 | 72 | console.log('user not authorized for ' + $rootScope.nextState.name); | |
$state.go('addclass'); | 74 | 73 | $state.go('addclass'); | |
} | 75 | 74 | } | |
}; | 76 | 75 | }; | |
if (UserService.isResolved()) return redirectAsNeeded(); | 77 | 76 | if (UserService.isResolved()) return redirectAsNeeded(); | |
return UserService.getUserData().then(redirectAsNeeded); | 78 | 77 | return UserService.getUserData().then(redirectAsNeeded); | |
} | 79 | 78 | } | |
}; | 80 | 79 | }; | |
$stateProvider. | 81 | 80 | $stateProvider. | |
state('login', { | 82 | 81 | state('login', { | |
resolve: auth_resolve, | 83 | 82 | resolve: auth_resolve, | |
url: '/login', | 84 | 83 | url: '/login', | |
templateUrl: 'templates/login.html', | 85 | 84 | templateUrl: 'templates/login.html', | |
controller: 'LoginController' | 86 | 85 | controller: 'LoginController' | |
}). | 87 | 86 | }). | |
state('root', { | 88 | 87 | state('root', { | |
resolve: auth_resolve, | 89 | 88 | resolve: auth_resolve, | |
url: '/', | 90 | 89 | url: '/', | |
controller: 'RootController' | 91 | 90 | controller: 'RootController' | |
}). | 92 | 91 | }). | |
state('feed', { | 93 | 92 | state('feed', { | |
resolve: auth_resolve, | 94 | 93 | resolve: auth_resolve, | |
url: '/feed/{sectionId}', | 95 | 94 | url: '/feed/{sectionId}', | |
templateUrl: 'templates/feed.html', | 96 | 95 | templateUrl: 'templates/feed.html', | |
controller: 'FeedController' | 97 | 96 | controller: 'FeedController' | |
}). | 98 | 97 | }). | |
state('cardlist', { | 99 | 98 | state('cardlist', { | |
resolve: auth_resolve, | 100 | 99 | resolve: auth_resolve, | |
url: '/cards/{sectionId}', | 101 | 100 | url: '/cards/{sectionId}', | |
templateUrl: 'templates/cardlist.html', | 102 | 101 | templateUrl: 'templates/cardlist.html', | |
controller: 'CardListController' | 103 | 102 | controller: 'CardListController' | |
}). | 104 | 103 | }). | |
state('addclass', { | 105 | 104 | state('addclass', { | |
resolve: auth_resolve, | 106 | 105 | resolve: auth_resolve, | |
url: '/addclass', | 107 | 106 | url: '/addclass', | |
templateUrl: 'templates/addclass.html', | 108 | 107 | templateUrl: 'templates/addclass.html', | |
controller: 'ClassAddController' | 109 | 108 | controller: 'ClassAddController' | |
}). | 110 | |||
state('dropclass', { | 111 | |||
resolve: auth_resolve, | 112 | |||
url: '/settings/dropclass', | 113 | |||
templateUrl: 'templates/dropclass.html', | 114 | |||
controller: 'ClassDropController' | 115 | |||
}). | 116 | 109 | }). | |
state('deck', { | 117 | 110 | state('deck', { | |
resolve: auth_resolve, | 118 | 111 | resolve: auth_resolve, | |
url: '/deck/{sectionId}', | 119 | 112 | url: '/deck/{sectionId}', | |
templateUrl: 'templates/deck.html', | 120 | 113 | templateUrl: 'templates/deck.html', | |
controller: 'DeckController' | 121 | 114 | controller: 'DeckController' | |
}). | 122 | 115 | }). | |
state('study', { | 123 | 116 | state('study', { | |
resolve: auth_resolve, | 124 | 117 | resolve: auth_resolve, | |
url: '/study', | 125 | 118 | url: '/study', | |
templateUrl: 'templates/study.html', | 126 | 119 | templateUrl: 'templates/study.html', | |
controller: 'StudyController' | 127 | 120 | controller: 'StudyController' | |
}). | 128 | 121 | }). | |
state('flashcard', { | 129 | 122 | state('flashcard', { | |
resolve: auth_resolve, | 130 | 123 | resolve: auth_resolve, | |
url: '/flashcard', | 131 | 124 | url: '/flashcard', | |
templateUrl: 'templates/flashcard.html', | 132 | 125 | templateUrl: 'templates/flashcard.html', | |
controller: 'FlashcardController' | 133 | 126 | controller: 'FlashcardController' | |
}). | 134 | 127 | }). | |
state('settings', { | 135 | 128 | state('settings', { | |
resolve: auth_resolve, | 136 | 129 | resolve: auth_resolve, | |
url: '/settings', | 137 | 130 | url: '/settings', | |
templateUrl: 'templates/settings.html', | 138 | 131 | templateUrl: 'templates/settings.html', | |
controller: 'SettingsController' | 139 | 132 | controller: 'SettingsController' | |
}). | 140 | 133 | }). | |
state('requestpasswordreset', { | 141 | 134 | state('requestpasswordreset', { | |
url: '/requestpasswordreset', | 142 | 135 | url: '/requestpasswordreset', | |
templateUrl: 'templates/requestpasswordreset.html', | 143 | 136 | templateUrl: 'templates/requestpasswordreset.html', | |
controller: 'RequestResetController' | 144 | 137 | controller: 'RequestResetController' | |
}). | 145 | 138 | }). | |
state('resetpassword', { | 146 | 139 | state('resetpassword', { | |
url: '/resetpassword/{uid}/{token}', | 147 | 140 | url: '/resetpassword/{uid}/{token}', | |
templateUrl: 'templates/resetpassword.html', | 148 | 141 | templateUrl: 'templates/resetpassword.html', | |
controller: 'ResetPasswordController' | 149 | 142 | controller: 'ResetPasswordController' | |
}). | 150 | 143 | }). | |
state('verifyemail', { | 151 | 144 | state('verifyemail', { | |
url: '/verifyemail/{key}', | 152 | 145 | url: '/verifyemail/{key}', | |
templateUrl: 'templates/verifyemail.html', | 153 | 146 | templateUrl: 'templates/verifyemail.html', | |
controller: 'VerifyEmailController' | 154 | 147 | controller: 'VerifyEmailController' | |
}). | 155 | 148 | }). | |
state('404', { | 156 | 149 | state('404', { | |
url: '/404', | 157 | 150 | url: '/404', | |
template: "<h1>This page doesn't exist!</h1>" | 158 | 151 | template: "<h1>This page doesn't exist!</h1>" | |
}). | 159 | 152 | }). | |
state('help', { | 160 | 153 | state('help', { | |
resolve: auth_resolve, | 161 | 154 | resolve: auth_resolve, | |
url: '/help', | 162 | 155 | url: '/help', | |
templateUrl: 'templates/help.html', | 163 | 156 | templateUrl: 'templates/help.html', | |
controller: 'HelpController' | 164 | 157 | controller: 'HelpController' | |
}); | 165 | 158 | }); | |
}). | 166 | 159 | }). | |
run(function($rootScope, $state, $stateParams, $location, UserService) { | 167 | 160 | run(function($rootScope, $state, $stateParams, $location, UserService) { | |
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) { | 168 | 161 | $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) { | |
console.log('failed to change state: ' + error); | 169 | 162 | console.log('failed to change state: ' + error); | |
$state.go('login'); | 170 | 163 | $state.go('login'); | |
}); | 171 | 164 | }); | |
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { | 172 | 165 | $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { | |
$rootScope.nextState = toState; | 173 | 166 | $rootScope.nextState = toState; | |
$rootScope.nextStateParams = toParams; | 174 | 167 | $rootScope.nextStateParams = toParams; | |
console.log('changing state to', toState); | 175 | 168 | console.log('changing state to', toState); | |
if (['feed', 'deck', 'cardlist'].indexOf(toState.name) >= 0) { | 176 | 169 | if (['feed', 'deck', 'cardlist'].indexOf(toState.name) >= 0) { | |
localStorage.setItem('last_state', toState.name); | 177 | 170 | localStorage.setItem('last_state', toState.name); | |
localStorage.setItem('last_state_params', JSON.stringify(toParams)); | 178 | 171 | localStorage.setItem('last_state_params', JSON.stringify(toParams)); | |
} | 179 | 172 | } | |
}); | 180 | 173 | }); |
home.html
View file @
562c50e
<!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> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> | 5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> | |
<link rel="stylesheet" | 6 | 6 | <link rel="stylesheet" | |
href="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.css"> | 7 | 7 | href="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.css"> | |
<link rel="shortcut icon" href="flashy.ico"> | 8 | 8 | <link rel="shortcut icon" href="flashy.ico"> | |
9 | 9 | |||
<link rel="stylesheet" href="styles/flashier.css"/> | 10 | 10 | <link rel="stylesheet" href="styles/flashier.css"/> | |
<link rel="stylesheet" href="styles/flashy.css"/> | 11 | 11 | <link rel="stylesheet" href="styles/flashy.css"/> | |
<link rel="manifest" href="manifest.json"> | 12 | 12 | <link rel="manifest" href="manifest.json"> | |
<link | 13 | 13 | <link | |
href='https://fonts.googleapis.com/css?family=Satisfy|Titillium+Web:400,200,200italic,300,600,700,900,700italic,600italic,400italic,300italic' | 14 | 14 | href='https://fonts.googleapis.com/css?family=Satisfy|Titillium+Web:400,200,200italic,300,600,700,900,700italic,600italic,400italic,300italic' | |
rel='stylesheet' type='text/css'> | 15 | 15 | rel='stylesheet' type='text/css'> | |
<title>Flashy</title> | 16 | 16 | <title>Flashy</title> | |
</head> | 17 | 17 | </head> | |
<body ng-controller="RootController"> | 18 | 18 | <body ng-controller="RootController"> | |
<header> | 19 | 19 | <header> | |
<nav> | 20 | 20 | <nav> | |
<div class="nav-wrapper"> | 21 | 21 | <div class="nav-wrapper"> | |
<a ng-show="UserService.isLoggedIn()" href="#" data-activates="mobile-demo" | 22 | 22 | <a ng-show="UserService.isLoggedIn()" href="#" data-activates="mobile-demo" | |
class="left button-collapse hide-on-med-and-up"><i | 23 | 23 | class="left button-collapse hide-on-med-and-up"><i | |
class="mdi-navigation-menu"></i></a> | 24 | 24 | class="mdi-navigation-menu"></i></a> | |
25 | 25 | |||
<!-- User's classes dropdown --> | 26 | 26 | <!-- User's classes dropdown --> | |
<ul id="classDropdown" class="dropdown-content"> | 27 | 27 | <ul id="classDropdown" class="dropdown-content"> | |
<li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections"> | 28 | 28 | <li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections"> | |
<a ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a> | 29 | 29 | <a ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a> | |
</li> | 30 | 30 | </li> | |
<li class="divider"></li> | 31 | 31 | <li class="divider"></li> | |
<li><a ui-sref="addclass">Add Class</a></li> | 32 | 32 | <li><a ui-sref="addclass">Add Class</a></li> | |
</ul> | 33 | 33 | </ul> | |
<ul ng-show="UserService.isLoggedIn()" class="left hide-on-small-and-down"> | 34 | 34 | <ul ng-show="UserService.isLoggedIn()" class="left hide-on-small-and-down"> | |
<li><a style="font-size:20px; font-weight:700;" class="dropdown-button ng-cloak hide-on-small-and-down" | 35 | 35 | <li><a style="font-size:20px; font-weight:700;" class="dropdown-button ng-cloak hide-on-small-and-down" | |
href="#!" id="class-list" | 36 | 36 | href="#!" id="class-list" | |
data-activates="classDropdown" data-beloworigin="true">{{currentSection.id?currentSection.short_name:"Classes"}}<i | 37 | 37 | data-activates="classDropdown" data-beloworigin="true">{{currentSection.id?currentSection.short_name:"Classes"}}<i | |
class="mdi-navigation-arrow-drop-down right"></i></a></li> | 38 | 38 | class="mdi-navigation-arrow-drop-down right"></i></a></li> | |
<li ng-show="currentSection.id" ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" | 39 | 39 | <li ng-show="currentSection.id" ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" | |
class="tooltipped" | 40 | 40 | class="tooltipped" | |
data-position="bottom" | 41 | 41 | data-position="bottom" | |
data-delay="50" data-tooltip="Feed"><i | 42 | 42 | data-delay="50" data-tooltip="Feed"><i | |
class="mdi-action-view-module"></i></a></li> | 43 | 43 | class="mdi-action-view-module"></i></a></li> | |
<li ng-show="currentSection.id" ui-sref-active="active" id="class-list"><a ui-sref="deck({sectionId:currentSection.id})" | 44 | 44 | <li ng-show="currentSection.id" ui-sref-active="active" id="class-list"><a ui-sref="deck({sectionId:currentSection.id})" | |
class="tooltipped" | 45 | 45 | class="tooltipped" | |
data-position="bottom" | 46 | 46 | data-position="bottom" | |
data-delay="50" data-tooltip="Deck"><i | 47 | 47 | data-delay="50" data-tooltip="Deck"><i | |
class="mdi-action-view-carousel"></i></a></li> | 48 | 48 | class="mdi-action-view-carousel"></i></a></li> | |
<li ng-show="currentSection.id" ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})" | 49 | 49 | <li ng-show="currentSection.id" ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})" | |
class="tooltipped" | 50 | 50 | class="tooltipped" | |
data-position="bottom" | 51 | 51 | data-position="bottom" | |
data-delay="50" data-tooltip="Card List"><i | 52 | 52 | data-delay="50" data-tooltip="Card List"><i | |
class="mdi-action-view-list"></i></a></li> | 53 | 53 | class="mdi-action-view-list"></i></a></li> | |
</ul> | 54 | 54 | </ul> | |
<a href="#" class="brand-logo center">Flashy</a> | 55 | 55 | <a href="#" class="brand-logo center">Flashy</a> | |
56 | 56 | |||
<ul ng-show="UserService.isLoggedIn()" ng-cloak id="nav-mobile" class="right hide-on-small-and-down"> | 57 | 57 | <ul ng-show="UserService.isLoggedIn()" ng-cloak id="nav-mobile" class="right hide-on-small-and-down"> | |
58 | 58 | |||
<li ui-sref-active="active"><a ui-sref="study" class="tooltipped" data-position="bottom" data-delay="50" | 59 | 59 | <li ui-sref-active="active"><a ui-sref="study" class="tooltipped" data-position="bottom" data-delay="50" | |
data-tooltip="Study"> | 60 | 60 | data-tooltip="Study"> | |
<i class="tiny mdi-action-pageview"></i></a></li> | 61 | 61 | <i class="tiny mdi-action-pageview"></i></a></li> | |
62 | 62 | |||
<!-- Settings Dropdown --> | 63 | 63 | <!-- Settings Dropdown --> | |
<ul id="settingsDropdown" class="dropdown-content"> | 64 | 64 | <ul id="settingsDropdown" class="dropdown-content"> | |
65 | 65 | |||
66 | 66 | |||
</ul> | 67 | 67 | </ul> | |
68 | 68 | |||
<li ui-sref-active="active"><a ui-sref="help"><i class="tiny mdi-action-help tooltipped" | 69 | 69 | <li ui-sref-active="active"><a ui-sref="help"><i class="tiny mdi-action-help tooltipped" | |
data-position="bottom" | 70 | 70 | data-position="bottom" | |
data-delay="50" data-tooltip="Help"></i></a></li> | 71 | 71 | data-delay="50" data-tooltip="Help"></i></a></li> | |
<li ui-sref-active="active"><a ui-sref="settings"><i data-position="bottom" data-delay="50" | 72 | 72 | <li ui-sref-active="active"><a ui-sref="settings"><i data-position="bottom" data-delay="50" | |
data-tooltip="Settings" | 73 | 73 | data-tooltip="Settings" | |
class="mdi-action-settings tooltipped"></i></a></li> | 74 | 74 | class="mdi-action-settings tooltipped"></i></a></li> | |
<li><a ng-click="logout()" ui-sref="login"><i data-position="bottom" data-delay="50" data-tooltip="Logout" | 75 | 75 | <li><a ng-click="logout()" ui-sref="login"><i data-position="bottom" data-delay="50" data-tooltip="Logout" | |
class="mdi-content-forward tooltipped"></i></a></li> | 76 | 76 | class="mdi-content-forward tooltipped"></i></a></li> | |
77 | 77 | |||
78 | 78 | |||
</ul> | 79 | 79 | </ul> | |
80 | 80 | |||
<!-- Slide-in side-nav for small screens --> | 81 | 81 | <!-- Slide-in side-nav for small screens --> | |
<ul ng-show="UserService.isLoggedIn()" class="side-nav" id="mobile-demo"> | 82 | 82 | <ul ng-show="UserService.isLoggedIn()" class="side-nav" id="mobile-demo"> | |
<span ng-show="currentSection.id"> | 83 | 83 | <span ng-show="currentSection.id"> | |
<li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})"> | 84 | 84 | <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})"> | |
<i class="mdi-action-view-module left"></i> | 85 | 85 | <i class="mdi-action-view-module left"></i> | |
Feed</a> | 86 | 86 | Feed</a> | |
</li> | 87 | 87 | </li> | |
<li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})"> | 88 | 88 | <li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})"> | |
<i class="mdi-action-view-carousel left"> </i> | 89 | 89 | <i class="mdi-action-view-carousel left"> </i> | |
Deck | 90 | 90 | Deck | |
</a> | 91 | 91 | </a> | |
</li> | 92 | 92 | </li> | |
<li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})"> | 93 | 93 | <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})"> | |
<i class="mdi-action-view-list left"></i> | 94 | 94 | <i class="mdi-action-view-list left"></i> | |
Card List | 95 | 95 | Card List | |
</a> | 96 | 96 | </a> | |
</li> | 97 | 97 | </li> | |
<hr> | 98 | 98 | <hr> | |
</span> | 99 | 99 | </span> | |
<!-- Collapsible menu for all the User's classes --> | 100 | 100 | <!-- Collapsible menu for all the User's classes --> | |
<ul class="collapsible" data-collapsible="accordion" > | 101 | 101 | <ul class="collapsible" data-collapsible="accordion" > | |
<li class="bold"> | 102 | 102 | <li class="bold"> | |
<a class="collapsible-header black-text"> | 103 | 103 | <a class="collapsible-header black-text"> | |
Classes | 104 | 104 | Classes | |
<i class="mdi-navigation-arrow-drop-down right"></i> | 105 | 105 | <i class="mdi-navigation-arrow-drop-down right"></i> | |
</a> | 106 | 106 | </a> | |
</li> | 107 | 107 | </li> | |
<div class="collapsible-body" style="display: block"> | 108 | 108 | <div class="collapsible-body" style="display: block"> | |
<ul> | 109 | 109 | <ul> | |
<li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections"> | 110 | 110 | <li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections"> | |
<a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a> | 111 | 111 | <a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a> | |
</li> | 112 | 112 | </li> | |
<hr> | 113 | 113 | <hr> | |
<li><a ui-sref="addclass"><i class="tiny mdi-content-add">Add Class</i></a></li> | 114 | 114 | <li><a ui-sref="addclass"><i class="tiny mdi-content-add">Add Class</i></a></li> | |
</ul> | 115 | 115 | </ul> | |
</div> | 116 | 116 | </div> | |
</ul> | 117 | 117 | </ul> | |
<li><a ui-sref="study">Study</a></li> | 118 | 118 | <li><a ui-sref="study">Study</a></li> | |
<li><a ui-sref="settings">Settings</a></li> | 119 | 119 | <li><a ui-sref="settings">Settings</a></li> | |
<li><a ng-click="logout()">Logout</a></li> | 120 | 120 | <li><a ng-click="logout()">Logout</a></li> | |
</ul> | 121 | 121 | </ul> | |
</div> | 122 | 122 | </div> | |
</nav> | 123 | 123 | </nav> | |
124 | 124 | |||
</header> | 125 | 125 | </header> | |
126 | 126 | |||
127 | 127 | |||
<!-- Menu Bar --> | 128 | 128 | <!-- Menu Bar --> | |
<main ui-view></main> | 129 | 129 | <main ui-view></main> | |
130 | 130 | |||
131 | 131 | |||
<!--<footer class="page-footer">--> | 132 | 132 | <!--<footer class="page-footer">--> | |
<!--<div class="footer-copyright">--> | 133 | 133 | <!--<div class="footer-copyright">--> | |
<!--<div class="container">--> | 134 | 134 | <!--<div class="container">--> | |
<!--© 2015 Team Swag--> | 135 | 135 | <!--© 2015 Team Swag--> | |
<!--<a class="grey-text text-lighten-4 right" id="contact" href="mailto:halp@flashy.cards">Concerns? Contact us by--> | 136 | 136 | <!--<a class="grey-text text-lighten-4 right" id="contact" href="mailto:halp@flashy.cards">Concerns? Contact us by--> | |
<!--email!</a>--> | 137 | 137 | <!--email!</a>--> | |
<!--</div>--> | 138 | 138 | <!--</div>--> | |
139 | 139 | |||
<!--</div>--> | 140 | 140 | <!--</div>--> | |
<!--</footer>--> | 141 | 141 | <!--</footer>--> | |
142 | 142 | |||
</body> | 143 | 143 | </body> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> | 144 | 144 | <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> | 145 | 145 | <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> | 146 | 146 | <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> | 147 | 147 | <script src="//code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script type="text/javascript" src="scripts/materialize.js"></script> | 148 | 148 | <script type="text/javascript" src="scripts/materialize.js"></script> | |
<script type="text/javascript" src="scripts/jquery.collapsible.js"></script> | 149 | 149 | <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> | 150 | 150 | <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> | 151 | 151 | <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> | 152 | 152 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-resource.min.js"></script> | 153 | 153 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-resource.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-sanitize.js"></script> | 154 | 154 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-sanitize.js"></script> | |
<script src="static/js/angular-websocket.js"></script> | 155 | 155 | <script src="static/js/angular-websocket.js"></script> | |
<script src="static/js/angular-contenteditable.js"></script> | 156 | 156 | <script src="static/js/angular-contenteditable.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.4/angular-filter.js"></script> | 157 | 157 | <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.4/angular-filter.js"></script> | |
158 | 158 | |||
159 | 159 | |||
<script src="config.js"></script> | 160 | 160 | <script src="config.js"></script> | |
161 | 161 | |||
<script src="scripts/FlashcardFactory.js"></script> | 162 | 162 | <script src="scripts/FlashcardFactory.js"></script> | |
<script src="scripts/DeckFactory.js"></script> | 163 | 163 | <script src="scripts/DeckFactory.js"></script> | |
164 | 164 |
scripts/ClassDropController.js
View file @
562c50e
angular.module('flashy.ClassDropController', ['ui.router']). | 1 | File was deleted | ||
controller('ClassDropController', function($rootScope, $resource, $scope, $state, $http, UserService) { | 2 | |||
$scope.hi = 'hi'; | 3 | |||
$rootScope.SectionResource = $resource('/api/sections/:sectionId/'); | 4 | |||
$rootScope.currentSection = {}; | 5 | |||
$rootScope.UserService = UserService; | 6 | |||
7 | ||||
$scope.dropClass = function(section) { | 8 | |||
$http.post('/api/sections/' + section.id + '/drop/'). | 9 | |||
success(function(data) { | 10 | |||
console.log(section.short_name + ' dropped'); | 11 | |||
12 | ||||
Materialize.toast('Dropped', 3000, 'rounded'); | 13 | |||
}). | 14 | |||
error(function(err) { | 15 | |||
console.log('no drop for you'); | 16 | |||
}); | 17 |
templates/dropclass.html
View file @
562c50e
<div class="row"> | 1 | File was deleted | ||
<div class="col s8 offset-s2"> | 2 | |||
<div class="card-panel" id="dropClassForm"> | 3 | |||
4 | ||||
<h2>Enrolled Classes</h2> | 5 | |||
<div class="row" style="padding: 0px 25px"> | 6 | |||
<table class="hoverable responsive-table"> | 7 | |||
<thead> | 8 | |||
<tr> | 9 | |||
<th data-field="id">Class</th> | 10 | |||
<th data-field="drop">Drop?</th> | 11 | |||
</tr> | 12 | |||
</thead> | 13 | |||
14 | ||||
<tbody> | 15 | |||
<tr ng-repeat="section in UserService.getUserData().sections"> | 16 | |||
<td> | 17 | |||
<span>{{section.short_name}}</span> | 18 | |||
<p>{{section.long_name}}</p> | 19 | |||
</td> | 20 | |||
<td><a href="" ng-click="dropClass(section)"><i class="mdi-content-clear small"></i></a></td> | 21 | |||
</tr> | 22 | |||
</tbody> | 23 | |||
</table> | 24 | |||
</div> | 25 | |||
</div> | 26 |