Fix the comments (counter) in the generated draggable HTML for now

This is necessary to give the draggable div a nice, fixed initial height.
This commit is contained in:
Paul van Tilburg 2012-02-14 18:48:02 +01:00
parent e7c1bdc461
commit 063ab8612e
2 changed files with 6 additions and 4 deletions

4
app.js
View File

@ -298,7 +298,7 @@ app.get('/draggables/:id', function(req, res) {
file_contents = fs.readFileSync(__dirname + "/public/upload/" + drag.name, 'utf8');
content = '<pre>' + escapeHTML(file_contents) + '</pre>';
break;
case 'application': // FIXME: treat as code for now, but it is probably wrong
case "application": // FIXME: treat as code for now, but it is probably wrong
file_contents = fs.readFileSync(__dirname + "/public/upload/" + drag.name, 'utf8');
content = '<pre><code class="' + drag.type + '">' +
escapeHTML(file_contents) +
@ -314,7 +314,7 @@ app.get('/draggables/:id', function(req, res) {
'<h2><span class="title">' + title + '</span>' +
'<div class="delete" title="Delete…">&#10799;</div>' +
'<div class="download" title="Download…">&#8595;</div>' +
'</h2>' + content + '<div class="comments"></div>' +
'</h2>' + content + '<div class="comments">Comments (0)</div>' +
'</div>');
});

View File

@ -29,8 +29,10 @@ $(document).ready(function() {
cancel: 'Cancel',
style: 'inherit' });
// FIXME: actually get the comments!
this.find(".comments").text("Comments (0)").hide();
// Highlight contained code.
//this.find(".comments").text("Comments (0)");
// Fix the height of the pre block. FIXME: can this be improved?
this.find("pre").css({ height: (this.height() - 80) + "px" });
// Highlight contained code in the pre block.
this.find("pre code").each(function(idx, elem) {
hljs.highlightBlock(elem, ' ');
});