Skip to content

Commit d552df2

Browse files
big changes
1 parent 036e793 commit d552df2

11 files changed

Lines changed: 118 additions & 51 deletions

File tree

public/images/logo.png

30.4 KB
Loading

public/images/new-project.png

3.09 KB
Loading

public/js/app.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
$(function(){
22

3+
$('.projects').masonry({
4+
itemSelector: '.project',
5+
columnWidth: function( containerWidth ) {
6+
return containerWidth / 4;
7+
}
8+
9+
});
310
$('.modal').modal({show: false});
411

512
$('.join').click(function(e){
613
e.preventDefault();
714
var self = this;
8-
15+
if(!window.username) window.location = 'http://local.host:3000/auth/twitter';
916
$.get($(this).attr('href'), function(data){
1017
if(data == 1) {
1118
$(self).attr('href', $(self).attr('href').replace('join','leave'));
@@ -23,20 +30,22 @@ $(function(){
2330
});
2431

2532
$('.edit').click(function(e){
33+
if(!window.username.length) window.location = 'http://local.host:3000/auth/twitter';
2634
e.preventDefault();
2735
$('#editProject').load($(this).attr('href'), function(){
2836
$('#editProject').modal('show');
2937
});
3038
});
3139

3240
$('.read').click(function(e){
33-
41+
if(!window.username.length) window.location = 'http://local.host:3000/auth/twitter';
3442
e.preventDefault();
3543
$(this).next().show();
3644
$(this).remove();
3745
});
3846

3947
$('.accept,.decline').live('click', function(e){
48+
if(!window.username.length) window.location = 'http://local.host:3000/auth/twitter';
4049
e.preventDefault();
4150
var self = this;
4251
$.get($(this).attr('href'), function(){

public/js/isotope.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/styles/bootstrap-responsive.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/styles/main.css

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
.cancel { margin-left: 10px; margin-right: 10px; }
1010

11-
.projects { margin-top: 20px; margin-left: 100px; }
11+
.projects { margin-top: 20px; }
1212

13-
.projects .project { height: 233px; overflow: hidden; }
13+
.projects .project { width: 20%; overflow: hidden; }
1414

1515
.form-search { margin-top: -15px }
1616
.form-search button { margin-left: 20px; }
@@ -21,3 +21,42 @@
2121
.users li span { font-size: 0.9em; }
2222

2323
.more { display: none; }
24+
25+
26+
.logo {
27+
28+
}
29+
30+
.header {
31+
margin-top: 30px;
32+
}
33+
34+
.header .form-search {
35+
margin-top: 30px;
36+
}
37+
38+
.header .newProject {
39+
right: 0;
40+
padding: 23px;
41+
background-color: #c83737;
42+
background-image: none;
43+
}
44+
45+
.project .title {
46+
height: 54px;
47+
overflow: hidden;
48+
}
49+
50+
.project .description {
51+
min-height: 72px;
52+
overflow: hidden;
53+
}
54+
55+
.header .newProject {
56+
text-indent: -999em;
57+
background: transparent;
58+
}
59+
60+
.header .newProject img {
61+
height: 75px;
62+
}

reload.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var redis = require('redis');
2+
3+
var client = redis.createClient();
4+
5+
client.keys('hhba:*', function(err, keys){
6+
client.del(keys);
7+
});

routes/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ var isOwner = function(req, res, next){
2020
};
2121

2222
app.get('/', function(req, res){
23-
if(req.isAuthenticated()){
24-
res.redirect('/dashboard');
25-
} else {
26-
res.render('index');
27-
}
23+
res.redirect('/dashboard');
2824
});
2925

30-
app.get('/dashboard', isAuth, function(req, res){
26+
app.get('/dashboard', function(req, res){
3127
client.keys('hhba:projects:*', function(err, keys){
3228
client.mget(keys, function(err, projects){
3329
projects = projects || [];
@@ -197,7 +193,11 @@ app.post('/projects/edit/:id', isAuth, isOwner, function(req, res){
197193

198194
project.title = req.body.title;
199195
project.description = req.body.description;
200-
project.links = req.body.links.split(',') || [];
196+
if(project.links.length) {
197+
project.links = req.body.links.split(',');
198+
} else {
199+
project.links = [];
200+
}
201201

202202
client.set('hhba:projects:' + req.params.id, JSON.stringify(project), function(){
203203
search.remove(req.params.id, function(){

views/dashboard.jade

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,45 @@ extends layout
22

33
block content
44

5-
.row
6-
.span4
7-
h1 Projects
5+
.row-fluid.header
6+
.span3.logo
7+
img(src="/images/logo.png", width="225")
88

9-
.span4
9+
.span3
10+
.span3
1011
form.well.form-search(action="/search", method="get")
1112
input.input-medium.search-query(type="text", name="q")
12-
button.btn(type="submit") Search
13+
button.btn(type="submit") Buscar
1314

14-
.span2.offset2
15-
a.newProject.btn.btn-primary(href="#newProject", data-toggle="modal") New project
15+
.span3
16+
a.span12.newProject(href="#newProject", data-toggle="modal")
17+
img.span12(src="/images/new-project.png")
1618

17-
.row.projects
18-
each project in projects
19-
.span4.project.well
20-
h3 #{project.title}
19+
.row-fluid.projects
20+
each project, index in projects
21+
.project.well
22+
h3.title #{project.title}
2123
p
22-
strong (@#{project.owner_username})
23-
p
24-
strong Description:
25-
| #{project.description.replace(/\n/, '<br />')}
24+
strong (@#{project.owner_username})
25+
- if(user && project.owner_id == user.id){
26+
a.edit(href="/projects/edit/" + project.id) Edit project
27+
- } else if(user && project.contributors.indexOf(user.username) !== -1){
28+
a.join(href="/projects/leave/" + project.id) Leave project
29+
- } else {
30+
a.join(href="/projects/join/" + project.id) Join project
31+
- }
32+
p.description
33+
| #{project.description.replace('\n', '<br />')}
2634

2735
p
28-
strong Links:
29-
ul
30-
each link in project.links
31-
li
36+
each link, index in project.links
37+
if(index != project.links.length - 1)
38+
a(href=link, target="blank")= link
39+
| |
40+
else
3241
a(href=link, target="blank")= link
3342

34-
p
35-
- if(project.owner_id == user.id){
36-
a.edit.btn(href="/projects/edit/" + project.id) Edit project
37-
- } else if(project.contributors.indexOf(user.username) !== -1){
38-
a.join.btn(href="/projects/leave/" + project.id) Leave project
39-
- } else {
40-
a.join.btn(href="/projects/join/" + project.id) Join project
41-
- }
43+
4244

4345
ul.users
4446
each contrib in project.contributors
@@ -58,7 +60,7 @@ block content
5860
.control-group
5961
label.control-label(for="description") Description
6062
.controls
61-
textarea(class="input-xlarge", id="description", name="description", rows="3")
63+
textarea(class="input-xlarge", id="description", name="description", rows="3", maxlength="400")
6264

6365
.control-group
6466
label.control-label(for="links") Links (comma separated)
@@ -69,9 +71,9 @@ block content
6971
button.btn.btn-primary(type="submit") Create project
7072
button.btn.cancel Cancel
7173

72-
7374
#editProject.modal.hide
7475

76+
if(!user) user = {username: ''}
77+
7578
script()
7679
window.username = '#{user.username}';
77-

views/edit.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ form.form-horizontal(action="/projects/edit/" + project.id, method="POST")
99
.control-group
1010
label.control-label(for="description") Description
1111
.controls
12-
textarea(class="input-xlarge", id="description", name="description", rows="3")= project.description
12+
textarea(class="input-xlarge", id="description", name="description", rows="5", maxlength="400")= project.description
1313

1414
.control-group
1515
label.control-label(for="links") Code Repository

0 commit comments

Comments
 (0)