mirror of
https://github.com/zulip/zulip.git
synced 2025-11-22 23:43:38 +00:00
pills: Use widget instead of my_pill throughout the app.
`compose_pm_pill.my_pill`, `search_pill_widget.my_pill` and any of its occurrences throughout the app have been replaced to use `widget` instead.
This commit is contained in:
committed by
Tim Abbott
parent
1f553a41d0
commit
22b2393cae
@@ -122,7 +122,7 @@ run_test('pills', () => {
|
||||
});
|
||||
|
||||
compose_pm_pill.initialize();
|
||||
assert(compose_pm_pill.my_pill);
|
||||
assert(compose_pm_pill.widget);
|
||||
|
||||
compose_pm_pill.set_from_typeahead(othello);
|
||||
compose_pm_pill.set_from_typeahead(hamlet);
|
||||
@@ -139,7 +139,7 @@ run_test('pills', () => {
|
||||
test_create_item(create_item_handler);
|
||||
|
||||
compose_pm_pill.set_from_emails('othello@example.com');
|
||||
assert(compose_pm_pill.my_pill);
|
||||
assert(compose_pm_pill.widget);
|
||||
|
||||
assert(get_person_from_user_id_called);
|
||||
assert(pills_cleared);
|
||||
|
||||
@@ -26,7 +26,7 @@ set_global('top_left_corner', {});
|
||||
set_global('ui_util', {});
|
||||
set_global('unread_ops', {});
|
||||
set_global('search_pill_widget', {
|
||||
my_pill: {
|
||||
widget: {
|
||||
clear: function () {return true;},
|
||||
appendValue: function () {return true;},
|
||||
},
|
||||
|
||||
@@ -16,17 +16,17 @@ exports.initialize_pill = function () {
|
||||
};
|
||||
|
||||
exports.initialize = function () {
|
||||
exports.my_pill = exports.initialize_pill();
|
||||
exports.widget = exports.initialize_pill();
|
||||
};
|
||||
|
||||
exports.clear = function () {
|
||||
exports.my_pill.clear();
|
||||
exports.widget.clear();
|
||||
};
|
||||
|
||||
exports.set_from_typeahead = function (person) {
|
||||
// We expect person to be an object returned from people.js.
|
||||
user_pill.append_person({
|
||||
pill_widget: exports.my_pill,
|
||||
pill_widget: exports.widget,
|
||||
person: person,
|
||||
});
|
||||
};
|
||||
@@ -34,11 +34,11 @@ exports.set_from_typeahead = function (person) {
|
||||
exports.set_from_emails = function (value) {
|
||||
// value is something like "alice@example.com,bob@example.com"
|
||||
exports.clear();
|
||||
exports.my_pill.appendValue(value);
|
||||
exports.widget.appendValue(value);
|
||||
};
|
||||
|
||||
exports.get_user_ids = function () {
|
||||
return user_pill.get_user_ids(exports.my_pill);
|
||||
return user_pill.get_user_ids(exports.widget);
|
||||
};
|
||||
|
||||
exports.get_emails = function () {
|
||||
@@ -51,7 +51,7 @@ exports.get_emails = function () {
|
||||
};
|
||||
|
||||
exports.get_typeahead_items = function () {
|
||||
return user_pill.typeahead_source(exports.my_pill);
|
||||
return user_pill.typeahead_source(exports.widget);
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
@@ -246,10 +246,10 @@ exports.activate = function (raw_operators, opts) {
|
||||
}
|
||||
|
||||
if (page_params.search_pills_enabled && opts.trigger !== 'search') {
|
||||
search_pill_widget.my_pill.clear(true);
|
||||
search_pill_widget.widget.clear(true);
|
||||
_.each(operators, function (operator) {
|
||||
var search_string = Filter.unparse([operator]);
|
||||
search_pill.append_search_string(search_string, search_pill_widget.my_pill);
|
||||
search_pill.append_search_string(search_string, search_pill_widget.widget);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ exports.deactivate = function () {
|
||||
|
||||
// clear existing search pills
|
||||
if (page_params.search_pills_enabled) {
|
||||
search_pill_widget.my_pill.clear(true);
|
||||
search_pill_widget.widget.clear(true);
|
||||
}
|
||||
|
||||
top_left_corner.handle_narrow_deactivated();
|
||||
|
||||
@@ -21,7 +21,7 @@ function narrow_or_search_for_term(search_string) {
|
||||
// from the typeahead. base_query stores the query
|
||||
// corresponding to the existing pills.
|
||||
var base_query = search_pill.get_search_string_for_current_filter(
|
||||
search_pill_widget.my_pill);
|
||||
search_pill_widget.widget);
|
||||
var base_operators = Filter.parse(base_query);
|
||||
var suggestion_operator = Filter.parse(search_string);
|
||||
operators = base_operators.concat(suggestion_operator);
|
||||
@@ -75,7 +75,7 @@ exports.initialize = function () {
|
||||
var suggestions;
|
||||
if (page_params.search_pills_enabled) {
|
||||
var base_query = search_pill.get_search_string_for_current_filter(
|
||||
search_pill_widget.my_pill);
|
||||
search_pill_widget.widget);
|
||||
suggestions = search_suggestion.get_suggestions(base_query, query);
|
||||
} else {
|
||||
suggestions = search_suggestion.get_suggestions_legacy(query);
|
||||
@@ -107,7 +107,7 @@ exports.initialize = function () {
|
||||
var result = narrow_or_search_for_term(search_string);
|
||||
if (page_params.search_pills_enabled) {
|
||||
search_pill.append_search_string(search_string,
|
||||
search_pill_widget.my_pill);
|
||||
search_pill_widget.widget);
|
||||
$("#search_query").focus();
|
||||
} else {
|
||||
return result;
|
||||
|
||||
@@ -7,10 +7,10 @@ exports.initialize = function () {
|
||||
return;
|
||||
}
|
||||
var container = $('#search_arrows');
|
||||
exports.my_pill = search_pill.create_pills(container);
|
||||
exports.widget = search_pill.create_pills(container);
|
||||
|
||||
exports.my_pill.onPillRemove(function () {
|
||||
var base_query = search_pill.get_search_string_for_current_filter(exports.my_pill);
|
||||
exports.widget.onPillRemove(function () {
|
||||
var base_query = search_pill.get_search_string_for_current_filter(exports.widget);
|
||||
var operators = Filter.parse(base_query);
|
||||
narrow.activate(operators, {trigger: 'search'});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user