From c0b018cdf4b309fe24380eb126279ce701ceb822 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 11 Jun 2013 15:40:50 -0400 Subject: [PATCH] adding noscript parsing for a topic, if accessed by a browser without javascript --- public/css/nodebb.less | 1 + public/css/noscript.less | 15 +++++++++ public/templates/noscript/topic.tpl | 52 ++++++++++++++++++++--------- src/topics.js | 10 ------ src/webserver.js | 5 ++- 5 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 public/css/noscript.less diff --git a/public/css/nodebb.less b/public/css/nodebb.less index c9423a17b8..78c464f8b4 100644 --- a/public/css/nodebb.less +++ b/public/css/nodebb.less @@ -2,3 +2,4 @@ @import "topic"; @import "category"; +@import "noscript"; \ No newline at end of file diff --git a/public/css/noscript.less b/public/css/noscript.less new file mode 100644 index 0000000000..0c9ddd3ebb --- /dev/null +++ b/public/css/noscript.less @@ -0,0 +1,15 @@ +@import "mixins"; + +noscript { + .posts { + li { + list-style-type: none; + padding: 1em; + margin-bottom: 1em; + + &:nth-child(even) { + background: rgba(192,192,192,0.2); + } + } + } +} \ No newline at end of file diff --git a/public/templates/noscript/topic.tpl b/public/templates/noscript/topic.tpl index 6e5684ea4d..a5d6743af8 100644 --- a/public/templates/noscript/topic.tpl +++ b/public/templates/noscript/topic.tpl @@ -1,15 +1,37 @@ -
-

- Your browser does not seem to support javascript. As a result, your viewing experience will be diminished. -

-

- Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript). -

-
- \ No newline at end of file +
+

+ Your browser does not seem to support javascript. As a result, your viewing experience will be diminished. +

+

+ Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript). +

+
+ \ No newline at end of file diff --git a/src/topics.js b/src/topics.js index 7a9d5f5923..3819c86494 100644 --- a/src/topics.js +++ b/src/topics.js @@ -184,16 +184,6 @@ marked.setOptions({ }); } - Topics.get_posts_noscript = function(tid, current_user, callback) { - // Topics.get_topic(tid, current_user, function() { - callback([ - { - foo: 'bar' - } - ]); - // }); - } - Topics.get_cid_by_tid = function(tid, callback) { RDB.get(schema.topics(tid).cid, function(err, cid) { if (cid && parseInt(cid) > 0) { diff --git a/src/webserver.js b/src/webserver.js index ec03efe542..bde5fa480c 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -114,11 +114,10 @@ var express = require('express'), var topic_url = tid + (req.params.slug ? '/' + req.params.slug : ''); - topics.get_posts_noscript(tid, ((req.user) ? req.user.uid : 0), function(posts) { - console.log(posts); + topics.getTopicById(tid, ((req.user) ? req.user.uid : 0), function(topic) { res.send( build_header() + - '\n\t' + + '\n\t' + '\n\t' + templates['footer'] );