From 1b2fe2fdfe75316fa0c22611d4b0beeda78585c2 Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Tue, 19 May 2015 18:18:31 -0700 Subject: [PATCH] fixed view feed button on deck view --- scripts/DeckController.js | 73 ++++++++++++++++++++++++----------------------- templates/deck.html | 34 ++++++++++------------ 2 files changed, 52 insertions(+), 55 deletions(-) diff --git a/scripts/DeckController.js b/scripts/DeckController.js index fb3a969..78c8ea6 100644 --- a/scripts/DeckController.js +++ b/scripts/DeckController.js @@ -1,42 +1,43 @@ var app = angular.module('flashy.DeckController', ['ui.router']); app.controller('DeckController', ['$scope', '$state', '$http', '$stateParams', - function($scope, $state, $http, $stateParams) { + function ($scope, $state, $http, $stateParams) { // cards array sectionId = $stateParams.sectionId; + $scope.sectionId = sectionId; $scope.cards = []; - // Populate our page with cards. - $http.get('/api/sections/' + sectionId + '/deck/'). - success(function(data) { - console.log(data); - $scope.cards = data; - }). - error(function(err) { - console.log('pulling feed failed'); - }); - - /* Lets page refresh the cards shown on the page. */ - $scope.refreshCards = function() { - var myDelay = 260; // ms - - setTimeout(function() { - $http.get('/api/sections/' + sectionId + '/deck/'). - success(function(data) { - console.log(data); - $scope.cards = data; - console.log('success in refresh cards...'); - }). - error(function(err) { - console.log('refresh fail'); - }); - }, myDelay); - } - - - /* all kmach's stuff below, do not touch */ - // reorganize cards in array based on time - $scope.filter = function(card) { + // Populate our page with cards. + $http.get('/api/sections/' + sectionId + '/deck/'). + success(function (data) { + console.log(data); + $scope.cards = data; + }). + error(function (err) { + console.log('pulling feed failed'); + }); + + /* Lets page refresh the cards shown on the page. */ + $scope.refreshCards = function () { + var myDelay = 260; // ms + + setTimeout(function () { + $http.get('/api/sections/' + sectionId + '/deck/'). + success(function (data) { + console.log(data); + $scope.cards = data; + console.log('success in refresh cards...'); + }). + error(function (err) { + console.log('refresh fail'); + }); + }, myDelay); + }; + + + /* all kmach's stuff below, do not touch */ + // reorganize cards in array based on time + $scope.filter = function (card) { // get index of card var index = $scope.cards.indexOf(card); @@ -47,7 +48,7 @@ app.controller('DeckController', ['$scope', '$state', '$http', '$stateParams', }; // remove card from deck - $scope.removeCard = function(card) { + $scope.removeCard = function (card) { // get index of card var index = $scope.cards.indexOf(card); @@ -58,7 +59,7 @@ app.controller('DeckController', ['$scope', '$state', '$http', '$stateParams', }; - $scope.editCard = function(card) { + $scope.editCard = function (card) { var index = $scope.cards.indexOf(card); @@ -67,12 +68,12 @@ app.controller('DeckController', ['$scope', '$state', '$http', '$stateParams', opacity: .5, // Opacity of modal background in_duration: 300, // Transition in duration out_duration: 200, // Transition out duration - ready: function() { + ready: function () { $scope.editableContent = $scope.cards[index].content; }, // Callback for Modal open - complete: function() { + complete: function () { $scope.cards[index].content = $scope.editableContent; diff --git a/templates/deck.html b/templates/deck.html index 7c81648..5559e5b 100644 --- a/templates/deck.html +++ b/templates/deck.html @@ -1,12 +1,12 @@ 
- View Feed + View Feed
- + - -- 1.9.1