Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by Mike on 6/27/14.
- */
- angular.module("scorePortalApp")
- .controller('indexController',function($scope, $rootScope, loginService, indexInviteService,$splash){
- //Google Sign In
- $scope.$on('event:google-plus-signin-success', function (event, authResult) {
- // User successfully authorized the G+ App!
- console.log('Signed in!');
- loginService.authenticate(authResult).success(function(data, status, headers, config){
- $rootScope.$state.go('home');
- //$rootScope.$state.go(data.nextPage);
- });
- });
- $scope.$on('event:google-plus-signin-failure', function (event, authResult) {
- // User has not authorized the G+ App!
- console.log('Not signed into Google Plus.');
- });
- $scope.schools = ["Arcadia High School",
- "Alhambra High School",
- "San Gabriel High School",
- "Mark Keppel High",
- "San Marino High School",
- "Leuzinger High School",
- "Lawndale High School",
- "John Glenn High School",
- "La Mirada High School",
- "Norwalk High School",
- "Berkeley High School",
- "Camino Nuevo Charter Academy No. 4",
- "New Millennium Secondary",
- "Los Angeles Leadership Academy",
- "Celerity Nascent Charter",
- "Academia Moderna",
- "Los Angeles Academy of Arts & Enterprise Charter",
- "Crenshaw Arts-Technology Charter High",
- "Global Education Academy",
- "New Los Angeles Charter",
- "Los Angeles Big Picture High",
- "Vista Charter Middle",
- "Larchmont Charter",
- "Watts Learning Center",
- "Extera Public",
- "TEACH Academy of Technologies",
- "Academy of Science and Engineering",
- "New Heights Charter",
- "Apple Academy Charter Public",
- "Ararat Charter",
- "Goethe International Charter",
- "City Charter Middle",
- "N.E.W. Academy Canoga Park",
- "James Jordan Middle",
- "Discovery Charter Preparatory No. 2",
- "Fenton Primary Center",
- "North Valley Charter Academy",
- "Crown Preparatory Academy",
- "Center for Advanced Learning",
- "Aspire Pacific Academy",
- "Gateway High"];
- $scope.request = {
- 'firstName':'',
- 'lastName':'',
- 'email':'',
- 'schoolName':''
- };
- $scope.elementStates = {
- //Control Error Message Collapse
- errorCollapse:true,
- //Disable submit button on submitting
- submitButtonEnable:true,
- //fa-refresh icon
- submitting:false,
- //If form submit was successful
- success:false
- };
- $scope.requestInvite = function(){
- //Disable Submit Button
- $scope.elementStates.submitButtonEnable = false;
- //Show Spinner
- $scope.elementStates.submitting = true;
- console.log($scope.elementStates);
- console.log($scope.request);
- indexInviteService.requestInvite($scope.request)
- .success(function(data, status, headers, config){
- //Collapse Error
- $scope.elementStates.errorCollapse = true;
- //Show Success Message
- $scope.elementStates.success = true;
- })
- .error(function(data, status, headers, config){
- //Show Error
- $scope.elementStates.errorCollapse = false;
- //Re-Enable Submit Button
- $scope.elementStates.submitButtonEnable = true;
- //Disable Spinner Icon, Restore Text
- $scope.elementStates.submitting = false;
- //Form was not successfully submitted
- $scope.elementStates.success = false;
- });
- };
- //TOS
- $scope.showTos = function () {
- $splash.open({
- type: 'tos'
- });
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement