Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
info_overlay: Render search operators using info_overlay.
aryanshridhar8140a1a6ee91
diff --git a/static/js/info_overlay.js b/static/js/info_overlay.jsindex e3601033d1c..8fea448e089 100644--- a/static/js/info_overlay.js+++ b/static/js/info_overlay.js@@ -2,6 +2,7 @@ import $ from "jquery";import render_keyboard_shortcut from "../templates/keyboard_shortcuts.hbs";import render_markdown_help from "../templates/markdown_help.hbs";+import render_search_operator from "../templates/search_operators.hbs";import * as browser_history from "./browser_history";import * as common from "./common";@@ -165,6 +166,9 @@ export function set_up_toggler() {});$(".informational-overlays .overlay-body").append($markdown_help);+ const $search_operators = $(render_search_operator());+ $(".informational-overlays .overlay-body").append($search_operators);+const $keyboard_shortcuts = $(render_keyboard_shortcut());$(".informational-overlays .overlay-body").append($keyboard_shortcuts);diff --git a/static/templates/search_operators.hbs b/static/templates/search_operators.hbsnew file mode 100644index 00000000000..1c5bba2a32e--- /dev/null+++ b/static/templates/search_operators.hbs@@ -0,0 +1,178 @@+<div class="overlay-modal hide" id="search-operators" tabindex="-1" role="dialog" aria-label="{{t 'Search operators' }}">+ <div class="modal-body" data-simplebar data-simplebar-auto-hide="false">+ <div id="operators-instructions">+ <table class="table table-striped table-condensed table-rounded table-bordered help-table">+ <thead>+ <tr>+ <th>{{t "Operator" }}</th>+ <th>{{t "Effect" }}</th>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td class="operator">stream:<span class="operator_value">stream</span></td>+ <td class="definition">+ {{#tr}}+ Narrow to messages on stream <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">stream</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">topic:<span class="operator_value">topic</span></td>+ <td class="definition">+ {{#tr}}+ Narrow to messages with topic <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">topic</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">pm-with:<span class="operator_value">email</span></td>+ <td class="definition">+ {{#tr}}+ Narrow to private messages with <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">email</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">group-pm-with:<span class="operator_value">email</span></td>+ <td class="definition">+ {{#tr}}+ Narrow to group private messages with <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">email</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">sender:<span class="operator_value">email</span></td>+ <td class="definition">+ {{#tr}}+ Narrow to messages sent by <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">email</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">sender:me</td>+ <td class="definition">+ {{t 'Narrow to messages sent by you.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">near:<span class="operator_value">id</span></td>+ <td class="definition">+ {{#tr}}+ Center the view around message ID <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">id</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">id:<span class="operator_value">id</span></td>+ <td class="definition">+ {{#tr}}+ Narrow to just message ID <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">id</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">streams:public</td>+ <td class="definition">+ {{t 'Search all public streams in the organization.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">is:alerted</td>+ <td class="definition">+ {{t 'Narrow to messages with alert words.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">is:mentioned</td>+ <td class="definition">+ {{t 'Narrow to messages that mention you.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">is:private</td>+ <td class="definition">+ {{t 'Narrow to private messages.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">is:starred</td>+ <td class="definition">+ {{t 'Narrow to starred messages.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">is:unread</td>+ <td class="definition">+ {{t 'Narrow to unread messages.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">has:link</td>+ <td class="definition">+ {{t 'Narrow to messages containing links.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">has:image</td>+ <td class="definition">+ {{t 'Narrow to messages containing images.'}}+ </td>+ </tr>+ <tr>+ <td class="operator">has:attachment</td>+ <td class="definition">+ {{t 'Narrow to messages containing uploads.'}}+ </td>+ </tr>+ <tr>+ <td class="operator"><span class="operator_value">keyword</span></td>+ <td class="definition">+ {{#tr}}+ Search for <z-value></z-value> in the topic or message content.+ {{#*inline "z-value"}}<span class="operator_value">keyword</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ <tr>+ <td class="operator">-topic:<span class="operator_value">topic</span></td>+ <td class="definition">+ {{#tr}}+ Exclude messages with topic <z-value></z-value>.+ {{#*inline "z-value"}}<span class="operator_value">topic</span>{{/inline}}+ {{/tr}}+ </td>+ </tr>+ </tbody>+ </table>+ {{#tr}}+ <p>You can use any combination of these search operators in a single query. For example:</p>+ <z-operator>+ <z-stream-prefix></z-stream-prefix><z-stream>streamname</z-stream>+ <z-sender-prefix></z-sender-prefix><z-email>[email protected]</z-email>+ <z-keyword>keyword</z-keyword>+ </z-operator>+ <p>+ That query would search for messages sent by <z-email>email</z-email> to+ stream <z-stream>streamname</z-stream> containing+ the keyword <z-keyword>keyword</z-keyword>.+ </p>+ {{#*inline "z-operator"}}<p><span class="operator">{{> @partial-block}}</span></p>{{/inline}}+ {{#*inline "z-stream-prefix"}}stream:{{/inline}}+ {{#*inline "z-stream"}}<span class="operator_value">{{> @partial-block}}</span>{{/inline}}+ {{#*inline "z-sender-prefix"}}email:{{/inline}}+ {{#*inline "z-email"}}<span class="operator_value">{{> @partial-block}}</span>{{/inline}}+ {{#*inline "z-keyword"}}<span class="operator_value">keyword</span>{{/inline}}+ {{/tr}}+ <hr />+ <a href="help/search-for-messages#search-operators" target="_blank" rel="noopener noreferrer">{{t "Detailed search operators documentation" }}</a>+ </div>+ </div>+</div>diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.htmlindex 0f5b3a9e7da..dcd3c150e07 100644--- a/templates/zerver/app/index.html+++ b/templates/zerver/app/index.html@@ -140,7 +140,6 @@<button class="button no-style exit">×</button></div><div class="overlay-body">- {% include "zerver/app/search_operators.html" %}</div></div></div>diff --git a/templates/zerver/app/search_operators.html b/templates/zerver/app/search_operators.htmldeleted file mode 100644index e33e641e6d4..00000000000--- a/templates/zerver/app/search_operators.html+++ /dev/null@@ -1,118 +0,0 @@-<div class="overlay-modal hide" id="search-operators" tabindex="-1" role="dialog"- aria-label="{{ _('Search operators') }}">- <div class="modal-body" data-simplebar data-simplebar-auto-hide="false">- <table class="table table-striped table-condensed table-rounded table-bordered help-table">- <thead>- <tr>- <th>{{ _('Operator') }}</th>- <th>{{ _('Effect') }}</th>- </tr>- </thead>- <tr>- <td class="operator">stream:<span class="operator_value">stream</span></td>- <td class="definition">{{ _('Narrow to messages on stream') }} <span class="operator_value">stream</span></td>- </tr>- <tr>- <td class="operator">topic:<span class="operator_value">topic</span></td>- <td class="definition">{{ _('Narrow to messages with topic') }} <span class="operator_value">topic</span></td>- </tr>- <tr>- <td class="operator">pm-with:<span class="operator_value">email</span></td>- <td class="definition">{{ _('Narrow to private messages with') }} <span class="operator_value">email</span></td>- </tr>- <tr>- <td class="operator">group-pm-with:<span class="operator_value">email</span></td>- <td class="definition">{{ _('Narrow to group private messages with') }} <span class="operator_value">email</span></td>- </tr>- <tr>- <td class="operator">sender:<span class="operator_value">email</span></td>- <td class="definition">{{ _('Narrow to messages sent by') }} <span class="operator_value">email</span></td>- </tr>- <tr>- <td class="operator">sender:me</td>- <td class="definition">{{ _('Narrow to messages sent by you.') }}</td>- </tr>- <tr>- <td class="operator">near:<span class="operator_value">id</span></td>- <td class="definition">{{ _('Center the view around message ID') }} <span class="operator_value">id</span></td>- </tr>- <tr>- <td class="operator">id:<span class="operator_value">id</span></td>- <td class="definition">{{ _('Narrow to just message ID') }} <span class="operator_value">id</span></td>- </tr>- <tr>- <td class="operator">streams:public</td>- <td class="definition">{{ _('Search all public streams in the organization.') }}</td>- </tr>- <tr>- <td class="operator">is:alerted</td>- <td class="definition">{{ _('Narrow to messages with alert words.') }}</td>- </tr>- <tr>- <td class="operator">is:mentioned</td>- <td class="definition">{{ _('Narrow to messages that mention you.') }}</td>- </tr>- <tr>- <td class="operator">is:private</td>- <td class="definition">{{ _('Narrow to private messages.') }}</td>- </tr>- <tr>- <td class="operator">is:starred</td>- <td class="definition">{{ _('Narrow to starred messages.') }}</td>- </tr>- <tr>- <td class="operator">is:unread</td>- <td class="definition">{{ _('Narrow to unread messages.') }}</td>- </tr>- <tr>- <td class="operator">has:link</td>- <td class="definition">{{ _('Narrow to messages containing links.') }}</td>- </tr>- <tr>- <td class="operator">has:image</td>- <td class="definition">{{ _('Narrow to messages containing images.') }}</td>- </tr>- <tr>- <td class="operator">has:attachment</td>- <td class="definition">{{ _('Narrow to messages containing uploads.') }}</td>- </tr>- <tr>- <td class="operator"><span class="operator_value">keyword</span></td>- <td class="definition">{% trans %}Search for <span class="operator_value"> keyword </span> in the topic or message content {% endtrans %}</td>- </tr>- <tr>- <td class="operator">-topic:<span class="operator_value">topic</span></td>- <td class="definition">{% trans %}Exclude messages with topic <span class="operator_value">topic</span>{% endtrans %}</td>- </tr>- </table>-- <p>{% trans %}You can use any combination of these search- operators in a single query. For example:{% endtrans %}</p>-- {% set placeholder_stream = _("streamname") %}- {% set placeholder_email = _("[email protected]") %}- {% set placeholder_keyword = _("keyword") %}-- <p>- - <span class="operator">- stream:<span class="operator_value">{{ placeholder_stream }}</span>- sender:<span class="operator_value">{{ placeholder_email }}</span>- <span class="operator_value">{{ placeholder_keyword }}</span>- </span>- </p>-- <p>- {% trans %}- That query would search for messages sent by- <span class="operator_value">{{ placeholder_email }}</span>- to stream- <span class="operator_value">{{ placeholder_stream }}</span>- containing the keyword- <span class="operator_value">{{ placeholder_keyword }}</span>.- {% endtrans %}- </p>- <hr />- <a href="/help/search-for-messages#search-operators" target="_blank" rel="noopener noreferrer">{% trans %}Detailed search operators documentation{% endtrans %}</a>- </div>-</div>diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.pyindex 04bec218696..cd8fd5be849 100644--- a/zerver/tests/test_home.py+++ b/zerver/tests/test_home.py@@ -253,7 +253,6 @@ class HomeTest(ZulipTestCase):# Keep this list sorted!!!html_bits = ["start the conversation",- "Exclude messages with topic","Keyboard shortcuts","Loading...","Filter streams",