Merge branch 'master' into user_groups

v1.18.x
Julian Lam 12 years ago
commit 03fb649274

@ -14,6 +14,10 @@ noscript {
.icon {
float: left;
width: auto;
height: auto;
padding: 0;
margin: 0;
margin-right: 1em;
}
@ -34,7 +38,8 @@ noscript {
img {
float: left;
width: 32px;
width: 64px;
margin-right: 1em;
}
p {
@ -52,6 +57,20 @@ noscript {
.posts {
li {
.default;
img {
width: 64px;
}
.profile {
text-align: center;
span {
font-weight: bold;
display: inline-block;
margin-top: 1em;
}
}
}
}
}

@ -353,15 +353,22 @@ var socket,
if(app.infiniteLoaderActive)
return;
app.infiniteLoaderActive = true;
if($('#loading-indicator').attr('done') === '0')
$('#loading-indicator').removeClass('hide');
socket.emit('api:topic.loadMore', {
tid: tid,
after: document.querySelectorAll('#post-container li[data-pid]').length
}, function(data) {
app.infiniteLoaderActive = false;
if(data.posts.length) {
$('#loading-indicator').attr('done', '0');
app.createNewPosts(data);
} else {
$('#loading-indicator').attr('done', '1');
}
$('#loading-indicator').addClass('hide');
if(callback)
callback(data.posts);
});

@ -4,6 +4,8 @@
isFollowing = templates.get('isFollowing');
$(document).ready(function() {
var username = $('.account-username a').html();
app.enter_room('users/' + theirid);
app.addCommasToNumbers();
@ -25,7 +27,6 @@
followBtn.on('click', function() {
socket.emit('api:user.follow', {uid: theirid}, function(success) {
var username = $('.account-username a').html();
if(success) {
followBtn.hide();
unfollowBtn.show();
@ -39,7 +40,6 @@
unfollowBtn.on('click', function() {
socket.emit('api:user.unfollow', {uid: theirid}, function(success) {
var username = $('.account-username a').html();
if(success) {
followBtn.show();
unfollowBtn.hide();
@ -71,6 +71,11 @@
socket.emit('api:user.isOnline', theirid, handleUserOnline);
socket.on('event:new_post', function(data) {
var html = templates.prepare(templates['account'].blocks['posts']).parse(data);
$('.user-recent-posts').prepend(html);
});
});
}());

@ -53,7 +53,13 @@
jQuery('#search-fields').hide();
jQuery('#search-button').show();
});
$('#search-fields input').on('blur', function() {
$('#search-fields').hide();
$('#search-button').show();
});
});
var rightMenu = $('#right-menu'),
isLoggedIn = data.uid > 0;
@ -82,6 +88,7 @@
rightMenu.append(logoutli);
}
} else {
$('#search-button').hide();
jQuery('.nodebb-loggedin').hide();
jQuery('.nodebb-loggedout').show();

@ -2,13 +2,16 @@
$(document).ready(function() {
var searchQuery = $('#topics-container').attr('data-search-query');
$('.search-result-text').each(function() {
var text = $(this).html();
var regex = new RegExp(searchQuery, 'gi');
text = text.replace(regex, '<span class="label label-success">'+searchQuery+'</span>');
$(this).html(text);
});
$('#search-form input').val(searchQuery);
});
})();

@ -5,11 +5,11 @@ define(function() {
tasklist: undefined,
init: function() {
var footerEl = document.getElementById('footer');
taskbar.taskbar = document.createElement('div');
var jTaskbar = $(taskbar.taskbar);
taskbar.taskbar.innerHTML = '<div class="navbar-inner"><ul class="nav pull-right"></ul></div>';
taskbar.taskbar.className = 'taskbar navbar navbar-fixed-bottom';
taskbar.taskbar.innerHTML = '<div class="navbar-inner"><ul class="nav navbar-nav pull-right"></ul></div>';
taskbar.taskbar.className = 'taskbar navbar navbar-default navbar-fixed-bottom';
taskbar.taskbar.id = 'taskbar';
taskbar.tasklist = taskbar.taskbar.querySelector('ul');
@ -60,7 +60,7 @@ define(function() {
var element = $(taskbar.tasklist).find('li[data-uuid="'+uuid+'"]');
if(element.length)
return;
var btnEl = document.createElement('li');
btnEl.innerHTML = '<a href="#">' +

@ -31,7 +31,7 @@
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" id="header-menu">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation" id="header-menu">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
@ -42,7 +42,7 @@
<a class="navbar-brand" href="/">{title}</a>
</div>
<div class="navbar-collapse collapse">
<div class="navbar-collapse collapse navbar-ex1-collapse">
<ul id="main-nav" class="nav navbar-nav">
<li>
<a href="/recent">Recent</a>
@ -63,13 +63,13 @@
<form id="search-form" class="navbar-form navbar-right hidden-xs" role="search" method="GET" action="">
<div class="hide" id="search-fields">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search" name="query">
</div>
<button type="submit" class="btn btn-default hide">Search</button>
</div>
<button id="search-button" type="button" class="btn btn-link nodebb-loggedin"><i class="icon-search"></i></button>
</form>
<div class="form-group">
<input type="text" class="form-control" placeholder="Search" name="query" value="">
</div>
<button type="submit" class="btn btn-default hide">Search</button>
</div>
<button id="search-button" type="button" class="btn btn-link"><i class="icon-search"></i></button>
</form>
<ul id="right-menu" class="nav navbar-nav navbar-right">
<li class="notifications dropdown text-center hidden-xs">

@ -8,10 +8,11 @@
<li>
<a href="../../topic/{topics.slug}">{topics.title} ({topics.postcount})</a>
<div class="teaser">
<img class="img-thumbnail" src="../../graph/users/{topics.teaser_username}/picture" />
<img class="img-thumbnail" src="{topics.teaser_userpicture}" />
<p>
{topics.teaser_text} &mdash; {topics.teaser_timestamp} ago
</p>
<div class="clear"></div>
</div>
</li>
<!-- END topics -->

@ -1,6 +1,6 @@
<div class="alert alert-error">
<div class="alert alert-danger">
<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, and you have been placed in <strong>read-only mode</strong>.
</p>
<p>
Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).

@ -1,12 +1,13 @@
<ul class="posts">
<!-- BEGIN main_posts -->
<li>
<a name="{main_posts.pid}"></a>
<div class="row">
<div class="span2">
<img src="{main_posts.picture}" /><br />
{main_posts.username}
<div class="col-lg-2 profile">
<img class="img-thumbnail" src="{main_posts.picture}" /><br />
<span class="username">{main_posts.username}</span>
</div>
<div class="span10">
<div class="col-lg-10">
{main_posts.content}
</div>
</div>
@ -14,12 +15,13 @@
<!-- END main_posts -->
<!-- BEGIN posts -->
<li>
<a name="{posts.pid}"></a>
<div class="row">
<div class="span2">
<img src="{posts.picture}" /><br />
{posts.username}
<div class="col-lg-2 profile">
<img class="img-thumbnail" src="{posts.picture}" /><br />
<span class="username">{posts.username}</span>
</div>
<div class="span10">
<div class="col-lg-10">
{posts.content}
</div>
<div class="clear"></div>

@ -142,6 +142,9 @@
</li>
<!-- END posts -->
</ul>
<div id="loading-indicator" style="text-align:center;" class="hide" done="0">
<i class="icon-spinner icon-spin icon-large"></i>
</div>
<hr />
<div class="topic-main-buttons">
<button id="post_reply" class="btn btn-primary btn-lg post_reply" type="button">Reply</button>

@ -5,10 +5,13 @@
topics = require('./topics.js'),
fs = require('fs'),
rss = require('node-rss'),
winston = require('winston');
winston = require('winston'),
path = require('path');
function saveFeed(location, feed) {
fs.writeFile(location, rss.getFeedXML(feed), function (err) {
var savePath = path.join(__dirname, '../', location);
fs.writeFile(savePath, rss.getFeedXML(feed), function (err) {
if(err) {
winston.err(err);
}
@ -21,18 +24,19 @@
feed_url,
description,
author,
xml_url,
xml_url,
{
'urn' : urn
}
);
);
}
Feed.updateTopic = function(tid, cid) {
winston.info('[RSS] Updating RSS feeds for topic ' + tid);
var cache_time_in_seconds = 60;
topics.getTopicWithPosts(tid, 0, function(err, topicData) {
topics.getTopicWithPosts(tid, 0, 0, -1, function(err, topicData) {
if (err) winston.error('Problem saving topic RSS feed', err.stack);
var location = '/topic/' + topicData.slug,
@ -79,14 +83,14 @@
var urn = 'urn:' + cid;
var feed = createFeed(categoryData.category_name, '', location, xml_url, 'NodeBB', urn); // not exactly sure if author for a category should be site_title?
var title;
var topics = categoryData.topics;
for (var i = 0, ii = topics.length; i < ii; i++) {
urn = 'urn:' + cid + ':' + topics[i].tid;
title = topics[i].title + '. Posted on ' + (new Date(parseInt(topics[i].timestamp, 10)).toUTCString());
feed.addNewItem(
title,
location,

@ -259,6 +259,7 @@ var RDB = require('./redis.js'),
var socketData = { posts: [postData] };
io.sockets.in('topic_' + tid).emit('event:new_post', socketData);
io.sockets.in('recent_posts').emit('event:new_post', socketData);
io.sockets.in('users/' + uid).emit('event:new_post', socketData);
});
callback(null, 'Reply successful');

@ -110,7 +110,7 @@ var user = require('./../user.js'),
app.get('/api/topic/:id/:slug?', function(req, res, next) {
var uid = (req.user) ? req.user.uid : 0;
topics.getTopicWithPosts(req.params.id, uid, function(err, data) {
topics.getTopicWithPosts(req.params.id, uid, 0, 10, function(err, data) {
if(data.deleted === '1' && data.expose_tools === 0) {
return res.json(404, {});
}

@ -324,7 +324,7 @@ var RDB = require('./redis.js')
}
Topics.getTopicWithPosts = function(tid, current_user, callback) {
Topics.getTopicWithPosts = function(tid, current_user, start, end, callback) {
threadTools.exists(tid, function(exists) {
if (!exists)
return callback(new Error('Topic tid \'' + tid + '\' not found'));
@ -338,7 +338,7 @@ var RDB = require('./redis.js')
}
function getTopicPosts(next) {
Topics.getTopicPosts(tid, 0, 10, current_user, function(topicPosts, privileges) {
Topics.getTopicPosts(tid, start, end, current_user, function(topicPosts, privileges) {
next(null, topicPosts);
});
}
@ -679,6 +679,7 @@ var RDB = require('./redis.js')
Topics.getTopicForCategoryView(tid, uid, function(topicData) {
io.sockets.in('category_' + category_id).emit('event:new_topic', topicData);
io.sockets.in('recent_posts').emit('event:new_topic', topicData);
io.sockets.in('users/' + uid).emit('event:new_post', {posts:postData});
});
callback(null, postData);

@ -212,7 +212,7 @@ var express = require('express'),
var tid = req.params.topic_id;
if (tid.match(/^\d+\.rss$/)) {
fs.readFile('feeds/topics/' + tid, function (err, data) {
fs.readFile(path.join(__dirname, '../', 'feeds/topics', tid), function (err, data) {
if (err) {
res.type('text').send(404, "Unable to locate an rss feed at this location.");
return;
@ -225,7 +225,7 @@ var express = require('express'),
async.waterfall([
function(next) {
topics.getTopicWithPosts(tid, ((req.user) ? req.user.uid : 0), function(err, topicData) {
topics.getTopicWithPosts(tid, ((req.user) ? req.user.uid : 0), 0, -1, function(err, topicData) {
if(topicData) {
if(topicData.deleted === '1' && topicData.expose_tools === 0)
return next(new Error('Topic deleted'), null);
@ -235,8 +235,7 @@ var express = require('express'),
});
},
function(topicData, next) {
var posts = topicData.posts.push(topicData.main_posts[0]),
lastMod = 0,
var lastMod = 0,
timestamp;
for(var x=0,numPosts=topicData.posts.length;x<numPosts;x++) {
@ -281,7 +280,7 @@ var express = require('express'),
var cid = req.params.category_id;
if (cid.match(/^\d+\.rss$/)) {
fs.readFile('feeds/categories/' + cid, function (err, data) {
fs.readFile(path.join(__dirname, '../', 'feeds/categories', cid), function (err, data) {
if (err) {
res.type('text').send(404, "Unable to locate an rss feed at this location.");
return;

Loading…
Cancel
Save