Permalink
Browse files

Rudimentary boarding

  • Loading branch information...
1 parent f5352d6 commit d6afa03b4d1b25b4e6db0218e7ba8f97ca7b4835 Alex Hu committed Mar 6, 2012
Showing with 21 additions and 3 deletions.
  1. +19 −0 public/application.js
  2. +1 −2 server.js
  3. +1 −1 views/index.jade
View
@@ -35,8 +35,27 @@ $(function(){
render: function() {
var that = this;
+
+ var width = 192;
+ var columns = [];
+ var columnNum = 4;
+ for(var i = 0; i < columnNum; i += 1) {
+ columns[i] = 0;
+ };
_.each(Pinnits.models, function(model) {
this.$('#columnContainer').append(that.pinTemplate({model: model}));
+ var pin = this.$('#columnContainer').children().last();
+
+ var column = 0;
+ for(var i = 0; i < columnNum; i+= 1) {
+ if(columns[i] < columns[column]) {
+ column = i;
+ };
+ };
+ var left = column * width;
+ var top = columns[column] + $(pin).height();
+ $(pin).css({'top': top, 'left': left});
+ columns[column] += $(pin).height();
});
}
});
View
@@ -1,7 +1,6 @@
var http = require('http');
var express = require('express');
var jade = require('jade');
-var sass = require('sass');
var app = express.createServer();
app.set('view options',{layout: false});
@@ -32,4 +31,4 @@ app.get('/', function(req, res) {
});
-app.listen(3000);
+app.listen(8080);
View
@@ -6,7 +6,7 @@ html(lang='en')
script(type='text/javascript', src='js/lib/underscore.js');
script(type='text/javascript', src='js/lib/backbone.js');
- link(href='styles/pinnit.css rel='stylesheet')
+ link(href='styles/pinnit.css', rel='stylesheet')
script(type='text/javascript', src='/application.js');
body
div#container

0 comments on commit d6afa03

Please sign in to comment.