Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added HTML rendering back

  • Loading branch information...
commit 76d47cc551d9bfe5b1e89cb9c65b99394565bef1 1 parent 7d5cc3d
Alex Young authored
18 app.js
... ... @@ -1,12 +1,12 @@
1   -var express = require('express@2.0.0beta3'),
2   - connect = require('connect@1.0.6'),
3   - jade = require('jade@0.8.6'),
  1 +var express = require('express@2.2.2'),
  2 + connect = require('connect@1.3.0'),
  3 + jade = require('jade@0.10.4'),
4 4 app = module.exports = express.createServer(),
5   - mongoose = require('mongoose@1.1.4'),
6   - mongoStore = require('connect-mongodb@0.2.1'),
  5 + mongoose = require('mongoose@1.2.0'),
  6 + mongoStore = require('connect-mongodb@0.2.2'),
7 7 mailer = require('mailer@0.4.52'),
8   - stylus = require('stylus@0.7.4'),
9   - markdown = require('markdown').markdown,
  8 + stylus = require('stylus@0.11.10'),
  9 + markdown = require('markdown@0.2.1').markdown,
10 10 sys = require('sys'),
11 11 path = require('path'),
12 12 models = require('./models'),
@@ -404,6 +404,10 @@ app.post('/search.:format?', loadUser, function(req, res) {
404 404 return { title: d.title, id: d._id };
405 405 }));
406 406 break;
  407 +
  408 + default:
  409 + res.send('Format not available', 400);
  410 + break;
407 411 }
408 412 });
409 413 });
14 package.json
@@ -11,13 +11,13 @@
11 11 "node": ">= 0.4.0"
12 12 },
13 13 "dependencies": {
14   - "express": "2.0.0beta3",
15   - "mongoose": "1.1.4",
16   - "connect": "1.0.6",
17   - "connect-mongodb": "0.2.1",
18   - "jade": "0.8.6",
19   - "markdown": "0.2.0",
20   - "stylus": "0.7.4",
  14 + "express": "2.2.2",
  15 + "mongoose": "1.2.0",
  16 + "connect": "1.3.0",
  17 + "jade": "0.10.4",
  18 + "connect-mongodb": "0.2.2",
  19 + "markdown": "0.2.1",
  20 + "stylus": "0.11.10",
21 21 "mailer": "0.4.52"
22 22 },
23 23 "bin": {
22 public/javascripts/application.js
@@ -9,7 +9,11 @@
9 9 Collection: Documents,
10 10
11 11 url: function() {
12   - return this.get('id') ? '/documents/' + this.get('id') + '.json' : '/documents.json';
  12 + return this.urlWithFormat('json');
  13 + },
  14 +
  15 + urlWithFormat: function(format) {
  16 + return this.get('id') ? '/documents/' + this.get('id') + '.' + format : '/documents.json';
13 17 },
14 18
15 19 display: function() {
@@ -92,7 +96,8 @@
92 96 el: $('#controls'),
93 97
94 98 events: {
95   - 'click #save-button': 'save'
  99 + 'click #save-button': 'save',
  100 + 'click #html-button': 'showHTML'
96 101 },
97 102
98 103 initialize: function(model) {
@@ -112,8 +117,19 @@
112 117 },
113 118
114 119 showHTML: function(e) {
  120 + var model = this.model;
115 121 e.preventDefault();
116   - // TODO
  122 + $.get(this.model.urlWithFormat('html'), function(data) {
  123 + console.log($(window).height());
  124 + $('#html-container').html(data);
  125 + $('#html-container').dialog({
  126 + title: model.get('title'),
  127 + autoOpen: true,
  128 + modal: true,
  129 + width: $(window).width() * 0.95,
  130 + height: $(window).height() * 0.90
  131 + });
  132 + });
117 133 }
118 134 });
119 135
19 public/stylesheets/style.css
@@ -182,13 +182,24 @@ ul.toolbar a:active {
182 182 }
183 183 #html-container {
184 184 padding: 10px;
185   - border-bottom: 2px solid #c5c5c5;
186 185 background-color: #f6f6f6;
187   - margin-bottom: 10px;
188   -}
189   -#html-container p {
  186 + font-size: 110%;
  187 +}
  188 +#html-container p,
  189 +#html-container ul,
  190 +#html-container ol,
  191 +#html-container li,
  192 +#html-container h1,
  193 +#html-container h2,
  194 +#html-container h3,
  195 +#html-container h4,
  196 +#html-container h5,
  197 +#html-container h6 {
190 198 margin: 10px 0;
191 199 }
  200 +#html-container li {
  201 + margin-left: 20px;
  202 +}
192 203 #html-button.active {
193 204 background-color: #dfe3ea;
194 205 }
19 public/stylesheets/style.styl
@@ -198,13 +198,24 @@ ul.toolbar a:active
198 198
199 199 #html-container
200 200 padding 10px
201   - border-bottom 2px solid highlight-colour
202 201 background-color light-grey
203   - margin-bottom 10px
204   -
205   -#html-container p
  202 + font-size 110%
  203 +
  204 +#html-container p,
  205 +#html-container ul,
  206 +#html-container ol,
  207 +#html-container li,
  208 +#html-container h1,
  209 +#html-container h2,
  210 +#html-container h3,
  211 +#html-container h4,
  212 +#html-container h5,
  213 +#html-container h6
206 214 margin 10px 0
207 215
  216 +#html-container li
  217 + margin-left 20px
  218 +
208 219 #html-button.active
209 220 background-color active-colour
210 221

0 comments on commit 76d47cc

Please sign in to comment.
Something went wrong with that request. Please try again.