Commit 20771fdcb137195a03199305a89ba7d3d8cf8d8f

Authored by Andrew Buss
1 parent 57d997404b

push sorta works

Showing 2 changed files with 26 additions and 25 deletions Side-by-side Diff

... ... @@ -50,14 +50,9 @@
50 50 ul.side-nav.fixed li.class a{
51 51 font-size:24px;
52 52 height: 36px;
  53 + line-height: normal;
53 54 }
54 55  
55   -ul.side-nav.fixed li ul li {
56   - /*line-height: 30px;*/
57   - /*font-weight:700;*/
58   - margin-left:20px;
59   -}
60   -
61 56 ul.side-nav.fixed li a {
62 57 /*line-height: 30px;*/
63 58 /*font-weight:700;*/
... ... @@ -159,7 +154,7 @@
159 154 .center-me {
160 155 margin: 0 auto;
161 156 text-align: center;
162   - vertical-align: center;
  157 + vertical-align: middle;
163 158 }
164 159  
165 160 .container {
scripts/FeedController.js View file @ 20771fd
1 1 angular.module('flashy.FeedController', ['ui.router']).
2 2  
3   - controller('FeedController', ['$scope', '$stateParams', '$state', '$http', function($scope, $stateParams, $state, $http) {
  3 + controller('FeedController', ['$scope', '$stateParams', '$state', '$http', function ($scope, $stateParams, $state, $http) {
4 4 console.log('Hello from feed');
5 5 sectionId = $stateParams.sectionId;
6 6 $scope.cards = [];
7 7  
8   - $scope.cards[0] = {'id': 1, 'title': 'title1', 'content': 'abc'};
9   - $scope.cards[1] = {'id': 2, 'title': 'title2', 'content': 'xyz'};
  8 + $scope.cards[0] = {'id': 0, 'title': 'title1', 'content': 'abc'};
  9 + $scope.cards[1] = {'id': 1, 'title': 'title2', 'content': 'xyz'};
10 10 $scope.cards[2] = {'id': 2, 'title': 'title3', 'content': 'qwe'};
11 11  
12   - $http.get('/api/sections/' + sectionId + '/flashcards/').
13   - success(function(data) {
  12 + $http.get('/api/sections/' + sectionId + '/feed/').
  13 + success(function (data) {
14 14 for (var i = 0; i < data.length; i++) {
15   - cards.push({'title': data[i].title, 'content': data[i].content});
  15 + $scope.cards.push({'title': data[i].title, 'content': data[i].text});
16 16 }
17 17 }).
18   - error(function(err) {
19   - console.log('no');
  18 + error(function (err) {
  19 + console.log('pulling feed failed');
20 20 });
21 21  
22   - $scope.viewDeck = function() {
  22 + $scope.viewDeck = function () {
23 23 $state.go('deck', {sectionId: sectionId});
24 24 console.log('go to deck');
25 25 };
26 26  
27   - $scope.pullCard = function(card) {
  27 + $scope.pullCard = function (card) {
28 28 var index = $scope.cards.indexOf(card);
29 29  
30 30 console.log($scope.cards[index]);
31 31 };
32 32  
33   - $scope.pushCard = function() {
  33 + $scope.pushCard = function () {
34 34 console.log('make! card content:' + $scope.text);
35 35 var pushed = new Date(Date.now());
36 36 console.log(pushed.toString());
37   -
  37 + text = $scope.text;
38 38 // attempt to make card :(
39   - $http.post('/api/flashcards/', {'text': $scope.text, 'pushed': pushed, 'mask': []}).
40   - success(function(data) {
41   - console.log('No way, really?');
  39 + $http.post('/api/flashcards/', {
  40 + 'text': $scope.text,
  41 + 'material_date': pushed,
  42 + 'mask': '[]',
  43 + section: sectionId
  44 + }).
  45 + success(function (data) {
  46 + console.log('pushed a card!');
  47 + $scope.cards.push({content: text});
42 48 }).
43   - error(function(error) {
  49 + error(function (error) {
44 50 console.log('haha, n00b');
45 51 });
46 52  
47 53  
... ... @@ -48,10 +54,10 @@
48 54 };
49 55  
50 56 $scope.flashcard = 'hi i am a flashcard. I need to be really long and awesome I ain\'t ' +
51   - 'know how long I am right now. Is it good enough now?????????? Howz about now???';
  57 + 'know how long I am right now. Is it good enough now?????????? Howz about now???';
52 58 $scope.text = '';
53 59  
54   - $(document).ready(function() {
  60 + $(document).ready(function () {
55 61 // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
56 62 $('.modal-trigger').leanModal({
57 63 dismissible: true, // Modal can be dismissed by clicking outside of the modal