Skip to content

Commit ad18c02

Browse files
Linkify self-profile headers
1 parent ffa5030 commit ad18c02

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

site/static/detailed-query.html

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,22 @@ <h3 id="title"></h3>
120120
} else if (idx == -sort_idx) {
121121
th.setAttribute("data-sorted-by", "asc");
122122
}
123-
th.addEventListener("click", () => {
124-
let sortedBy = th.attributes["data-sorted-by"];
125-
if (sortedBy && sortedBy.value == "desc") {
126-
state.sort_idx = -idx;
127-
} else if (sortedBy && sortedBy.value == "asc") {
128-
state.sort_idx = idx;
123+
let sortedBy = th.attributes["data-sorted-by"];
124+
let clickState = Object.assign({}, state);
125+
if (sortedBy && sortedBy.value == "desc") {
126+
clickState.sort_idx = -idx;
127+
} else if (sortedBy && sortedBy.value == "asc") {
128+
clickState.sort_idx = idx;
129+
} else {
130+
// start with descending
131+
if (th.attributes["data-default-sort-dir"].value == "1") {
132+
clickState.sort_idx = idx;
129133
} else {
130-
// start with descending
131-
if (th.attributes["data-default-sort-dir"].value == "1") {
132-
state.sort_idx = idx;
133-
} else {
134-
state.sort_idx = -idx;
135-
}
134+
clickState.sort_idx = -idx;
136135
}
137-
console.log(state);
138-
window.location.search = query_string_for_state(state);
139-
});
136+
}
137+
let inner = th.innerHTML;
138+
th.innerHTML = `<a href="${query_string_for_state(clickState)}">${inner}</a>`;
140139
}
141140
let table = document.getElementById("primary-table");
142141
let idx = 0;

0 commit comments

Comments
 (0)