mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
son whitespace conflicts are so 1765
This commit is contained in:
@@ -1,13 +1,33 @@
|
||||
@import "mixins";
|
||||
|
||||
.entry-row {
|
||||
.admin {
|
||||
.entry-row {
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
cursor: move;
|
||||
width: 800px;
|
||||
}
|
||||
.admin-categories {
|
||||
}
|
||||
|
||||
.admin-categories {
|
||||
form {
|
||||
margin: 0 0 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-row {
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
cursor: move;
|
||||
width: 555px;
|
||||
}
|
||||
|
||||
input.description {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.admin-categories {
|
||||
form {
|
||||
margin: 0 0 0px;
|
||||
}
|
||||
@@ -21,9 +41,6 @@
|
||||
border-radius: 5px;
|
||||
margin-top: -8px;
|
||||
}
|
||||
input.description {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
select {
|
||||
border: 0;
|
||||
@@ -43,9 +60,9 @@
|
||||
line-height: 35px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.themes {
|
||||
.themes {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
@@ -80,14 +97,33 @@
|
||||
background-color: rgba(128, 128, 128, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.motd textarea {
|
||||
.motd textarea {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.topics {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.icon-container {
|
||||
> li {
|
||||
.zebra;
|
||||
list-style-type: none;
|
||||
padding: 1em;
|
||||
margin-bottom: 1em;
|
||||
|
||||
ul {
|
||||
margin: 0.5em 0;
|
||||
|
||||
li {
|
||||
list-style-type: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon-container {
|
||||
.row {
|
||||
margin: 0;
|
||||
.span3 {
|
||||
@@ -104,6 +140,7 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,3 +21,13 @@
|
||||
.clear {
|
||||
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;
|
||||
padding: 1em;
|
||||
margin-bottom: 1em;
|
||||
|
||||
&:nth-child(even) {
|
||||
background: rgba(191,191,191,0.2);
|
||||
}
|
||||
|
||||
&:nth-child(odd) {
|
||||
background: rgba(223,223,223,0.2);
|
||||
}
|
||||
.zebra;
|
||||
}
|
||||
|
||||
.categories {
|
||||
|
||||
84
public/src/forum/admin/topics.js
Normal file
84
public/src/forum/admin/topics.js
Normal file
@@ -0,0 +1,84 @@
|
||||
$(document).ready(function() {
|
||||
var topicsListEl = document.querySelector('.topics');
|
||||
|
||||
$(topicsListEl).on('click', '[data-action]', function() {
|
||||
var $this = $(this),
|
||||
action = this.getAttribute('data-action'),
|
||||
tid = $this.parents('[data-tid]').attr('data-tid');
|
||||
|
||||
switch(action) {
|
||||
case 'pin':
|
||||
if (!$this.hasClass('active')) socket.emit('api:topic.pin', { tid: tid });
|
||||
else socket.emit('api:topic.unpin', { tid: tid });
|
||||
break;
|
||||
case 'lock':
|
||||
if (!$this.hasClass('active')) socket.emit('api:topic.lock', { tid: tid });
|
||||
else socket.emit('api:topic.unlock', { tid: tid });
|
||||
break;
|
||||
case 'delete':
|
||||
if (!$this.hasClass('active')) socket.emit('api:topic.delete', { tid: tid });
|
||||
else socket.emit('api:topic.restore', { tid: tid });
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// Resolve proper button state for all topics
|
||||
var topicEls = topicsListEl.querySelectorAll('li'),
|
||||
numTopics = topicEls.length;
|
||||
for(var x=0;x<numTopics;x++) {
|
||||
if (topicEls[x].getAttribute('data-pinned')) topicEls[x].querySelector('[data-action="pin"]').className += ' active';
|
||||
if (topicEls[x].getAttribute('data-locked')) topicEls[x].querySelector('[data-action="lock"]').className += ' active';
|
||||
if (topicEls[x].getAttribute('data-deleted')) topicEls[x].querySelector('[data-action="delete"]').className += ' active';
|
||||
topicEls[x].removeAttribute('data-pinned');
|
||||
topicEls[x].removeAttribute('data-locked');
|
||||
topicEls[x].removeAttribute('data-deleted');
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topic.pin', function(response) {
|
||||
if (response.status === 'ok') {
|
||||
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="pin"]');
|
||||
|
||||
$(btnEl).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topic.unpin', function(response) {
|
||||
if (response.status === 'ok') {
|
||||
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="pin"]');
|
||||
|
||||
$(btnEl).removeClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topic.lock', function(response) {
|
||||
if (response.status === 'ok') {
|
||||
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="lock"]');
|
||||
|
||||
$(btnEl).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topic.unlock', function(response) {
|
||||
if (response.status === 'ok') {
|
||||
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="lock"]');
|
||||
|
||||
$(btnEl).removeClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topic.delete', function(response) {
|
||||
if (response.status === 'ok') {
|
||||
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="delete"]');
|
||||
|
||||
$(btnEl).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topic.restore', function(response) {
|
||||
if (response.status === 'ok') {
|
||||
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="delete"]');
|
||||
|
||||
$(btnEl).removeClass('active');
|
||||
}
|
||||
});
|
||||
@@ -26,7 +26,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="admin">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<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.
|
||||
</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>
|
||||
<hr />
|
||||
|
||||
<ul class="nav nav-pills">
|
||||
<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 class="topics">
|
||||
<!-- BEGIN topics -->
|
||||
<li data-tid="{topics.tid}" data-locked="{topics.locked}" data-pinned="{topics.pinned}" data-deleted="{topics.deleted}">
|
||||
<div class="btn-group pull-right">
|
||||
<button data-action="pin" class="btn"><i class="icon-pushpin"></i></button>
|
||||
<button data-action="lock" class="btn"><i class="icon-lock"></i></button>
|
||||
<button data-action="delete" class="btn"><i class="icon-trash"></i></button>
|
||||
</div>
|
||||
<a target="_blank" href="../../topic/{topics.slug}">{topics.title}</a>
|
||||
<ul>
|
||||
<li><i class="icon-time"></i> Posted {topics.relativeTime} ago by {topics.username}</li>
|
||||
<li><i class="icon-comments"></i> {topics.post_count} post(s)</li>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</li>
|
||||
<!-- END topics -->
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="topic-container">
|
||||
<!-- BEGIN topics -->
|
||||
<a href="../../topic/{topics.slug}"><li class="topic-row">
|
||||
<div class="row" style="margin: 0">
|
||||
<div class="span1 topic-row-icon">
|
||||
<i class="icon-lock icon-4x"></i>
|
||||
<i class="{topics.pin-icon}"></i><i class="{topics.lock-icon}"></i>
|
||||
</div>
|
||||
<div class="span11 topic-row-content">
|
||||
<div class="top-posters">
|
||||
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=60&default=identicon" class="img-polaroid" />
|
||||
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=60&default=identicon" class="img-polaroid" />
|
||||
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=60&default=identicon" class="img-polaroid" />
|
||||
</div>
|
||||
<div>
|
||||
<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 -->
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
//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>
|
||||
<script type="text/javascript" src="../../src/forum/admin/topics.js"></script>
|
||||
@@ -56,9 +56,14 @@ var user = require('./../user.js'),
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'topics' :
|
||||
categories.getCategoryById(0, 0, function(data) {
|
||||
res.json(data);
|
||||
case 'topics':
|
||||
topics.getAllTopics(function(topics) {
|
||||
topics.sort(function(a, b) {
|
||||
return b.timestamp - a.timestamp;
|
||||
});
|
||||
res.json({
|
||||
topics: topics
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'redis':
|
||||
|
||||
@@ -133,7 +133,7 @@ var user = require('./../user.js'),
|
||||
var filename = uid + '-profileimg' + extension;
|
||||
var uploadPath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, filename);
|
||||
|
||||
console.log('trying to upload to : '+ uploadPath);
|
||||
console.log('Info: Attempting upload to: '+ uploadPath);
|
||||
|
||||
var is = fs.createReadStream(tempPath);
|
||||
var os = fs.createWriteStream(uploadPath);
|
||||
|
||||
@@ -46,6 +46,11 @@ var RDB = require('./redis.js'),
|
||||
tid: tid,
|
||||
status: 'ok'
|
||||
});
|
||||
|
||||
socket.emit('api:topic.lock', {
|
||||
status: 'ok',
|
||||
tid: tid
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -62,6 +67,11 @@ var RDB = require('./redis.js'),
|
||||
tid: tid,
|
||||
status: 'ok'
|
||||
});
|
||||
|
||||
socket.emit('api:topic.unlock', {
|
||||
status: 'ok',
|
||||
tid: tid
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -79,6 +89,11 @@ var RDB = require('./redis.js'),
|
||||
tid: tid,
|
||||
status: 'ok'
|
||||
});
|
||||
|
||||
socket.emit('api:topic.delete', {
|
||||
status: 'ok',
|
||||
tid: tid
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -96,6 +111,11 @@ var RDB = require('./redis.js'),
|
||||
tid: tid,
|
||||
status: 'ok'
|
||||
});
|
||||
|
||||
socket.emit('api:topic.restore', {
|
||||
status: 'ok',
|
||||
tid: tid
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -112,6 +132,11 @@ var RDB = require('./redis.js'),
|
||||
tid: tid,
|
||||
status: 'ok'
|
||||
});
|
||||
|
||||
socket.emit('api:topic.pin', {
|
||||
status: 'ok',
|
||||
tid: tid
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -128,6 +153,11 @@ var RDB = require('./redis.js'),
|
||||
tid: tid,
|
||||
status: 'ok'
|
||||
});
|
||||
|
||||
socket.emit('api:topic.unpin', {
|
||||
status: 'ok',
|
||||
tid: tid
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -179,10 +179,25 @@ marked.setOptions({
|
||||
throw new Error(err);
|
||||
}
|
||||
|
||||
topicData.tid = tid;
|
||||
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) {
|
||||
callback(topics);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Topics.get_cid_by_tid = function(tid, callback) {
|
||||
RDB.get(schema.topics(tid).cid, function(err, cid) {
|
||||
if (cid && parseInt(cid) > 0) {
|
||||
@@ -195,7 +210,6 @@ marked.setOptions({
|
||||
|
||||
Topics.getTitle = function(tid, callback) {
|
||||
RDB.get('tid:' + tid + ':title', function(err, title) {
|
||||
console.log(tid, title);
|
||||
callback(title);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,7 +159,6 @@ var express = require('express'),
|
||||
|
||||
var category_url = cid + (req.params.slug ? '/' + req.params.slug : '');
|
||||
categories.getCategoryById(cid, 0, function(returnData) {
|
||||
console.log(returnData);
|
||||
res.send(
|
||||
app.build_header(res) +
|
||||
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/category'].parse(returnData) + '\n\t</noscript>' +
|
||||
@@ -294,8 +293,6 @@ var express = require('express'),
|
||||
|
||||
app.all('/test', function(req, res) {
|
||||
res.send();
|
||||
// console.log('CSRF is: ', res.locals.token);
|
||||
// res.send('<form method="POST" action="/test"><input type="hidden" name="_csrf" value="' + res.locals.token + '" /><button type="submit">go</button></form>');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user