make action_id clickable -> to diff page

This commit is contained in:
norohind 2021-11-21 17:17:46 +03:00
parent 0e35b86a5b
commit bce2f9dd4d
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1

View File

@ -197,7 +197,25 @@ activity_table_html_template = """
<script src="/js/json2htmltable.js"></script>
<script type="text/javascript">
window.onload = () => {
document.body.appendChild(buildHtmlTable(JSON.parse({items})));
document.body.appendChild(buildHtmlTable(JSON.parse({items}))); // build table
var table = document.querySelector("body > table")
var header = table.rows[0]
for (var i = 0, cell; cell = header.cells[i]; i++){
if (cell.innerText.includes('ActionId')){
var action_id_id = i;
break;
}
}
if (action_id_id == null) { // don't to anything if no action_id in the table
return;
}
for (var i = 1, row; row = table.rows[i]; i++) { // append to action_id filed onclick action
row.cells[action_id_id].setAttribute("onclick", "location.href='/diff/action_id'".replace('action_id', row.cells[action_id_id].innerText));
}
}
</script>
<link type="text/css" rel="stylesheet" href="/js/table_styles.css">