mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
developed during a merge... I am going to hell for this.
- also new topics tab in admin panel
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
@import "mixins";
|
@import "mixins";
|
||||||
|
|
||||||
|
.admin {
|
||||||
|
|
||||||
.entry-row {
|
.entry-row {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -7,6 +9,7 @@
|
|||||||
cursor: move;
|
cursor: move;
|
||||||
width: 555px;
|
width: 555px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-categories {
|
.admin-categories {
|
||||||
form {
|
form {
|
||||||
margin: 0 0 0px;
|
margin: 0 0 0px;
|
||||||
@@ -82,3 +85,25 @@
|
|||||||
.motd textarea {
|
.motd textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.topics {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
> li {
|
||||||
|
.zebra;
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
|
||||||
|
li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,3 +21,13 @@
|
|||||||
.clear {
|
.clear {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.zebra {
|
||||||
|
&:nth-child(even) {
|
||||||
|
background: rgba(191,191,191,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(odd) {
|
||||||
|
background: rgba(223,223,223,0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,14 +5,7 @@ noscript {
|
|||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
.zebra;
|
||||||
&:nth-child(even) {
|
|
||||||
background: rgba(191,191,191,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:nth-child(odd) {
|
|
||||||
background: rgba(223,223,223,0.2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.categories {
|
.categories {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body class="admin">
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|||||||
@@ -15,4 +15,4 @@
|
|||||||
<button class="btn btn-warning" id="revert_theme">Revert</button> This will remove any custom theme applied to your NodeBB, and restore the base theme.
|
<button class="btn btn-warning" id="revert_theme">Revert</button> This will remove any custom theme applied to your NodeBB, and restore the base theme.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<script type="text/javascript" src="/src/forum/admin/themes.js"></script>
|
<script type="text/javascript" src="../../src/forum/admin/themes.js"></script>
|
||||||
@@ -1,55 +1,22 @@
|
|||||||
<h1>Topics</h1>
|
<h1>Topics</h1>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<ul class="nav nav-pills">
|
<ul class="topics">
|
||||||
<li class='active'><a href='/admin/topics'>All</a></li>
|
|
||||||
<li class=''><a href='/admin/topics/latest'>Latest</a></li>
|
|
||||||
<li class=''><a href='/admin/topics/active'>Active</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
<ul class="topic-container">
|
|
||||||
<!-- BEGIN topics -->
|
<!-- BEGIN topics -->
|
||||||
<a href="../../topic/{topics.slug}"><li class="topic-row">
|
<li data-tid="{topics.tid}" data-locked="{topics.locked}" data-pinned="{topics.pinned}" data-deleted="{topics.deleted}">
|
||||||
<div class="row" style="margin: 0">
|
<div class="btn-group pull-right">
|
||||||
<div class="span1 topic-row-icon">
|
<button data-action="pin" class="btn"><i class="icon-pushpin"></i></button>
|
||||||
<i class="icon-lock icon-4x"></i>
|
<button data-action="lock" class="btn"><i class="icon-lock"></i></button>
|
||||||
<i class="{topics.pin-icon}"></i><i class="{topics.lock-icon}"></i>
|
<button data-action="delete" class="btn"><i class="icon-trash"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="span11 topic-row-content">
|
<a target="_blank" href="../../topic/{topics.slug}">{topics.title}</a>
|
||||||
<div class="top-posters">
|
<ul>
|
||||||
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=60&default=identicon" class="img-polaroid" />
|
<li><i class="icon-time"></i> Posted {topics.relativeTime} ago by {topics.username}</li>
|
||||||
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=60&default=identicon" class="img-polaroid" />
|
<li><i class="icon-comments"></i> {topics.post_count} post(s)</li>
|
||||||
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=60&default=identicon" class="img-polaroid" />
|
</ul>
|
||||||
</div>
|
<div class="clear"></div>
|
||||||
<div>
|
</li>
|
||||||
<h3><span class="badge badge-important">3</span> {topics.title} <small>24<i class="icon-star"></i></small></h3>
|
|
||||||
<p> Posted {topics.relativeTime} ago by
|
|
||||||
<span class="username">{topics.username}</span>. {topics.post_count} posts.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li></a>
|
|
||||||
<!-- END topics -->
|
<!-- END topics -->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript" src="../../src/forum/admin/topics.js"></script>
|
||||||
|
|
||||||
//DRY Failure. this needs to go into an ajaxify onready style fn. Currently is copy pasted into every single function so after ACP is off the ground fix asap
|
|
||||||
(function() {
|
|
||||||
jQuery('document').ready(function() {
|
|
||||||
var url = window.location.href,
|
|
||||||
parts = url.split('/'),
|
|
||||||
active = parts[parts.length-1];
|
|
||||||
|
|
||||||
jQuery('.nav-pills li').removeClass('active');
|
|
||||||
jQuery('.nav-pills li a').each(function() {
|
|
||||||
if (this.getAttribute('href').match(active)) {
|
|
||||||
jQuery(this.parentNode).addClass('active');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
}());
|
|
||||||
</script>
|
|
||||||
@@ -57,8 +57,13 @@ var user = require('./../user.js'),
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'topics':
|
case 'topics':
|
||||||
categories.getCategoryById(0, 0, function(data) {
|
topics.getAllTopics(function(topics) {
|
||||||
res.json(data);
|
topics.sort(function(a, b) {
|
||||||
|
return b.timestamp - a.timestamp;
|
||||||
|
});
|
||||||
|
res.json({
|
||||||
|
topics: topics
|
||||||
|
});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'redis':
|
case 'redis':
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ var RDB = require('./redis.js'),
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
status: 'ok'
|
status: 'ok'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit('api:topic.lock', {
|
||||||
|
status: 'ok',
|
||||||
|
tid: tid
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -62,6 +67,11 @@ var RDB = require('./redis.js'),
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
status: 'ok'
|
status: 'ok'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit('api:topic.unlock', {
|
||||||
|
status: 'ok',
|
||||||
|
tid: tid
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -79,6 +89,11 @@ var RDB = require('./redis.js'),
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
status: 'ok'
|
status: 'ok'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit('api:topic.delete', {
|
||||||
|
status: 'ok',
|
||||||
|
tid: tid
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -96,6 +111,11 @@ var RDB = require('./redis.js'),
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
status: 'ok'
|
status: 'ok'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit('api:topic.restore', {
|
||||||
|
status: 'ok',
|
||||||
|
tid: tid
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -112,6 +132,11 @@ var RDB = require('./redis.js'),
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
status: 'ok'
|
status: 'ok'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit('api:topic.pin', {
|
||||||
|
status: 'ok',
|
||||||
|
tid: tid
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -128,6 +153,11 @@ var RDB = require('./redis.js'),
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
status: 'ok'
|
status: 'ok'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.emit('api:topic.unpin', {
|
||||||
|
status: 'ok',
|
||||||
|
tid: tid
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -179,10 +179,26 @@ marked.setOptions({
|
|||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
topicData.tid = tid;
|
||||||
callback(topicData);
|
callback(topicData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Topics.getAllTopics = function(callback) {
|
||||||
|
RDB.smembers('topics:tid', function(err, tids) {
|
||||||
|
var topics = [];
|
||||||
|
async.each(tids, function(tid, next) {
|
||||||
|
Topics.get_topic(tid, 0, function(topicData) {
|
||||||
|
topics.push(topicData);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
}, function(err) {
|
||||||
|
console.log(topics);
|
||||||
|
callback(topics);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@@ -195,7 +211,6 @@ marked.setOptions({
|
|||||||
|
|
||||||
Topics.getTitle = function(tid, callback) {
|
Topics.getTitle = function(tid, callback) {
|
||||||
RDB.get('tid:' + tid + ':title', function(err, title) {
|
RDB.get('tid:' + tid + ':title', function(err, title) {
|
||||||
console.log(tid, title);
|
|
||||||
callback(title);
|
callback(title);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user