Commit 35b02d3f264164604a9a7de63e4fa699017d73d0

Authored by Andrew Buss
1 parent 7ef9e631f1

initialize deck_cards to empty

Showing 4 changed files with 3 additions and 73 deletions Side-by-side Diff

casper_test.js View file @ 35b02d3
1   -phantom.casperPath = 'path/to/node_modules/casperjs';
2   -phantom.injectJs('path/to/node_modules/casperjs/bin/bootstrap.js');
3   -
4   -phantom.casperTest = true;
5   -
6   -
7   -//var casper = require('casper');
8   -var x = require('casper').selectXPath;
9   -
10   -casper.start('http://google.com/', function() {
11   - this.echo(this.getTitle());
12   - this.assertExists(x('//*[@id="gbqfbb"]'), 'the element exists');
13   -});
14   -
15   -casper.run();
16   -
17   -
scripts/CardGridController.js View file @ 35b02d3
... ... @@ -117,9 +117,11 @@
117 117 $timeout($scope.refreshColumnWidth);
118 118 };
119 119  
  120 +
  121 + $scope.deck_cards = [];
120 122 $http.get('/api/sections/' + $scope.sectionId + '/deck/').
121 123 success(function(data) {
122   - $scope.deck_cards = [];
  124 +
123 125 for (i in data) $scope.deck_cards[data[i].id] = data[i];
124 126 console.log("got user's deck");
125 127 }).

396 Bytes

ws_debug.html View file @ 35b02d3
1   -<!DOCTYPE html>
2   -<html>
3   -<head lang="en">
4   - <meta charset="UTF-8">
5   - <title></title>
6   -</head>
7   -<body>
8   -<ul>
9   -
10   -</ul>
11   -</body>
12   -<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
13   -<script>
14   - var loc = window.location, new_uri;
15   - if (loc.protocol === "https:") {
16   - new_uri = "wss:";
17   - } else {
18   - new_uri = "ws:";
19   - }
20   - new_uri += "//" + loc.host;
21   - var ws = new WebSocket(new_uri + '/ws/deck/496?subscribe-user');
22   - ws.onopen = function () {
23   - console.log("websocket connected");
24   - };
25   - ws.onmessage = function (e) {
26   - $('ul').append('<li>' + e.data + '</li>');
27   - };
28   - ws.onerror = function (e) {
29   - console.error(e);
30   - };
31   - ws.onclose = function (e) {
32   - console.log("connection closed");
33   - };
34   - function send_message(msg) {1
35   - ws.send(msg);
36   - }
37   - var ws = new WebSocket(new_uri + '/ws/feed/496?subscribe-broadcast');
38   - ws.onopen = function () {
39   - console.log("websocket connected");
40   - };
41   - ws.onmessage = function (e) {
42   - $('ul').append('<li>' + e.data + '</li>');
43   - };
44   - ws.onerror = function (e) {
45   - console.error(e);
46   - };
47   - ws.onclose = function (e) {
48   - console.log("connection closed");
49   - };
50   - function send_message(msg) {
51   - ws.send(msg);
52   - }
53   -</script>
54   -</html>