summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/response.js')
-rw-r--r--lib/response.js98
1 files changed, 50 insertions, 48 deletions
diff --git a/lib/response.js b/lib/response.js
index 6503e0a8..640e83bf 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -20,19 +20,19 @@ var Note = require("./note.js");
var md = require('reveal.js/plugin/markdown/markdown');
var Mustache = require('mustache');
+//reveal.js
var opts = {
userBasePath: process.cwd(),
revealBasePath: path.resolve(require.resolve('reveal.js'), '..', '..'),
- template: fs.readFileSync(path.join('.', 'templates', 'reveal.html')).toString(),
- templateListing: fs.readFileSync(path.join('.', 'templates', 'listing.html')).toString(),
- theme: 'css/theme/league.css',
+ template: fs.readFileSync(path.join('.', '/public/views/templates', 'reveal.html')).toString(),
+ templateListing: fs.readFileSync(path.join('.', '/public/views/templates', 'listing.html')).toString(),
+ theme: 'css/theme/black.css',
highlightTheme: 'zenburn',
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$',
revealOptions: {}
};
-
//public
var response = {
errorForbidden: function (res) {
@@ -52,7 +52,7 @@ var response = {
showNote: showNote,
showPublishNote: showPublishNote,
showPublishSlide: showPublishSlide,
- showIndex: showIndex,
+ showIndex: showIndex,
noteActions: noteActions,
publishNoteActions: publishNoteActions
};
@@ -361,46 +361,46 @@ function noteActions(req, res, next) {
}
var action = req.params.action;
switch (action) {
- case "publish":
- case "pretty": //pretty deprecated
- actionPublish(req, res, noteId);
- break;
- case "slide":
- actionSlide(req, res, noteId);
- break;
- case "download":
- actionDownload(req, res, noteId);
- break;
- case "pdf":
- actionPDF(req, res, noteId);
- break;
- default:
- if (noteId != config.featuresnotename)
- res.redirect('/' + LZString.compressToBase64(noteId));
- else
- res.redirect('/' + noteId);
- break;
+ case "publish":
+ case "pretty": //pretty deprecated
+ actionPublish(req, res, noteId);
+ break;
+ case "slide":
+ actionSlide(req, res, noteId);
+ break;
+ case "download":
+ actionDownload(req, res, noteId);
+ break;
+ case "pdf":
+ actionPDF(req, res, noteId);
+ break;
+ default:
+ if (noteId != config.featuresnotename)
+ res.redirect('/' + LZString.compressToBase64(noteId));
+ else
+ res.redirect('/' + noteId);
+ break;
}
}
function publishNoteActions(req, res, next) {
var action = req.params.action;
switch (action) {
- case "edit":
- var shortid = req.params.shortid;
- if (shortId.isValid(shortid)) {
- Note.findNote(shortid, function (err, note) {
- if (err || !note) {
- responseError(res, "404", "Not Found", "oops.");
- return;
- }
- if (note.id != config.featuresnotename)
- res.redirect('/' + LZString.compressToBase64(note.id));
- else
- res.redirect('/' + note.id);
- });
- }
- break;
+ case "edit":
+ var shortid = req.params.shortid;
+ if (shortId.isValid(shortid)) {
+ Note.findNote(shortid, function (err, note) {
+ if (err || !note) {
+ responseError(res, "404", "Not Found", "oops.");
+ return;
+ }
+ if (note.id != config.featuresnotename)
+ res.redirect('/' + LZString.compressToBase64(note.id));
+ else
+ res.redirect('/' + note.id);
+ });
+ }
+ break;
}
}
@@ -426,7 +426,7 @@ function showPublishSlide(req, res, next) {
}
var body = LZString.decompressFromBase64(data.rows[0].content);
var text = S(body).escapeHTML().s;
- render(res, text);
+ render(res, text);
});
});
});
@@ -434,15 +434,17 @@ function showPublishSlide(req, res, next) {
responseError(res, "404", "Not Found", "oops.");
}
}
-var render = function(res, markdown) {
- var slides = md.slidify(markdown, opts);
- res.end(Mustache.to_html(opts.template, {
- theme: opts.theme,
- highlightTheme: opts.highlighTheme,
- slides: slides,
- options: JSON.stringify(opts.revealOptions, null, 2)
- }));
+//reveal.js render
+var render = function (res, markdown) {
+ var slides = md.slidify(markdown, opts);
+
+ res.end(Mustache.to_html(opts.template, {
+ theme: opts.theme,
+ highlightTheme: opts.highlightTheme,
+ slides: slides,
+ options: JSON.stringify(opts.revealOptions, null, 2)
+ }));
};