Skip to content

Commit

Permalink
fixes #10 adding a link to the current repo to the layout
Browse files Browse the repository at this point in the history
  • Loading branch information
bennage committed Mar 23, 2012
1 parent 9697715 commit 66f3001
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 7 deletions.
13 changes: 11 additions & 2 deletions lib/app.js
Expand Up @@ -13,6 +13,8 @@ var auth = require('./auth'),

var app = module.exports = x.createServer();

var current_sha;

__dirname = __dirname + '/..';

app.configure('development', function() {
Expand All @@ -39,6 +41,7 @@ app.configure(function() {
app.use(x['static'](__dirname + '/public'));
app.use(auth.configure(app));
app.use(context);
app.use(add_sha);
app.use(app.router);
});

Expand All @@ -49,21 +52,27 @@ app.configure('production', function() {
}));
});

function add_sha(req, res, next) {
req.sha = current_sha;
next();
}

viewhelpers.initialize(app);

app.get('/', routes.index);

app.get('/update', function(req, res) {

var src = path.join('./source'),
tgt = path.join('./markdown');

github(config.source.repo, src, config.source.ignore, function(err, sha) {

console.log('downloading complete: ' + sha);

var imageRoot = 'https://raw.github.com/' + config.source.repo + '/' + sha;
convert(src, tgt, imageRoot, function() {
current_sha = sha;
res.redirect('/index');
});
});
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/client.js
Expand Up @@ -172,7 +172,7 @@
}

function setup_document_list(documents) {
var el = $('#docs');
var el = $('#docs select');

documents.forEach(function(doc) {
el.append('<option>' + doc + '</option>');
Expand Down
15 changes: 15 additions & 0 deletions public/stylesheets/layout.styl
Expand Up @@ -10,10 +10,25 @@ html
height 100%
width 100%

header
height 64px

.pad
height 100%
h1, #docs, #repo
display table-cell
width 1px
vertical-align middle
padding-right 16px

header,footer
display table-row
width 100%

.pad
display table
width 100%

#main
display table-row
height 100%
Expand Down
21 changes: 20 additions & 1 deletion public/stylesheets/style.css
Expand Up @@ -230,11 +230,30 @@ html {
height: 100%;
width: 100%;
}
.root header {
height: 64px;
}
.root header .pad {
height: 100%;
}
.root header .pad h1,
.root header .pad #docs,
.root header .pad #repo {
display: table-cell;
width: 1px;
vertical-align: middle;
padding-right: 16px;
}
.root header,
.root footer {
display: table-row;
width: 100%;
}
.root header .pad,
.root footer .pad {
display: table;
width: 100%;
}
.root #main {
display: table-row;
height: 100%;
Expand Down Expand Up @@ -365,7 +384,7 @@ body footer .pad {
padding: 1em;
margin: 1em 1em 1em 0em;
position: fixed;
top: 78px;
top: 64px;
right: 0;
}
#comments .comment-body {
Expand Down
2 changes: 1 addition & 1 deletion public/stylesheets/style.styl
Expand Up @@ -90,7 +90,7 @@ body
padding 1em
margin 1em 1em 1em 0em
position fixed
top 78px
top 64px
right 0

.comment-body
Expand Down
9 changes: 7 additions & 2 deletions views/layout.jade
Expand Up @@ -16,8 +16,12 @@ html
h1
a(href='/') pundit

select#docs
option(selected,data-default) --choose a document--
#docs
select
option(selected,data-default) --choose a document--

#repo
a(href='https://github.com/mspnp/cqrs-journey-doc/tree/' + request.sha) repo

#account
- if (!user)
Expand All @@ -29,6 +33,7 @@ html
&nbsp;
a(href='/logout') [Sign Out]


section#main!= body

footer
Expand Down

0 comments on commit 66f3001

Please sign in to comment.