diff --git a/.gitmodules b/.gitmodules index 1c9f545..f4b3b44 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "deps/Sanitize.js"] path = deps/Sanitize.js - url = https://github.com/gbirke/Sanitize.js.git + url = https://github.com/thedod/Sanitize.js.git [submodule "deps/jwysiwyg"] path = deps/jwysiwyg url = https://github.com/akzhan/jwysiwyg.git diff --git a/deps/Sanitize.js b/deps/Sanitize.js new file mode 160000 index 0000000..a0bdb6f --- /dev/null +++ b/deps/Sanitize.js @@ -0,0 +1 @@ +Subproject commit a0bdb6f9647d677273d83df678f494cb5852b42f diff --git a/lib/lists.js b/lib/lists.js index 87fab92..8da625c 100644 --- a/lib/lists.js +++ b/lib/lists.js @@ -8,6 +8,7 @@ exports.homepage = function (head, req) { start({code: 200, headers: {'Content-Type': 'text/html'}}); + var title = config.site_name; // fetch all the rows var row, rows = []; while (row = getRow()) { @@ -19,8 +20,14 @@ exports.homepage = function (head, req) { rows: rows }); - return {title: config.site_name, config: config, content: content}; - + if (req.client) { + document.title = title; + $('#breadcrumbs').html(''); + $('#content').html(content); + $('#actions').html(templates.render('blogposts_actions.html',req,{})); + } else { + return {title: title, config: config, content: content, breadcrumbs:''}; + }; }; exports.carousel = function (head, req) { diff --git a/lib/sanitize b/lib/sanitize new file mode 120000 index 0000000..d88c150 --- /dev/null +++ b/lib/sanitize @@ -0,0 +1 @@ +../deps/Sanitize.js/lib \ No newline at end of file diff --git a/lib/shows.js b/lib/shows.js index 8da1916..6478979 100644 --- a/lib/shows.js +++ b/lib/shows.js @@ -4,24 +4,47 @@ var templates = require('kanso/templates'), forms = require('kanso/forms'), + utils = require('kanso/utils'), config = require('./config'), types = require('./types'); exports.not_found = function (doc, req) { + start({code: 200, headers: {'Content-Type': 'text/html'}}); return { title: config.site_name+" - Not found", - content: templates.render('404.html', req, {}) + content: templates.render('404.html', req, {}), + breadcrumbs: 'Not found' }; }; exports.blogpost = function (doc, req) { + var title = config.site_name+' - '+doc.title; + var breadcrumbs = utils.escapeHTML(doc.title); + start({code: 200, headers: {'Content-Type': 'text/html'}}); + if (req.client) { + document.title = title; + $('#breadcrumbs').html(breadcrumbs); + var cfg = require('./sanitize/sanitize_cfg_relaxed').Config; + // Add rel and target to all links + cfg.add_attributes={a:{rel:'nofollow', target:'_blank'}}; + var Sanitize = require('./sanitize/sanitize').Sanitize; + var stz = new Sanitize(cfg); + // We need to defuse script tags before sanitizing, because $(' - {title} Fork me on GitHub {>"session.html"/} -

{config.site_name}

+

{config.site_name} {breadcrumbs|s}

+ {>"flashmessages.html"/}
{content|s}
+
+ - + + + + + + + diff --git a/templates/blogpost.html b/templates/blogpost.html index 0ea555d..12f4160 100644 --- a/templates/blogpost.html +++ b/templates/blogpost.html @@ -1,29 +1,10 @@ - - - - -

{title}

-
- -
-
- Edit - -
diff --git a/templates/blogpost_actions.html b/templates/blogpost_actions.html new file mode 100644 index 0000000..f907380 --- /dev/null +++ b/templates/blogpost_actions.html @@ -0,0 +1,6 @@ +
+
+ Edit + +
+
diff --git a/templates/blogpost_form.html b/templates/blogpost_form.html index f077c09..8a72e6d 100644 --- a/templates/blogpost_form.html +++ b/templates/blogpost_form.html @@ -1,25 +1,6 @@ -

{form_title}

-{>"flashmessages.html"/} - - - - - -
{form|s}
- - diff --git a/templates/blogposts.html b/templates/blogposts.html index b5f937a..ae58501 100644 --- a/templates/blogposts.html +++ b/templates/blogposts.html @@ -7,7 +7,3 @@ {:else}

No blog posts

{/rows} - -
-Add new -
diff --git a/templates/blogposts_actions.html b/templates/blogposts_actions.html new file mode 100644 index 0000000..dc933b8 --- /dev/null +++ b/templates/blogposts_actions.html @@ -0,0 +1 @@ +Add new