mirror of https://github.com/zulip/zulip.git
list_widget: Convert .data("sort"), .data("sort-prop") to .attr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
382eec17e2
commit
7a5e68161a
|
@ -586,8 +586,9 @@ export function handle_sort<Key, Item>($th: JQuery, list: ListWidget<Key, Item>)
|
|||
<th data-sort="status"></th>
|
||||
</thead>
|
||||
*/
|
||||
const sort_type: string = $th.data("sort");
|
||||
const prop_name: string = $th.data("sort-prop");
|
||||
const sort_type = $th.attr("data-sort");
|
||||
const prop_name = $th.attr("data-sort-prop");
|
||||
assert(sort_type !== undefined);
|
||||
|
||||
if ($th.hasClass("active")) {
|
||||
if (!$th.hasClass("descend")) {
|
||||
|
|
|
@ -315,15 +315,15 @@ function sort_button(opts) {
|
|||
// don't have any abstraction for the button and its
|
||||
// siblings other than direct jQuery actions.
|
||||
|
||||
function data(sel) {
|
||||
switch (sel) {
|
||||
case "sort":
|
||||
function attr(name) {
|
||||
switch (name) {
|
||||
case "data-sort":
|
||||
return opts.sort_type;
|
||||
case "sort-prop":
|
||||
case "data-sort-prop":
|
||||
return opts.prop_name;
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error("unknown selector: " + sel);
|
||||
throw new Error("unknown attribute: " + name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ function sort_button(opts) {
|
|||
const classList = new Set();
|
||||
|
||||
const $button = {
|
||||
data,
|
||||
attr,
|
||||
closest: lookup(".progressive-table-wrapper", {
|
||||
data: lookup("list-widget", opts.list_name),
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue