mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +01:00
Merge remote-tracking branch 'origin/master' into socket.io1.x
This commit is contained in:
@@ -34,8 +34,11 @@ define('search', ['navigator'], function(nav) {
|
|||||||
tid: tid,
|
tid: tid,
|
||||||
term: term
|
term: term
|
||||||
}, function(err, pids) {
|
}, function(err, pids) {
|
||||||
callback(err);
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(pids)) {
|
||||||
// Sort pids numerically & store
|
// Sort pids numerically & store
|
||||||
Search.current = {
|
Search.current = {
|
||||||
results: pids.sort(function(a, b) {
|
results: pids.sort(function(a, b) {
|
||||||
@@ -46,6 +49,7 @@ define('search', ['navigator'], function(nav) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Search.topicDOM.update(0);
|
Search.topicDOM.update(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,7 +61,10 @@ define('search', ['navigator'], function(nav) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Search.topicDOM = {};
|
Search.topicDOM = {
|
||||||
|
active: false
|
||||||
|
};
|
||||||
|
|
||||||
Search.topicDOM.prev = function() {
|
Search.topicDOM.prev = function() {
|
||||||
Search.topicDOM.update((Search.current.index === 0) ? Search.current.results.length-1 : Search.current.index-1);
|
Search.topicDOM.update((Search.current.index === 0) ? Search.current.results.length-1 : Search.current.index-1);
|
||||||
};
|
};
|
||||||
@@ -70,24 +77,44 @@ define('search', ['navigator'], function(nav) {
|
|||||||
var topicSearchEl = $('.topic-search');
|
var topicSearchEl = $('.topic-search');
|
||||||
Search.current.index = index;
|
Search.current.index = index;
|
||||||
|
|
||||||
|
Search.topicDOM.start();
|
||||||
|
|
||||||
|
Search.checkPagePresence(Search.current.tid, function() {
|
||||||
if (Search.current.results.length > 0) {
|
if (Search.current.results.length > 0) {
|
||||||
topicSearchEl.find('.count').html((index+1) + ' / ' + Search.current.results.length);
|
topicSearchEl.find('.count').html((index+1) + ' / ' + Search.current.results.length);
|
||||||
topicSearchEl.removeClass('hidden').find('.prev, .next').removeAttr('disabled');
|
topicSearchEl.find('.prev, .next').removeAttr('disabled');
|
||||||
Search.checkPagePresence(Search.current.tid, function() {
|
|
||||||
socket.emit('posts.getPidIndex', Search.current.results[index], function(err, postIndex) {
|
socket.emit('posts.getPidIndex', Search.current.results[index], function(err, postIndex) {
|
||||||
nav.scrollToPost(postIndex-1, true); // why -1? Ask @barisusakli
|
nav.scrollToPost(postIndex-1, true); // why -1? Ask @barisusakli
|
||||||
});
|
});
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
translator.translate('[[search:no-matches]]', function(text) {
|
translator.translate('[[search:no-matches]]', function(text) {
|
||||||
topicSearchEl.find('.count').html(text);
|
topicSearchEl.find('.count').html(text);
|
||||||
});
|
});
|
||||||
topicSearchEl.removeClass('hidden').find('.prev, .next').attr('disabled', 'disabled');
|
topicSearchEl.removeClass('hidden').find('.prev, .next').attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Search.topicDOM.start = function() {
|
||||||
|
$('.topic-search').removeClass('hidden');
|
||||||
|
if (!Search.topicDOM.active) {
|
||||||
|
Search.topicDOM.active = true;
|
||||||
|
|
||||||
|
// Bind to esc
|
||||||
|
require(['mousetrap'], function(Mousetrap) {
|
||||||
|
Mousetrap.bind('esc', Search.topicDOM.end);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Search.topicDOM.end = function() {
|
Search.topicDOM.end = function() {
|
||||||
$('.topic-search').addClass('hidden');
|
$('.topic-search').addClass('hidden').find('.prev, .next').attr('disabled', 'disabled');
|
||||||
|
Search.topicDOM.active = false;
|
||||||
|
|
||||||
|
// Unbind esc
|
||||||
|
require(['mousetrap'], function(Mousetrap) {
|
||||||
|
Mousetrap.unbind('esc', Search.topicDOM.end);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return Search;
|
return Search;
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ function setCopyrightWidget(next) {
|
|||||||
|
|
||||||
db.init(function(err) {
|
db.init(function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://www.nodebb.com\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/NodeBB/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", next);
|
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://nodebb.org\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/NodeBB/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", next);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,17 @@ Templates.compile = function(callback) {
|
|||||||
var coreTemplatesPath = nconf.get('core_templates_path'),
|
var coreTemplatesPath = nconf.get('core_templates_path'),
|
||||||
baseTemplatesPath = nconf.get('base_templates_path'),
|
baseTemplatesPath = nconf.get('base_templates_path'),
|
||||||
viewsPath = nconf.get('views_dir'),
|
viewsPath = nconf.get('views_dir'),
|
||||||
themeTemplatesPath = nconf.get('theme_templates_path');
|
themeTemplatesPath = nconf.get('theme_templates_path'),
|
||||||
|
themeConfig = require(nconf.get('theme_config'));
|
||||||
|
|
||||||
|
if (themeConfig.baseTheme) {
|
||||||
|
var pathToBaseTheme = path.join(nconf.get('themes_path'), themeConfig.baseTheme),
|
||||||
|
baseTemplatesPath = require(path.join(pathToBaseTheme, 'theme.json')).templates;
|
||||||
|
|
||||||
|
if (!baseTemplatesPath){
|
||||||
|
baseTemplatesPath = path.join(pathToBaseTheme, 'templates');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugins.getTemplates(function(err, pluginTemplates) {
|
plugins.getTemplates(function(err, pluginTemplates) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ module.exports = function(Meta) {
|
|||||||
// Theme's templates path
|
// Theme's templates path
|
||||||
var themePath = nconf.get('base_templates_path'),
|
var themePath = nconf.get('base_templates_path'),
|
||||||
fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates');
|
fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates');
|
||||||
|
|
||||||
if (themeObj.templates) {
|
if (themeObj.templates) {
|
||||||
themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates);
|
themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates);
|
||||||
} else if (fs.existsSync(fallback)) {
|
} else if (fs.existsSync(fallback)) {
|
||||||
@@ -118,5 +119,6 @@ module.exports = function(Meta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nconf.set('theme_templates_path', themePath);
|
nconf.set('theme_templates_path', themePath);
|
||||||
|
nconf.set('theme_config', path.join(nconf.get('themes_path'), themeObj.id, 'theme.json'));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -523,7 +523,7 @@ Upgrade.upgrade = function(callback) {
|
|||||||
thisSchemaDate = Date.UTC(2014, 3, 31, 12, 30);
|
thisSchemaDate = Date.UTC(2014, 3, 31, 12, 30);
|
||||||
|
|
||||||
if (schemaDate < thisSchemaDate) {
|
if (schemaDate < thisSchemaDate) {
|
||||||
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://www.nodebb.com\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/NodeBB/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", function(err) {
|
db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"<footer id=\\\"footer\\\" class=\\\"container footer\\\">\\r\\n\\t<div class=\\\"copyright\\\">\\r\\n\\t\\tCopyright © 2014 <a target=\\\"_blank\\\" href=\\\"https://nodebb.org\\\">NodeBB Forums</a> | <a target=\\\"_blank\\\" href=\\\"//github.com/NodeBB/NodeBB/graphs/contributors\\\">Contributors</a>\\r\\n\\t</div>\\r\\n</footer>\",\"title\":\"\",\"container\":\"\"}}]", function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
winston.error('[2014/3/31] Problem re-adding copyright message into global footer widget');
|
winston.error('[2014/3/31] Problem re-adding copyright message into global footer widget');
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<div class="alert-window alert-right-bottom"></div>
|
<div class="alert-window alert-right-bottom"></div>
|
||||||
|
|
||||||
<div id="footer" class="container" style="padding-top: 50px; display:none;">
|
<div id="footer" class="container" style="padding-top: 50px; display:none;">
|
||||||
<footer class="footer">Copyright © 2014 <a target="_blank" href="http://www.nodebb.com">NodeBB</a> by <a target="_blank" href="https://github.com/psychobunny">psychobunny</a>, <a href="https://github.com/julianlam" target="_blank">julianlam</a>, <a href="https://github.com/barisusakli" target="_blank">barisusakli</a> from <a target="_blank" href="http://www.designcreateplay.com">designcreateplay</a></footer>
|
<footer class="footer">Copyright © 2014 <a target="_blank" href="https://nodebb.org">NodeBB</a> by <a target="_blank" href="https://github.com/psychobunny">psychobunny</a>, <a href="https://github.com/julianlam" target="_blank">julianlam</a>, <a href="https://github.com/barisusakli" target="_blank">barisusakli</a> from <a target="_blank" href="http://www.designcreateplay.com">designcreateplay</a></footer>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user