Skip to content

Commit

Permalink
peep: add a placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
msantos committed Feb 28, 2011
1 parent 03d1cd7 commit 58de876
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Binary file added priv/www/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions priv/www/js/peep.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var peep = function () {
var json = {}; var json = {};
var url = "/web/peep:show"; var url = "/web/peep:show";
var MAX = 9; var MAX = 9;
var PLACEHOLDER = "/default.png";
var slots = _.map(_.range(MAX), function (n) { var slots = _.map(_.range(MAX), function (n) {
return null; return null;
}); });
Expand All @@ -20,7 +21,10 @@ var peep = function () {
}, },
'json': function (v) { 'json': function (v) {
return (v ? json = v : json); return (v ? json = v : json);
} },
'placeholder': function () {
return (PLACEHOLDER);
},
}; };
}(); }();


Expand Down Expand Up @@ -62,7 +66,8 @@ function redraw(json) {
}); });


$.each(nslots, function (n) { $.each(nslots, function (n) {
set_image(nslots[n], n); var img = nslots[n] ? nslots[n] : peep.placeholder();
set_image(img, n);
}); });
peep.slots(nslots); peep.slots(nslots);
} }
Expand Down

0 comments on commit 58de876

Please sign in to comment.