diff --git a/app/assets/javascripts/discourse/controllers/search-help.js.es6 b/app/assets/javascripts/discourse/controllers/search-help.js.es6
new file mode 100644
index 00000000000..821c431af65
--- /dev/null
+++ b/app/assets/javascripts/discourse/controllers/search-help.js.es6
@@ -0,0 +1,7 @@
+import ModalFunctionality from 'discourse/mixins/modal-functionality';
+
+import DiscourseController from 'discourse/controllers/controller';
+
+export default DiscourseController.extend(ModalFunctionality, {
+ needs: ['modal']
+});
diff --git a/app/assets/javascripts/discourse/lib/search-for-term.js.es6 b/app/assets/javascripts/discourse/lib/search-for-term.js.es6
index 592195f72eb..7cd3fffb90a 100644
--- a/app/assets/javascripts/discourse/lib/search-for-term.js.es6
+++ b/app/assets/javascripts/discourse/lib/search-for-term.js.es6
@@ -59,6 +59,12 @@ export default function searchForTerm(term, opts) {
}
});
+ // a bit awkward, but we need to get the help link in
+ // somehow
+ if(results.resultTypes && results.resultTypes[0]) {
+ results.resultTypes[0].showHelp = true;
+ }
+
var noResults = !!(results.topics.length === 0 &&
results.posts.length === 0 &&
results.users.length === 0 &&
diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6
index c60977db131..29f036f13c9 100644
--- a/app/assets/javascripts/discourse/routes/application.js.es6
+++ b/app/assets/javascripts/discourse/routes/application.js.es6
@@ -90,6 +90,16 @@ var ApplicationRoute = Discourse.Route.extend({
Discourse.Route.showModal(this, 'keyboardShortcutsHelp');
},
+ showSearchHelp: function() {
+ var self = this;
+
+ // TODO: @EvitTrout how do we get a loading indicator here?
+ Discourse.ajax("/static/search_help.html", { dataType: 'html' }).then(function(html){
+ Discourse.Route.showModal(self, 'searchHelp', html);
+ });
+
+ },
+
/**
Close the current modal, and destroy its state.
diff --git a/app/assets/javascripts/discourse/templates/modal/search_help.hbs b/app/assets/javascripts/discourse/templates/modal/search_help.hbs
new file mode 100644
index 00000000000..ace1db3e6db
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/modal/search_help.hbs
@@ -0,0 +1,3 @@
+
+ {{{model}}}
+
diff --git a/app/assets/javascripts/discourse/templates/search.hbs b/app/assets/javascripts/discourse/templates/search.hbs
index ff8a6bdd4e8..dfd8048e60b 100644
--- a/app/assets/javascripts/discourse/templates/search.hbs
+++ b/app/assets/javascripts/discourse/templates/search.hbs
@@ -22,6 +22,9 @@
{{i18n show_more}}
{{else}}
{{/if}}
+ {{#if resultType.showHelp}}
+ {{i18n show_help}}
+ {{/if}}
{{/each}}
{{else}}
diff --git a/app/assets/javascripts/discourse/views/search-help.js.es6 b/app/assets/javascripts/discourse/views/search-help.js.es6
new file mode 100644
index 00000000000..4492fde70a9
--- /dev/null
+++ b/app/assets/javascripts/discourse/views/search-help.js.es6
@@ -0,0 +1,4 @@
+export default Discourse.ModalBodyView.extend({
+ templateName: 'modal/search_help',
+ title: I18n.t('search_help.title')
+});
diff --git a/app/assets/stylesheets/desktop/header.scss b/app/assets/stylesheets/desktop/header.scss
index b0821a9bcaa..8dfa245eef2 100644
--- a/app/assets/stylesheets/desktop/header.scss
+++ b/app/assets/stylesheets/desktop/header.scss
@@ -71,3 +71,14 @@ and (max-width : 570px) {
.d-dropdown .searching {
right: 30px;
}
+
+// leave room for scroll bar
+.d-dropdown input[type='text'] {
+ width: 505px;
+}
+
+.d-dropdown .no-results .show-help {
+ position: absolute;
+ right: 15px;
+}
+
diff --git a/app/assets/stylesheets/mobile/header.scss b/app/assets/stylesheets/mobile/header.scss
index 2f459985066..59736598cb7 100644
--- a/app/assets/stylesheets/mobile/header.scss
+++ b/app/assets/stylesheets/mobile/header.scss
@@ -74,3 +74,8 @@
.search-link .topic-statuses .topic-status i {
font-size: 14px;
}
+
+.d-dropdown .no-results .show-help {
+ display: none;
+}
+
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb
index 3a452362c18..4adda3cdc62 100644
--- a/app/controllers/static_controller.rb
+++ b/app/controllers/static_controller.rb
@@ -35,6 +35,11 @@ class StaticController < ApplicationController
return
end
+ if I18n.exists?("static.#{@page}")
+ render text: PrettyText.cook(I18n.t("static.#{@page}")), layout: !request.xhr?, formats: [:html]
+ return
+ end
+
file = "static/#{@page}.#{I18n.locale}"
file = "static/#{@page}.en" if lookup_context.find_all("#{file}.html").empty?
file = "static/#{@page}" if lookup_context.find_all("#{file}.html").empty?
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 87fb3c8713d..f107118c9f6 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -117,6 +117,7 @@ en:
admin_title: "Admin"
flags_title: "Flags"
show_more: "show more"
+ show_help: "help"
links: "Links"
links_lowercase: "links"
faq: "FAQ"
@@ -2140,6 +2141,9 @@ en:
lightbox:
download: "download"
+ search_help:
+ title: 'Search Help'
+
keyboard_shortcuts_help:
title: 'Keyboard Shortcuts'
jump_to:
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index f719d89f95e..a7903fdd7b5 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2120,3 +2120,14 @@ en:
If we decide to change our privacy policy, we will post those changes on this page.
This document is CC-BY-SA. It was last updated May 31, 2013.
+
+ static:
+ search_help: |
+ You may include special search operators in your terms, available operators are:
+
+ `order:latest` Results will be ordered by last post time (as opposed to relevence)
+ `status:open` Only show open topics
+ `status:closed` Only show closed topics
+ `category:foo` Only show topics in the category `foo`
+
+ Example: `bears category:test status:open order:latest` will search for topics in the category bears that are not closed or archived ordered by last post date.
diff --git a/lib/sass/discourse_sass_importer.rb b/lib/sass/discourse_sass_importer.rb
index f2404cccb75..26721cdbb66 100644
--- a/lib/sass/discourse_sass_importer.rb
+++ b/lib/sass/discourse_sass_importer.rb
@@ -2,7 +2,7 @@
# Sprockets::SassImporter implementation provided in sass-rails since that is used
# during asset precompilation.
class DiscourseSassImporter < Sass::Importers::Filesystem
- GLOB = /\*|\[.+\]/
+ GLOB = /\*|\[.+\]/ unless defined? GLOB
# Depending upon where this is passed we might either be passed a string as the
# first argument or a sprockets context. If the first argument is a sprockets