mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
This commit was originally automatically generated using `tools/lint --only=eslint --fix`. It was then modified by tabbott to contain only changes to a set of files that are unlikely to result in significant merge conflicts with any open pull request, excluding about 20 files. His plan is to merge the remaining changes with more precise care, potentially involving merging parts of conflicting pull requests before running the `eslint --fix` operation. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
exports.create_item_from_search_string = function (search_string) {
|
|
const operator = Filter.parse(search_string);
|
|
const description = Filter.describe(operator);
|
|
return {
|
|
display_value: search_string,
|
|
description: description,
|
|
};
|
|
};
|
|
|
|
exports.get_search_string_from_item = function (item) {
|
|
return item.display_value;
|
|
};
|
|
|
|
exports.create_pills = function (pill_container) {
|
|
const pills = input_pill.create({
|
|
container: pill_container,
|
|
create_item_from_text: exports.create_item_from_search_string,
|
|
get_text_from_item: exports.get_search_string_from_item,
|
|
});
|
|
return pills;
|
|
};
|
|
|
|
exports.append_search_string = function (search_string, pill_widget) {
|
|
pill_widget.appendValue(search_string);
|
|
if (pill_widget.clear_text !== undefined) {
|
|
pill_widget.clear_text();
|
|
}
|
|
};
|
|
|
|
exports.get_search_string_for_current_filter = function (pill_widget) {
|
|
const items = pill_widget.items();
|
|
const search_strings = _.pluck(items, 'display_value');
|
|
return search_strings.join(' ');
|
|
};
|
|
|
|
window.search_pill = exports;
|