mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
toggler: Stop supporting payload target.
We no longer need the payload target for our callbacks.
This commit is contained in:
@@ -41,7 +41,7 @@ exports.toggle = function (opts) {
|
|||||||
idx: -1,
|
idx: -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
function select_tab(idx, payload) {
|
function select_tab(idx) {
|
||||||
meta.$ind_tab.removeClass("selected");
|
meta.$ind_tab.removeClass("selected");
|
||||||
|
|
||||||
var elem = meta.$ind_tab.eq(idx);
|
var elem = meta.$ind_tab.eq(idx);
|
||||||
@@ -51,8 +51,7 @@ exports.toggle = function (opts) {
|
|||||||
if (opts.callback) {
|
if (opts.callback) {
|
||||||
opts.callback(
|
opts.callback(
|
||||||
opts.values[idx].label,
|
opts.values[idx].label,
|
||||||
opts.values[idx].key,
|
opts.values[idx].key
|
||||||
payload || {}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +109,7 @@ exports.toggle = function (opts) {
|
|||||||
},
|
},
|
||||||
// go through the process of finding the correct tab for a given name,
|
// go through the process of finding the correct tab for a given name,
|
||||||
// and when found, select that one and provide the proper callback.
|
// and when found, select that one and provide the proper callback.
|
||||||
// supply a payload of data; since this is a custom event, we'll pass
|
goto: function (name) {
|
||||||
// the data through to the callback.
|
|
||||||
goto: function (name, payload) {
|
|
||||||
// there are cases in which you would want to set this tab, but
|
|
||||||
// not to run the content inside the callback because it doesn't
|
|
||||||
// need to be initialized.
|
|
||||||
var value = _.find(opts.values, function (o) {
|
var value = _.find(opts.values, function (o) {
|
||||||
return o.label === name || o.key === name;
|
return o.label === name || o.key === name;
|
||||||
});
|
});
|
||||||
@@ -123,7 +117,7 @@ exports.toggle = function (opts) {
|
|||||||
var idx = opts.values.indexOf(value);
|
var idx = opts.values.indexOf(value);
|
||||||
|
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
select_tab(idx, payload);
|
select_tab(idx);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user