mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-05 18:29:12 +02:00
adding noscript parsing for a topic, if accessed by a browser without javascript
This commit is contained in:
@@ -2,3 +2,4 @@
|
||||
|
||||
@import "topic";
|
||||
@import "category";
|
||||
@import "noscript";
|
||||
15
public/css/noscript.less
Normal file
15
public/css/noscript.less
Normal file
@@ -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">
|
||||
<p>
|
||||
Your browser does not seem to support javascript. As a result, your viewing experience will be diminished.
|
||||
</p>
|
||||
<p>
|
||||
Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).
|
||||
</p>
|
||||
</div>
|
||||
<ul>
|
||||
<!-- BEGIN posts -->
|
||||
<li>
|
||||
Foo: {posts.foo}
|
||||
</li>
|
||||
<!-- END posts -->
|
||||
</ul>
|
||||
<div class="alert alert-error">
|
||||
<p>
|
||||
Your browser does not seem to support javascript. As a result, your viewing experience will be diminished.
|
||||
</p>
|
||||
<p>
|
||||
Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).
|
||||
</p>
|
||||
</div>
|
||||
<ul class="posts">
|
||||
<!-- BEGIN main_posts -->
|
||||
<li>
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<img src="{main_posts.gravatar}" /><br />
|
||||
{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) {
|
||||
RDB.get(schema.topics(tid).cid, function(err, cid) {
|
||||
if (cid && parseInt(cid) > 0) {
|
||||
|
||||
@@ -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<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>' +
|
||||
templates['footer']
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user