From a0d3b9b1dd63c425e0ec5e7deb7bde610e757674 Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Fri, 22 May 2015 16:25:56 -0700 Subject: [PATCH] tiny style tweaks --- home.html | 2 +- scripts/FeedController.js | 1 + scripts/FlashcardDirective.js | 22 +++++++++++----------- scripts/LoginController.js | 18 +++++++++--------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/home.html b/home.html index d5aa943..90bce1c 100644 --- a/home.html +++ b/home.html @@ -7,7 +7,7 @@ - Flashy diff --git a/scripts/FeedController.js b/scripts/FeedController.js index b48e9b4..bab042e 100644 --- a/scripts/FeedController.js +++ b/scripts/FeedController.js @@ -4,6 +4,7 @@ angular.module('flashy.FeedController', ['ui.router']). console.log('Hello from feed'); sectionId = $stateParams.sectionId; $scope.cards = []; + var loc = window.location, new_uri; if (loc.protocol === 'https:') { new_uri = 'wss:'; diff --git a/scripts/FlashcardDirective.js b/scripts/FlashcardDirective.js index 09aab71..476e694 100644 --- a/scripts/FlashcardDirective.js +++ b/scripts/FlashcardDirective.js @@ -1,7 +1,7 @@ angular.module('flashy.FlashcardDirective', []). directive('flashcard', ['$http', '$state', '$window', - function ($http, $state, $window) { + function($http, $state, $window) { return { templateUrl: '/app/templates/flashcard.html', restrict: 'E', @@ -9,7 +9,7 @@ angular.module('flashy.FlashcardDirective', []). flashcard: '=flashcardObj', // flashcard-obj in parent html refresh: '&' // eval refresh in parent html }, - link: function (scope, element) { + link: function(scope, element) { /* Handles width of the card */ function refresh_width() { avail = $window.innerWidth - 17; @@ -25,49 +25,49 @@ angular.module('flashy.FlashcardDirective', []). refresh_width(); /* Pulls card from feed into deck */ - scope.pullCard = function (flashcard) { + scope.pullCard = function(flashcard) { if ($state.current.name == 'feed') { $http.post('/api/flashcards/' + flashcard.id + '/pull/', flashcard). - success(function (data) { + success(function(data) { console.log('pulled flashcard #' + flashcard.id); scope.startShrink = true; scope.refresh(); }). - error(function (data) { + error(function(data) { console.log('failed to pull flashcard #' + flashcard.id); }); } }; /* Unpulls card from deck */ - scope.unpullCard = function (flashcard) { + scope.unpullCard = function(flashcard) { if ($state.current.name == 'deck') { console.log('unpulling card...'); $http.post('/api/flashcards/' + flashcard.id + '/unpull/', flashcard). - success(function (data) { + success(function(data) { console.log('card unpull success'); scope.startShrink = true; scope.refresh(); }). - error(function (data) { + error(function(data) { console.log('card unpull FAILURE'); }); } }; /* Hides card from feed */ - scope.hideCard = function (flashcard) { + scope.hideCard = function(flashcard) { if ($state.current.name == 'feed') { $http.post('/api/flashcards/' + flashcard.id + '/hide/', flashcard). - success(function (data) { + success(function(data) { console.log('card hide success'); scope.startShrink = true; scope.refresh(); }). - error(function (data) { + error(function(data) { console.log('card hide FAILURE'); }); } diff --git a/scripts/LoginController.js b/scripts/LoginController.js index 12f9ab8..9339306 100644 --- a/scripts/LoginController.js +++ b/scripts/LoginController.js @@ -1,43 +1,43 @@ angular.module('flashy.LoginController', ['ui.router']). controller('LoginController', ['$rootScope', '$scope', '$state', '$http', 'UserService', - function ($rootScope, $scope, $state, $http, UserService) { + function($rootScope, $scope, $state, $http, UserService) { 'use strict'; // If we're logged in, there's nothing to do here if (UserService.isLoggedIn()) $state.go('addclass'); $scope.uniqueError = false; $scope.loginError = false; - $scope.login = function (email, password) { + $scope.login = function(email, password) { $http.post('/api/login/', JSON.stringify({ 'email': email, 'password': password })). - success(function (data) { + success(function(data) { UserService.setUserData(data); if (angular.isDefined($scope.returnToState)) $state.go($scope.returnToState.name, $scope.returnToStateParams); else $state.go('addclass'); console.log(data); }). - error(function (data, status, header, config) { + error(function(data, status, header, config) { if (data.detail) { // assume 'invalid email or pass' $scope.loginError = true; } console.log(data); }); }; - $scope.signUp = function (email, password) { + $scope.signUp = function(email, password) { $http.post('/api/register/', JSON.stringify({ 'email': email, 'password': password })). - success(function (data) { + success(function(data) { if (angular.isDefined($scope.returnToState)) $state.go($scope.returnToState.name, $scope.returnToStateParams); else $state.go('addclass'); console.log(data); }). - error(function (data, status, headers, config) { + error(function(data, status, headers, config) { console.log(data.email); if (data.email == 'This field is required.') { $scope.invalid = true; @@ -51,10 +51,10 @@ angular.module('flashy.LoginController', ['ui.router']). }); }; - $scope.triggerPasswordReset = function () { + $scope.triggerPasswordReset = function() { $state.go('requestpasswordreset'); }; - $(document).ready(function () { + $(document).ready(function() { $('ul.tabs').tabs(); }); } -- 1.9.1