mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
hiding search buttons and route when search is not configured
This commit is contained in:
@@ -76,9 +76,11 @@
|
||||
</li>
|
||||
<!-- ENDIF isAdmin -->
|
||||
|
||||
<!-- IF searchEnabled -->
|
||||
<li class="visible-xs">
|
||||
<a id="mobile-search-button" href="{relative_path}/search"><i class="fa fa-search fa-fw" title="[[global:header.search]]"></i> [[global:header.search]]</a>
|
||||
</li>
|
||||
<!-- ENDIF searchEnabled -->
|
||||
|
||||
<!-- BEGIN navigation -->
|
||||
<li class="{navigation.class}">
|
||||
@@ -167,6 +169,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- IF searchEnabled -->
|
||||
<ul id="logged-conditional-menu" class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<form id="search-form" class="navbar-form navbar-right hidden-xs" role="search" method="GET" action="">
|
||||
@@ -180,6 +183,7 @@
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- ENDIF searchEnabled -->
|
||||
|
||||
<ul class="nav navbar-nav navbar-right pagination-block hide">
|
||||
<li class="active">
|
||||
|
||||
@@ -361,6 +361,10 @@ var path = require('path'),
|
||||
});
|
||||
|
||||
app.get('/search/:term', function (req, res, next) {
|
||||
if (!Plugins.hasListeners('filter:search.query')) {
|
||||
return res.redirect('/404');
|
||||
}
|
||||
|
||||
var limit = 50;
|
||||
|
||||
function searchPosts(callback) {
|
||||
|
||||
@@ -104,7 +104,8 @@ module.exports.server = server;
|
||||
clientScripts: clientScripts,
|
||||
navigation: custom_header.navigation,
|
||||
'cache-buster': meta.config['cache-buster'] ? 'v=' + meta.config['cache-buster'] : '',
|
||||
allowRegistration: meta.config.allowRegistration === undefined || parseInt(meta.config.allowRegistration, 10) === 1
|
||||
allowRegistration: meta.config.allowRegistration === undefined || parseInt(meta.config.allowRegistration, 10) === 1,
|
||||
searchEnabled: plugins.hasListeners('filter:search.query') ? true : false
|
||||
},
|
||||
escapeList = {
|
||||
'&': '&',
|
||||
|
||||
Reference in New Issue
Block a user