derp conflicts

Merge branch 'master' of https://github.com/psychobunny/NodeBB

Conflicts:
	public/src/templates.js
v1.18.x
psychobunny 12 years ago
commit cb6d98cecb

@ -699,4 +699,16 @@ body .navbar .nodebb-inline-block {
#right-menu{
float:right;
}
#admin-redis-info {
span {
display:inline-block;
width:200px;
}
}
.post-signature {
color:#666;
font-size:12px;
}

@ -153,6 +153,7 @@
document.getElementById('content').innerHTML = templates[tpl_url].parse(JSON.parse(template_data));
if (callback) callback(true);
}
}

@ -54,6 +54,10 @@
<span class="account-bio-label">posts</span>
<span id='postcount'>{postcount}</span>
<br/>
<span class="account-bio-label">signature</span>
<span id='signature'>{signature}</span>
</div>
</div>
</div>

@ -116,6 +116,13 @@
<input type="text" id="inputBirthday" placeholder="mm/dd/yyyy" value="{birthday}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputSignature">Signature</label>
<div class="controls">
<textarea id="inputSignature" placeholder="your signature" rows="5">{signature}</textarea>
</div>
</div>
<input type="hidden" id="inputUID" value="{uid}">
@ -227,14 +234,15 @@ $(document).ready(function() {
var selectedImageType = '';
$('#submitBtn').on('click',function(){
var userData = {
uid:$('#inputUID').val(),
email:$('#inputEmail').val(),
fullname:$('#inputFullname').val(),
website:$('#inputWebsite').val(),
birthday:$('#inputBirthday').val(),
location:$('#inputLocation').val()
location:$('#inputLocation').val(),
signature:$('#inputSignature').val(),
};
$.post('/users/doedit',

@ -94,6 +94,8 @@
<li class=''><a href='/admin/topics'><i class='icon-book'></i> Topics</a></li>
<li class=''><a href='/admin/themes'><i class='icon-th'></i> Themes</a></li>
<li class=''><a href='/admin/settings'><i class='icon-cogs'></i> Settings</a></li>
<li class=''><a href='/admin/redis'><i class='icon-hdd'></i> Redis</a></li>
<li class="nav-header">Social Authentication</li>
<li class=''><a href='/admin/twitter'><i class='icon-twitter'></i>Twitter</a></li>
<li class=''><a href='/admin/facebook'><i class='icon-facebook'></i>Facebook</a></li>

@ -0,0 +1,23 @@
<h1>Redis</h1>
<hr />
<div id="admin-redis-info">
<span>Redis Version</span> <span class="text-right">{redis_version}</span><br/>
<hr/>
<span>Uptime in Seconds</span> <span class="text-right">{uptime_in_seconds}</span><br/>
<span>Uptime in Days</span> <span class="text-right">{uptime_in_days}</span><br/>
<hr/>
<span>Connected Clients</span> <span class="text-right">{connected_clients}</span><br/>
<span>Connected Slaves</span> <span class="text-right">{connected_slaves}</span><br/>
<span>Blocked Clients</span> <span class="text-right">{blocked_clients}</span><br/>
<hr/>
<span>Used Memory</span> <span class="text-right">{used_memory_human}</span><br/>
<span>Memory Fragmentation Ratio</span> <span class="text-right">{mem_fragmentation_ratio}</span><br/>
<hr/>
<span>Total Connections Received</span> <span class="text-right">{total_connections_received}</span><br/>
<span>Total Commands Processed</span> <span class="text-right">{total_commands_processed}</span><br/>
<hr/>
<span>Keyspace Hits</span> <span class="text-right">{keyspace_hits}</span><br/>
<span>Keyspace Misses</span> <span class="text-right">{keyspace_misses}</span><br/>
</div>

@ -8,7 +8,7 @@
<div class="category row">
<div class="span9">
<ul>
<ul id="topics-container">
<!-- BEGIN topics -->
<a href="../../topic/{topics.slug}"><li>
<div class="row-fluid">
@ -77,8 +77,25 @@
<script type="text/javascript">
var new_post = document.getElementById('new_post');
new_post.onclick = function() {
app.open_post_window('topic', {category_id});
}
(function() {
var room = 'category_' + '{category_id}';
app.enter_room(room);
var new_post = document.getElementById('new_post');
new_post.onclick = function() {
app.open_post_window('topic', {category_id});
}
ajaxify.register_events([
'event:new_topic'
]);
socket.on('event:new_topic', function(data) {
console.log(data);
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] });
jQuery('<div></div>').appendTo("#topics-container").hide().append(html).fadeIn('slow');
// set_up_posts(uniqueid);
});
})();
</script>

@ -7,7 +7,7 @@
<link href="/vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="/vendor/fontawesome/css/font-awesome.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript" src="/vendor/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="/vendor/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="/src/app.js"></script>
<script type="text/javascript" src="/src/templates.js"></script>

@ -44,6 +44,7 @@
<div style="clear:both; margin-bottom: 10px;"></div>
<div id="content_{main_posts.pid}" class="post-content">{main_posts.content}</div>
<div class="post-signature">{main_posts.signature}</div>
<div class="profile-block"></div>
</div>
</div>
@ -62,6 +63,7 @@
<div class="span11">
<div class="post-block">
<div id="content_{posts.pid}" class="post-content">{posts.content}</div>
<div class="post-signature">{posts.signature}</div>
<div class="profile-block">
<span class="post-buttons">
<div id="ids_{posts.pid}_{posts.uid}" class="edit {posts.display_moderator_tools} hidden-phone"><i class="icon-pencil"></i></div>

@ -788,7 +788,7 @@
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$('.dropdown')
$(document)
.on('click.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown-menu', function (e) { e.stopPropagation() })

File diff suppressed because one or more lines are too long

@ -48,6 +48,7 @@ marked.setOptions({
'username' : user_data[uid].username || 'anonymous',
'user_rep' : user_data[uid].reputation || 0,
'gravatar' : user_data[uid].picture || 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e',
'signature' : user_data[uid].signature,
'fav_star_class' : vote_data[pid] ? 'icon-star' : 'icon-star-empty',
'display_moderator_tools': (uid == current_user || manage_content || viewer_data.isModerator) ? 'show' : 'none',
'edited-class': post_data.editor[i] !== null ? '' : 'none',
@ -147,7 +148,7 @@ marked.setOptions({
}
}
user.getMultipleUserFields(post_data.uid, ['username','reputation','picture'], function(user_details){
user.getMultipleUserFields(post_data.uid, ['username','reputation','picture', 'signature'], function(user_details){
user_data = user_details;
generateThread();
});

@ -1,16 +1,18 @@
var user = require('./../user.js'),
topics = require('./../topics.js');
topics = require('./../topics.js'),
RDB = require('./../redis.js');
(function(Admin) {
Admin.create_routes = function(app) {
(function() {
var routes = ['categories', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus'];
var routes = ['categories', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus', 'redis'];
for (var i=0, ii=routes.length; i<ii; i++) {
(function(route) {
app.get('/admin/' + route, function(req, res) {
console.log("derp " +route);
res.send(templates['admin/header'] + app.create_route('admin/' + route) + templates['admin/footer']);
});
}(routes[i]));
@ -52,6 +54,31 @@ var user = require('./../user.js'),
res.send(JSON.stringify(data));
});
break;
case 'redis':
console.log('going into redis');
RDB.info(function(err, data) {
data = data.split("\r\n");
var finalData = {};
for(var i in data) {
try {
data[i] = data[i].replace(/:/,"\":\"");
var json = "{\"" + data[i] + "\"}";
var jsonObject = JSON.parse(json);
for(var key in jsonObject) {
finalData[key] = jsonObject[key];
}
}catch(err){
}
}
console.log(finalData);
res.send(JSON.stringify(finalData));
});
break;
default :
res.send('{}');
}

@ -4,7 +4,7 @@ var RDB = require('./redis.js'),
user = require('./user.js'),
configs = require('../config.js'),
categories = require('./categories.js'),
marked = require('marked')
marked = require('marked'),
async = require('async');
marked.setOptions({
@ -169,6 +169,59 @@ marked.setOptions({
});
}
Topics.get_topic = function(tid, uid, callback) {
var topicData = {};
async.parallel([
function(next) {
RDB.mget([
'tid:' + tid + ':title',
'tid:' + tid + ':uid',
'tid:' + tid + ':timestamp',
'tid:' + tid + ':slug',
'tid:' + tid + ':postcount',
'tid:' + tid + ':locked',
'tid:' + tid + ':pinned',
'tid:' + tid + ':deleted'
], function(err, topic) {
topicData.title = topic[0];
topicData.uid = topic[1];
topicData.timestamp = topic[2];
topicData.relativeTime = utils.relativeTime(topic[2]),
topicData.slug = topic[3];
topicData.post_count = topic[4];
topicData.locked = topic[5];
topicData.pinned = topic[6];
topicData.deleted = topic[7];
user.getUserField(topic[1], 'username', function(username) {
topicData.username = username;
next(null);
})
});
},
function(next) {
if (uid && parseInt(uid) > 0) {
RDB.sismember('tid:' + tid + ':read_by_uid', uid, function(err, read) {
topicData.badgeclass = read ? '' : 'badge-important';
next(null);
});
} else next(null);
},
function(next) {
Topics.get_teaser(tid, function(teaser) {
topicData.teaser_text = teaser.text;
topicData.teaser_username = teaser.username;
next(null);
});
}
], function(err) {
if (!err) {
callback(topicData);
}
});
}
Topics.get_cid_by_tid = function(tid, callback) {
RDB.get('tid:' + pid + ':cid', function(err, cid) {
if (cid && parseInt(cid) > 0) callback(cid);
@ -218,8 +271,11 @@ marked.setOptions({
'pid:' + pid + ':uid'
], function(err, content) {
user.getUserField(content[1], 'username', function(username) {
var stripped = content[0];
if(content[0])
stripped = utils.strip_tags(marked(content[0]));
callback({
"text": utils.strip_tags(marked(content[0])),
"text": stripped,
"username": username
});
});
@ -269,7 +325,14 @@ marked.setOptions({
// Posts
posts.create(uid, tid, content, function(pid) {
if (pid > 0) RDB.lpush('tid:' + tid + ':posts', pid);
if (pid > 0) {
RDB.lpush('tid:' + tid + ':posts', pid);
// Notify any users looking at the category that a new post has arrived
Topics.get_topic(tid, uid, function(topicData) {
io.sockets.in('category_' + category_id).emit('event:new_topic', topicData);
});
}
});
Topics.markAsRead(tid, uid);
@ -284,7 +347,6 @@ marked.setOptions({
timeout: 2000
});
// in future it may be possible to add topics to several categories, so leaving the door open here.
RDB.sadd('categories:' + category_id + ':tid', tid);
RDB.set('tid:' + tid + ':cid', category_id);

@ -6,7 +6,9 @@ var config = require('../config.js'),
crypto = require('crypto'),
emailjs = require('emailjs'),
emailjsServer = emailjs.server.connect(config.mailer),
bcrypt = require('bcrypt');
bcrypt = require('bcrypt'),
marked = require('marked');
(function(User) {
@ -79,19 +81,24 @@ var config = require('../config.js'),
User.updateProfile = function(uid, data) {
var fields = ['email', 'fullname', 'website', 'location', 'birthday'];
var fields = ['email', 'fullname', 'website', 'location', 'birthday', 'signature'];
var key = '';
for(var i=0,ii=fields.length; i<ii; ++i) {
key = fields[i];
if(data[key] !== undefined) {
User.setUserField(uid, key, data[key]);
if(data[key] !== undefined) {
if(key === 'email') {
User.setUserField(uid, 'gravatarpicture', User.createGravatarURLFromEmail(data[key]));
RDB.set('email:' + email +':uid', uid);
RDB.set('email:' + data['email'] +':uid', uid);
}
else if(key === 'signature') {
//sanitize sig plx - baris
//data[key] = marked(data[key]);
}
User.setUserField(uid, key, data[key]);
}
}
}
@ -268,6 +275,7 @@ var config = require('../config.js'),
'birthday':'',
'website':'',
'email' : email,
'signature':'',
'joindate' : new Date().getTime(),
'picture': gravatar,
'gravatarpicture' : gravatar,

@ -237,8 +237,8 @@ var express = require('express'),
app.get('/api/:method/:id*', api_method);
app.get('/test', function(req, res) {
topics.get_teasers([1, 2, 3], function(teasers) {
res.send(JSON.stringify(teasers));
topics.get_topic(3, 1, function(data) {
res.send(JSON.stringify(data));
});
});

Loading…
Cancel
Save