Merge pull request #2895 from techAPJ/patch-1

Hide google search when the instance is private
This commit is contained in:
Régis Hanol 2014-10-20 14:53:38 +02:00
commit b394b7d626
4 changed files with 18 additions and 9 deletions

View File

@ -3,5 +3,9 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
import DiscourseController from 'discourse/controllers/controller';
export default DiscourseController.extend(ModalFunctionality, {
needs: ['modal']
needs: ['modal'],
showGoogleSearch: function() {
return !Discourse.SiteSettings.login_required;
}.property()
});

View File

@ -1,3 +1,6 @@
<div id="search-help" class="modal-body">
{{{model}}}
{{#if showGoogleSearch}}
{{{i18n google_search}}}
{{/if}}
</div>

View File

@ -2288,3 +2288,13 @@ en:
reader:
name: Reader
description: Read every post in a topic with more than 100 posts
google_search: |
<h2>Search with Google</h2>
<p>
<form action='//google.com/search' id='google-search' onsubmit="document.getElementById('google-query').value = 'site:' + window.location.host + ' ' + document.getElementById('user-query').value; return true;">
<input type="text" id='user-query' value="">
<input type='hidden' id='google-query' name="q">
<button class="btn btn-primary">Google</button>
</form>
</p>

View File

@ -2152,11 +2152,3 @@ en:
<p>
<code>rainbows category:parks status:open order:latest</code> will search for topics containing the word "rainbows" in the category "parks" that are not closed or archived, ordered by date of last post.
</p>
<h2>Search with Google</h2>
<p>
<form action='//google.com/search' id='google-search' onsubmit="document.getElementById('google-query').value = 'site:' + window.location.host + ' ' + document.getElementById('user-query').value; return true;">
<input type="text" id='user-query' value="">
<input type='hidden' id='google-query' name="q">
<button class="btn btn-primary">Google</button>
</form>
</p>