Skip to content

Commit

Permalink
more users
Browse files Browse the repository at this point in the history
  • Loading branch information
laurion committed Oct 12, 2013
1 parent 1e96001 commit 49e324f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
1 change: 0 additions & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
# but you can also edit it by hand.

standard-app-packages
autopublish
insecure
preserve-inputs
4 changes: 2 additions & 2 deletions meteor-hack.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</body>
<template name="table">
<table>
{{#each element}}
{{#each element.value}}
<tr>
{{#each this}}
<td style="background: {{color}}">{{title}}</td>
<td style="background: {{color}}">{{i}} {{j}}</td>
{{/each}}
</tr>
{{/each}}
Expand Down
45 changes: 28 additions & 17 deletions meteor-hack.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
Items = new Meteor.Collection("items");
// Items.insert({data: []})
if (Meteor.isClient) {
data = [];
for(i=0;i<20;i++){
var row=[];
for(j=0;j<20;j++){
row.push({title:(i+" "+j), color: "aa"});
}
data.push(row);
}
// Items.update({Session.get("data"):data});
Session.set("els",data);
Template.table.element = function(){
console.log("wtf");

return Session.get("els");
item = Items.findOne();
return item;
}
Template.table.events({
"click td": function(event){
a = get[]
console.log(this);
item = Items.findOne();
if(item && item.value){
item.value[this.i][this.j].color="blue";
Items.update({_id:item._id},{value:item.value});
}
}
});

});
Meteor.subscribe("items");

}

if(Meteor.isServer){

Meteor.startup(function () {
// code to run on server at startup
});
Meteor.publish("items", function(){
if(!Items.find().count()){
console.log("adding items");
data = [];
for(i=0;i<20;i++){
var row=[];
for(j=0;j<20;j++){
row.push({i:i,j:j, color: ""});
}
data.push(row);
}
Items.insert({value:data});
}
return Items.find();
});
}

0 comments on commit 49e324f

Please sign in to comment.