From 0f4fcd8e0b0276d72dae1de1dce89e68607083bf Mon Sep 17 00:00:00 2001 From: bendem Date: Thu, 20 Nov 2014 12:08:53 +0100 Subject: [PATCH 1/3] fix nodeBB adresses --- src/install.js | 2 +- src/upgrade.js | 2 +- src/views/admin/footer.tpl | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/install.js b/src/install.js index 5c00f41c84..564f06f703 100644 --- a/src/install.js +++ b/src/install.js @@ -436,7 +436,7 @@ function setCopyrightWidget(next) { db.init(function(err) { if (!err) { - db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next); + db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next); } }); } diff --git a/src/upgrade.js b/src/upgrade.js index b793986429..c9aa321d96 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -523,7 +523,7 @@ Upgrade.upgrade = function(callback) { thisSchemaDate = Date.UTC(2014, 3, 31, 12, 30); if (schemaDate < thisSchemaDate) { - db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", function(err) { + db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", function(err) { if (err) { winston.error('[2014/3/31] Problem re-adding copyright message into global footer widget'); next(); diff --git a/src/views/admin/footer.tpl b/src/views/admin/footer.tpl index 66c1ddc335..92aba3d202 100644 --- a/src/views/admin/footer.tpl +++ b/src/views/admin/footer.tpl @@ -43,7 +43,7 @@
- \ No newline at end of file + From 0b58e2fea356cd35f6ff35e321e14e3b7bf75adb Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 20 Nov 2014 16:58:56 -0500 Subject: [PATCH 2/3] minor tweaks to in-topic searching UI, #2442 --- public/src/modules/search.js | 75 ++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/public/src/modules/search.js b/public/src/modules/search.js index 9059c58165..0efb754eb2 100644 --- a/public/src/modules/search.js +++ b/public/src/modules/search.js @@ -34,18 +34,22 @@ define('search', ['navigator'], function(nav) { tid: tid, term: term }, function(err, pids) { - callback(err); - - // Sort pids numerically & store - Search.current = { - results: pids.sort(function(a, b) { - return a-b; - }), - tid: tid, - term: term - }; - - Search.topicDOM.update(0); + if (err) { + return callback(err); + } + + if (Array.isArray(pids)) { + // Sort pids numerically & store + Search.current = { + results: pids.sort(function(a, b) { + return a-b; + }), + tid: tid, + term: term + }; + + 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.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'); Search.current.index = index; - if (Search.current.results.length > 0) { - topicSearchEl.find('.count').html((index+1) + ' / ' + Search.current.results.length); - topicSearchEl.removeClass('hidden').find('.prev, .next').removeAttr('disabled'); - Search.checkPagePresence(Search.current.tid, function() { + Search.topicDOM.start(); + + Search.checkPagePresence(Search.current.tid, function() { + if (Search.current.results.length > 0) { + topicSearchEl.find('.count').html((index+1) + ' / ' + Search.current.results.length); + topicSearchEl.find('.prev, .next').removeAttr('disabled'); socket.emit('posts.getPidIndex', Search.current.results[index], function(err, postIndex) { nav.scrollToPost(postIndex-1, true); // why -1? Ask @barisusakli }); + } else { + translator.translate('[[search:no-matches]]', function(text) { + topicSearchEl.find('.count').html(text); + }); + 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); }); - } else { - translator.translate('[[search:no-matches]]', function(text) { - topicSearchEl.find('.count').html(text); - }); - topicSearchEl.removeClass('hidden').find('.prev, .next').attr('disabled', 'disabled'); } - }; + } 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; From c905f961082a819530e4c722f2c5ec80aa4f260c Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 20 Nov 2014 17:50:01 -0500 Subject: [PATCH 3/3] closes #2412 --- src/meta/templates.js | 12 +++++++++++- src/meta/themes.js | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/meta/templates.js b/src/meta/templates.js index 9625969947..9fd6697aae 100644 --- a/src/meta/templates.js +++ b/src/meta/templates.js @@ -27,7 +27,17 @@ Templates.compile = function(callback) { var coreTemplatesPath = nconf.get('core_templates_path'), baseTemplatesPath = nconf.get('base_templates_path'), 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) { if (err) { diff --git a/src/meta/themes.js b/src/meta/themes.js index dc26a1bc83..dde10c3786 100644 --- a/src/meta/themes.js +++ b/src/meta/themes.js @@ -111,6 +111,7 @@ module.exports = function(Meta) { // Theme's templates path var themePath = nconf.get('base_templates_path'), fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates'); + if (themeObj.templates) { themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates); } else if (fs.existsSync(fallback)) { @@ -118,5 +119,6 @@ module.exports = function(Meta) { } nconf.set('theme_templates_path', themePath); + nconf.set('theme_config', path.join(nconf.get('themes_path'), themeObj.id, 'theme.json')); }; }; \ No newline at end of file