mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
list_render: Rename __set_events().
I rename it to set_up_event_handlers. This commit does not attempt to fix any buggy behavior with how we set up event handlers; it's purely cosmetic.
This commit is contained in:
@@ -28,8 +28,8 @@ function make_containers() {
|
|||||||
// parent container is the nearest ancestor to our main
|
// parent container is the nearest ancestor to our main
|
||||||
// container that has a max-height attribute, and then
|
// container that has a max-height attribute, and then
|
||||||
// the parent container will have a scroll event attached to
|
// the parent container will have a scroll event attached to
|
||||||
// it. This is a good time to read __set_events in the
|
// it. This is a good time to read set_up_event_handlers
|
||||||
// real code.
|
// in the real code.
|
||||||
const parent_container = {};
|
const parent_container = {};
|
||||||
const container = {};
|
const container = {};
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ exports.create = function ($container, list, opts) {
|
|||||||
return DEFAULTS.instances.get(opts.name)
|
return DEFAULTS.instances.get(opts.name)
|
||||||
.set_container($container)
|
.set_container($container)
|
||||||
.set_opts(opts)
|
.set_opts(opts)
|
||||||
.__set_events()
|
.set_up_event_handlers()
|
||||||
.data(list)
|
.data(list)
|
||||||
.init();
|
.init();
|
||||||
}
|
}
|
||||||
@@ -259,10 +259,9 @@ exports.create = function ($container, list, opts) {
|
|||||||
meta.sorting_function = false;
|
meta.sorting_function = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this sets the events given the particular arguments assigned in
|
widget.set_up_event_handlers = function () {
|
||||||
// the container and opts.
|
|
||||||
widget.__set_events = function () {
|
|
||||||
let $nearestScrollingContainer = $container;
|
let $nearestScrollingContainer = $container;
|
||||||
|
|
||||||
while ($nearestScrollingContainer.length) {
|
while ($nearestScrollingContainer.length) {
|
||||||
if ($nearestScrollingContainer.is("body, html")) {
|
if ($nearestScrollingContainer.is("body, html")) {
|
||||||
blueslip.warn("Please wrap progressive scrolling lists in an element with 'max-height' attribute. Error found in:\n" + blueslip.preview_node($container));
|
blueslip.warn("Please wrap progressive scrolling lists in an element with 'max-height' attribute. Error found in:\n" + blueslip.preview_node($container));
|
||||||
@@ -290,8 +289,7 @@ exports.create = function ($container, list, opts) {
|
|||||||
|
|
||||||
if (opts.filter && opts.filter.element) {
|
if (opts.filter && opts.filter.element) {
|
||||||
opts.filter.element.on(opts.filter.event || "input", function () {
|
opts.filter.element.on(opts.filter.event || "input", function () {
|
||||||
const self = this;
|
const value = this.value.toLocaleLowerCase();
|
||||||
const value = self.value.toLocaleLowerCase();
|
|
||||||
|
|
||||||
// run the sort algorithm that was used last, which is done
|
// run the sort algorithm that was used last, which is done
|
||||||
// by passing `undefined` -- which will make it use the params
|
// by passing `undefined` -- which will make it use the params
|
||||||
@@ -315,8 +313,6 @@ exports.create = function ($container, list, opts) {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
widget.__set_events();
|
|
||||||
|
|
||||||
// add built-in generic sort functions.
|
// add built-in generic sort functions.
|
||||||
widget.add_generic_sort_function("alphabetic", function (prop) {
|
widget.add_generic_sort_function("alphabetic", function (prop) {
|
||||||
return function (a, b) {
|
return function (a, b) {
|
||||||
@@ -346,6 +342,8 @@ exports.create = function ($container, list, opts) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
widget.set_up_event_handlers();
|
||||||
|
|
||||||
// Save the instance for potential future retrieval if a name is provided.
|
// Save the instance for potential future retrieval if a name is provided.
|
||||||
if (opts.name) {
|
if (opts.name) {
|
||||||
DEFAULTS.instances.set(opts.name, widget);
|
DEFAULTS.instances.set(opts.name, widget);
|
||||||
|
|||||||
Reference in New Issue
Block a user