adding noscript parsing for a topic, if accessed by a browser without javascript

v1.18.x
Julian Lam 12 years ago
parent fa03b13209
commit c0b018cdf4

@ -2,3 +2,4 @@
@import "topic"; @import "topic";
@import "category"; @import "category";
@import "noscript";

@ -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);
}
}
}
}

@ -1,15 +1,37 @@
<div class="alert alert-error"> <div class="alert alert-error">
<p> <p>
Your browser does not seem to support javascript. As a result, your viewing experience will be diminished. Your browser does not seem to support javascript. As a result, your viewing experience will be diminished.
</p> </p>
<p> <p>
Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript). Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).
</p> </p>
</div> </div>
<ul> <ul class="posts">
<!-- BEGIN posts --> <!-- BEGIN main_posts -->
<li> <li>
Foo: {posts.foo} <div class="row-fluid">
</li> <div class="span2">
<!-- END posts --> <img src="{main_posts.gravatar}" /><br />
</ul> {main_posts.username}
</div>
<div class="span10">
{main_posts.content}
</div>
</div>
</li>
<!-- END main_posts -->
<!-- BEGIN posts -->
<li>
<div class="row-fluid">
<div class="span2">
<img src="{posts.gravatar}" /><br />
{posts.username}
</div>
<div class="span10">
{posts.content}
</div>
<div class="clear"></div>
</div>
</li>
<!-- END posts -->
</ul>

@ -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) { Topics.get_cid_by_tid = function(tid, callback) {
RDB.get(schema.topics(tid).cid, function(err, cid) { RDB.get(schema.topics(tid).cid, function(err, cid) {
if (cid && parseInt(cid) > 0) { if (cid && parseInt(cid) > 0) {

@ -114,11 +114,10 @@ var express = require('express'),
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : ''); var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
topics.get_posts_noscript(tid, ((req.user) ? req.user.uid : 0), function(posts) { topics.getTopicById(tid, ((req.user) ? req.user.uid : 0), function(topic) {
console.log(posts);
res.send( res.send(
build_header() + build_header() +
'\n\t<noscript>\n\t\t' + templates['noscript/topic'].parse({ posts: posts }) + '\n\t</noscript>' + '\n\t<noscript>\n' + templates['noscript/topic'].parse(topic) + '\n\t</noscript>' +
'\n\t<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '");});</script>' + '\n\t<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '");});</script>' +
templates['footer'] templates['footer']
); );

Loading…
Cancel
Save