mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-17 04:52:51 +01:00
Merge branch 'master' of github.com:designcreateplay/NodeBB
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,5 +8,6 @@ sftp-config.json
|
||||
config.json
|
||||
public/config.json
|
||||
public/css/*.css
|
||||
public/themes/*
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
@@ -146,7 +146,8 @@
|
||||
line-height: 16px;
|
||||
margin-left: 1px;
|
||||
padding: 5px 5px 5px 0px;
|
||||
|
||||
list-style-type: none;
|
||||
|
||||
li {
|
||||
clear: both;
|
||||
line-height: 16px;
|
||||
@@ -163,6 +164,7 @@
|
||||
p {
|
||||
display: block;
|
||||
padding-left:5px;
|
||||
padding-top: 2px;
|
||||
overflow: hidden;
|
||||
height: 32px;
|
||||
margin-bottom: 0.5em;
|
||||
|
||||
BIN
public/images/themes/default.png
Normal file
BIN
public/images/themes/default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@@ -35,13 +35,13 @@ var ajaxify = {};
|
||||
url = url.slice(RELATIVE_PATH.length);
|
||||
}
|
||||
|
||||
var tpl_url = templates.get_custom_map(url);
|
||||
var tpl_url = templates.get_custom_map(url.split('?')[0]);
|
||||
|
||||
if (tpl_url == false && !templates[url]) {
|
||||
if(url === '' || url === '/') {
|
||||
tpl_url = 'home';
|
||||
} else {
|
||||
tpl_url = url.split('/')[0];
|
||||
tpl_url = url.split('/')[0].split('?')[0];
|
||||
}
|
||||
|
||||
} else if (templates[url]) {
|
||||
@@ -75,10 +75,6 @@ var ajaxify = {};
|
||||
return false;
|
||||
}
|
||||
|
||||
ajaxify.onclick = function(ev) {
|
||||
|
||||
}
|
||||
|
||||
$('document').ready(function() {
|
||||
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
|
||||
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
|
||||
var editLink = $('#editLink');
|
||||
var followBtn = $('#follow-btn');
|
||||
|
||||
if( yourid !== theirid) {
|
||||
if(yourid === "0") {
|
||||
editLink.hide();
|
||||
followBtn.hide();
|
||||
}
|
||||
else if(yourid !== theirid) {
|
||||
editLink.hide();
|
||||
if(isFollowing)
|
||||
followBtn.hide();
|
||||
|
||||
@@ -89,14 +89,17 @@ var nodebb_admin = (function(nodebb_admin) {
|
||||
for(var x=0,numThemes=themes.length;x<numThemes;x++) {
|
||||
liEl.setAttribute('data-theme', themes[x].id);
|
||||
liEl.setAttribute('data-css', themes[x].src);
|
||||
liEl.innerHTML = '<img src="' + themes[x].thumbnail + '" />' +
|
||||
liEl.innerHTML = '<img src="' + themes[x].screenshot + '" />' +
|
||||
'<div>' +
|
||||
'<div class="pull-right">' +
|
||||
'<button class="btn btn-primary" data-action="use">Use</button> ' +
|
||||
'<button class="btn" data-action="preview">Preview</button>' +
|
||||
'</div>' +
|
||||
'<h4>' + themes[x].name + '</h4>' +
|
||||
'<p>' + themes[x].description + '</p>' +
|
||||
'<p>' +
|
||||
themes[x].description +
|
||||
(themes[x].url ? ' (<a href="' + themes[x].url + '">Homepage</a>)' : '') +
|
||||
'</p>' +
|
||||
'</div>' +
|
||||
'<div class="clear">';
|
||||
themeFrag.appendChild(liEl.cloneNode(true));
|
||||
|
||||
@@ -287,6 +287,9 @@ define(['taskbar'], function(taskbar) {
|
||||
titleEl = composer.postContainer.querySelector('input'),
|
||||
bodyEl = composer.postContainer.querySelector('textarea');
|
||||
|
||||
titleEl.value = titleEl.value.trim();
|
||||
bodyEl.value = bodyEl.value.trim();
|
||||
|
||||
if (titleEl.value.length < 3) {
|
||||
return app.alert({
|
||||
type: 'error',
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
}
|
||||
|
||||
templates.getTemplateNameFromUrl = function(url) {
|
||||
var parts = url.split('/');
|
||||
var parts = url.split('?')[0].split('/');
|
||||
|
||||
for(var i=0; i<parts.length; ++i) {
|
||||
if (templates.is_available(parts[i])) {
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
var api_url = (url === '' || url === '/') ? 'home' : url;
|
||||
|
||||
var tpl_url = templates.get_custom_map(api_url);
|
||||
var tpl_url = templates.get_custom_map(api_url.split('?')[0]);
|
||||
|
||||
var trimmed = api_url;
|
||||
|
||||
|
||||
@@ -107,6 +107,23 @@
|
||||
return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
|
||||
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
||||
});
|
||||
},
|
||||
|
||||
buildMetaTags: function(tagsArr) {
|
||||
var tags = '',
|
||||
tag;
|
||||
for(var x=0,numTags=tagsArr.length;x<numTags;x++) {
|
||||
if (tags.length > 0) tags += "\n\t";
|
||||
tag = '<meta';
|
||||
for(y in tagsArr[x]) {
|
||||
tag += ' ' + y + '="' + tagsArr[x][y] + '"';
|
||||
}
|
||||
tag += ' />';
|
||||
|
||||
tags += tag;
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<div class="modal-body">
|
||||
|
||||
<form id="uploadForm" action="{relative_path}/users/uploadpicture" method="post" enctype="multipart/form-data">
|
||||
<input id="userPhotoInput" type="file" name="userPhoto" >
|
||||
<input id="imageUploadCsrf" type="hidden" name="_csrf" value="">
|
||||
<input id="userPhotoInput" type="file" name="userPhoto" />
|
||||
<input id="imageUploadCsrf" type="hidden" name="_csrf" value="" />
|
||||
</form>
|
||||
|
||||
<div id="upload-progress-box" class="progress progress-striped active hide">
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<div class="account-username-box">
|
||||
<span class="account-username">
|
||||
<a href="/users/{userslug}">{username}</a> >
|
||||
<a href="/users/{userslug}">{username}</a> <i class="icon-chevron-right"></i>
|
||||
<a href="/users/{userslug}/edit">edit</a>
|
||||
</span>
|
||||
<div class="account-sub-links inline-block pull-right">
|
||||
|
||||
@@ -14,6 +14,21 @@
|
||||
<strong>There are no topics in this category.</strong><br />
|
||||
Why don't you try posting one?
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<button id="new_post" class="btn btn-primary btn-large {show_topic_button}">New Topic</button>
|
||||
|
||||
<div class="inline-block pull-right">
|
||||
<a target="_blank" href="../{category_id}.rss"><i class="icon-rss-sign icon-2x"></i></a>
|
||||
<a href="#" id="facebook-share"><i class="icon-facebook-sign icon-2x"></i></a>
|
||||
<a href="#" id="twitter-intent"><i class="icon-twitter-sign icon-2x"></i></a>
|
||||
<a href="#" id="google-share"><i class="icon-google-plus-sign icon-2x"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="{show_sidebar}" />
|
||||
|
||||
<div class="category row">
|
||||
<div class="{topic_row_size}">
|
||||
<ul id="topics-container">
|
||||
@@ -47,18 +62,9 @@
|
||||
</li></a>
|
||||
<!-- END topics -->
|
||||
</ul>
|
||||
<hr class="{show_sidebar}" />
|
||||
<button id="new_post" class="btn btn-primary btn-large {show_topic_button}">New Topic</button>
|
||||
</div>
|
||||
<div class="span3 {show_sidebar} category-sidebar mobile-sidebar">
|
||||
<div class="sidebar-block img-polaroid">
|
||||
<div class="block-header">
|
||||
<a target="_blank" href="../{category_id}.rss"><i class="icon-rss-sign icon-2x"></i></a>
|
||||
<a href="#" id="facebook-share"><i class="icon-facebook-sign icon-2x"></i></a>
|
||||
<a href="#" id="twitter-intent"><i class="icon-twitter-sign icon-2x"></i></a>
|
||||
<a href="#" id="google-share"><i class="icon-google-plus-sign icon-2x"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-block img-polaroid">
|
||||
<div class="block-header">
|
||||
Recent Replies
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="account-username-box">
|
||||
<span class="account-username">
|
||||
<a href="/users/{userslug}">{username}</a> >
|
||||
<a href="/users/{userslug}">{username}</a> <i class="icon-chevron-right"></i>
|
||||
<a href="/users/{userslug}/followers">followers</a>
|
||||
</span>
|
||||
<div class="account-sub-links inline-block pull-right">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="account-username-box">
|
||||
<span class="account-username">
|
||||
<a href="/users/{userslug}">{username}</a> >
|
||||
<a href="/users/{userslug}">{username}</a> <i class="icon-chevron-right"></i>
|
||||
<a href="/users/{userslug}/following">following</a>
|
||||
</span>
|
||||
<div class="account-sub-links inline-block pull-right">
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="title" CONTENT="NodeBB">
|
||||
<meta name="keywords" content="" />
|
||||
<meta name="description" content="" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
{meta_tags}
|
||||
<link href="{cssSrc}" rel="stylesheet" media="screen">
|
||||
<link href="{relative_path}/vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
|
||||
<link rel="stylesheet" href="{relative_path}/vendor/fontawesome/css/font-awesome.min.css">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- BEGIN posts -->
|
||||
<div class="category-box">
|
||||
<div class="post-preview">
|
||||
<img src="{categories.posts.picture}" class="pull-left" >
|
||||
<img src="{categories.posts.picture}" class="pull-left" />
|
||||
<p class=""><strong>{categories.posts.username}</strong>: {categories.posts.content}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<button class="btn btn-large" type="button" onclick="window.location='{url}'">Continue to {url}</button>
|
||||
<button class="btn btn-large btn-inverse" type="button" onclick="history.go(-1); window.location='{home}'">Return to NodeBB</button>
|
||||
<a href="{url}" rel="nofollow" class="btn btn-large">Continue to {url}</a>
|
||||
<a href="{home}" class="btn btn-large btn-inverse">Return to NodeBB</a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -13,7 +13,8 @@ var RDB = require('./redis.js'),
|
||||
if (err) return callback(err);
|
||||
|
||||
var category_name = categoryData.name,
|
||||
category_slug = categoryData.slug;
|
||||
category_slug = categoryData.slug,
|
||||
category_description = categoryData.description;
|
||||
|
||||
function getTopicIds(next) {
|
||||
Categories.getTopicIds(category_id, next);
|
||||
@@ -28,8 +29,9 @@ var RDB = require('./redis.js'),
|
||||
|
||||
var categoryData = {
|
||||
'category_name' : category_name,
|
||||
'category_description': category_description,
|
||||
'show_sidebar' : 'show',
|
||||
'show_topic_button': 'show',
|
||||
'show_topic_button': 'inline-block',
|
||||
'no_topics_message': 'hidden',
|
||||
'topic_row_size': 'span9',
|
||||
'category_id': category_id,
|
||||
@@ -174,7 +176,10 @@ var RDB = require('./redis.js'),
|
||||
|
||||
function loadTopic(tid, callback) {
|
||||
topics.getTopicData(tid, function(topicData) {
|
||||
|
||||
if(!topicData) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
getTopicInfo(topicData, function(topicInfo) {
|
||||
|
||||
topicData['pin-icon'] = topicData.pinned === '1' ? 'icon-pushpin' : 'none';
|
||||
|
||||
@@ -61,6 +61,8 @@ var utils = require('./../public/src/utils.js'),
|
||||
fs.readFile(themeConfPath, function(err, conf) {
|
||||
conf = JSON.parse(conf);
|
||||
conf.src = global.nconf.get('url') + 'themes/' + themeDir + '/' + conf.src;
|
||||
if (conf.screenshot) conf.screenshot = global.nconf.get('url') + 'themes/' + themeDir + '/' + conf.screenshot;
|
||||
else conf.screenshot = global.nconf.get('url') + 'images/themes/default.png';
|
||||
themeArr.push(conf);
|
||||
next();
|
||||
});
|
||||
|
||||
@@ -184,6 +184,10 @@ var RDB = require('./redis.js'),
|
||||
}
|
||||
|
||||
Posts.reply = function(socket, tid, uid, content, images) {
|
||||
if(content) {
|
||||
content = content.trim();
|
||||
}
|
||||
|
||||
if (uid < 1) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Reply Unsuccessful',
|
||||
|
||||
@@ -338,6 +338,11 @@ marked.setOptions({
|
||||
if (!category_id)
|
||||
throw new Error('Attempted to post without a category_id');
|
||||
|
||||
if(content)
|
||||
content = content.trim();
|
||||
if(title)
|
||||
title = title.trim();
|
||||
|
||||
if (uid === 0) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Thank you for posting',
|
||||
|
||||
@@ -26,12 +26,20 @@ var express = require('express'),
|
||||
(function(app) {
|
||||
var templates = null;
|
||||
|
||||
app.build_header = function(res) {
|
||||
app.build_header = function(res, metaTags) {
|
||||
var defaultMetaTags = [
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' },
|
||||
{ name: 'content-type', content: 'text/html; charset=UTF-8' },
|
||||
{ name: 'apple-mobile-web-app-capable', content: 'yes' }
|
||||
],
|
||||
metaString = utils.buildMetaTags(defaultMetaTags.concat(metaTags || []));
|
||||
|
||||
return templates['header'].parse({
|
||||
cssSrc: global.config['theme:src'] || global.nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css',
|
||||
title: global.config['title'] || 'NodeBB',
|
||||
csrf:res.locals.csrf_token,
|
||||
relative_path: global.nconf.get('relative_path')
|
||||
relative_path: global.nconf.get('relative_path'),
|
||||
meta_tags: metaString
|
||||
});
|
||||
};
|
||||
|
||||
@@ -154,7 +162,6 @@ var express = require('express'),
|
||||
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
|
||||
categories.getAllCategories(function(returnData) {
|
||||
res.send(
|
||||
app.build_header(res) +
|
||||
@@ -211,9 +218,12 @@ var express = require('express'),
|
||||
var category_url = cid + (req.params.slug ? '/' + req.params.slug : '');
|
||||
categories.getCategoryById(cid, 0, function(err, returnData) {
|
||||
if(err) return res.redirect('404');
|
||||
|
||||
|
||||
res.send(
|
||||
app.build_header(res) +
|
||||
app.build_header(res, [
|
||||
{ name: 'title', content: returnData.category_name },
|
||||
{ name: 'description', content: returnData.category_description }
|
||||
]) +
|
||||
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/category'].parse(returnData) + '\n\t</noscript>' +
|
||||
'\n\t<script>templates.ready(function(){ajaxify.go("category/' + category_url + '");});</script>' +
|
||||
templates['footer']
|
||||
@@ -413,6 +423,19 @@ var express = require('express'),
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'outgoing' :
|
||||
var url = req.url.split('?');
|
||||
|
||||
if (url[1]) {
|
||||
res.json({
|
||||
url: url[1],
|
||||
home: global.nconf.get('url')
|
||||
});
|
||||
} else {
|
||||
res.status(404);
|
||||
res.redirect(global.nconf.get('relative_path') + '/404');
|
||||
}
|
||||
break;
|
||||
default :
|
||||
res.json(404, { error: 'unrecognized API endpoint' });
|
||||
break;
|
||||
|
||||
@@ -281,35 +281,37 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
|
||||
|
||||
socket.on('api:user.follow', function(data) {
|
||||
|
||||
user.follow(uid, data.uid, function(success) {
|
||||
if(success) {
|
||||
user.getUserField(data.uid, 'username', function(username) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Following',
|
||||
message: 'You are now following ' + username + '!',
|
||||
type: 'success',
|
||||
timeout: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
if(uid) {
|
||||
user.follow(uid, data.uid, function(success) {
|
||||
if(success) {
|
||||
user.getUserField(data.uid, 'username', function(username) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Following',
|
||||
message: 'You are now following ' + username + '!',
|
||||
type: 'success',
|
||||
timeout: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:user.unfollow', function(data) {
|
||||
|
||||
user.unfollow(uid, data.uid, function(success) {
|
||||
if(success) {
|
||||
user.getUserField(data.uid, 'username', function(username) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Unfollowed',
|
||||
message: 'You are no longer following ' + username + '!',
|
||||
type: 'success',
|
||||
timeout: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
if(uid) {
|
||||
user.unfollow(uid, data.uid, function(success) {
|
||||
if(success) {
|
||||
user.getUserField(data.uid, 'username', function(username) {
|
||||
socket.emit('event:alert', {
|
||||
title: 'Unfollowed',
|
||||
message: 'You are no longer following ' + username + '!',
|
||||
type: 'success',
|
||||
timeout: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:topics.post', function(data) {
|
||||
|
||||
Reference in New Issue
Block a user