Skip to content

Commit

Permalink
Upgraded to derby 0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards committed Jan 18, 2012
1 parent 9e370e1 commit 7303639
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/play/index.js
Expand Up @@ -11,9 +11,9 @@ get('/play/:gameId?', function(page, model, params) {
model.subscribe({ _game: 'game.' + params.gameId }, function() {
var nextPlayerCount = (model.get('_game.players.length') || 0) + 1;

model.push('_game.players', { name: "Player " + nextPlayerCount, });
model.push('_game.players', { name: "Player " + nextPlayerCount });
model.set('_game.playerCount', nextPlayerCount);
model.set('_player', model.ref('_game.players.' + (nextPlayerCount - 1)));
model.ref('_player', '_game.players.' + (nextPlayerCount - 1));

page.render({
gameId: gameId,
Expand All @@ -25,7 +25,7 @@ get('/play/:gameId?', function(page, model, params) {
// CONTROLLER FUNCTIONS //

ready(function(model) {
model.on('push', '_game.players.*.cards', function(playerIndex, card){
model.on('push', '_game.players.*.cards', function(playerIndex, card) {
jQuery(".card").draggable({
start: function(event, ui) {
jQuery(this).css('cursor', 'move');
Expand All @@ -34,14 +34,13 @@ ready(function(model) {
},

stop: function(event, ui) {
var movedElement = $(this);
var cardIndex = movedElement.data("card-index");
var playerIndex = movedElement.data("owner-index");
var element = $(this);
var card = model.at(element);
var top = ui.position.top + "px";
var left = ui.position.left + "px";

movedElement.css('cursor', 'default');
model.set("_game.players." + playerIndex + ".cards." + cardIndex + ".position", { top: top, left: left });
element.css('cursor', 'default');
card.set('position', { top: top, left: left });
}
});
});
Expand Down
1 change: 1 addition & 0 deletions views/play/index.html
Expand Up @@ -4,6 +4,7 @@
<Scripts:>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="/javascripts/skyhopper.js"></script>

<Body:>
<h1>Welcome ((_player.name))</h1>
Expand Down

0 comments on commit 7303639

Please sign in to comment.