Correct hard coded URL, implement missing features

This commit is contained in:
Sam 2014-10-18 18:09:45 +11:00
parent bf7ee92d56
commit bfbfc16cca
3 changed files with 10 additions and 4 deletions

View File

@ -77,4 +77,3 @@ and (max-width : 570px) {
max-height: 500px;
overflow: auto;
}

View File

@ -2154,7 +2154,7 @@ en:
</p>
<h2>Search with Google</h2>
<p>
<form action='//google.com/search' id='google-search' onsubmit="document.getElementById('google-query').value = 'site:https://meta.discourse.org ' + document.getElementById('user-query').value; return true;">
<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>

View File

@ -154,7 +154,10 @@ class Search
@status = :archived
nil
elsif word == 'status:noreplies'
@no_replies = true
@posts_count = 1
nil
elsif word == 'status:singleuser'
@single_user = true
nil
elsif word == 'order:latest'
@order = :latest
@ -294,10 +297,14 @@ class Search
posts = posts.where('topics.closed')
end
if @no_replies
if @single_user
posts = posts.where("topics.featured_user1_id IS NULL AND topics.last_post_user_id = topics.user_id")
end
if @posts_count
posts = posts.where("topics.posts_count = #{@posts_count}")
end
if @user_id
posts = posts.where("posts.user_id = #{@user_id}")
end