Update bugswatcher templates

parent 67fa8cb7
......@@ -743,7 +743,7 @@ sub userDataToVars {
# Find indirect bless permission.
$query = qq{SELECT groups.id
FROM groups, group_group_map AS ggm
FROM `groups`, group_group_map AS ggm
WHERE groups.id = ggm.grantor_id
AND ggm.member_id IN ($grouplist)
AND ggm.grant_type = ?
......
.bugs-watcher {
color: #009966 !important;
}
.worker::before {
content: ","
}
.worker:last-child::before {
content: "" !important
}
document.addEventListener('DOMContentLoaded', function() {
const url = `${window.location.origin}`;
const siteUrl = window.location.origin;
const bugID = location.href.split('=')[1];
const email = document.querySelector('#useremail').className;
const socket = io.connect(url, {'forceNew': true});
let userToken = !localStorage[siteUrl] ? undefined : JSON.parse(localStorage[siteUrl]).userToken;
socket.emit('addUser', { bugID: bugID, email: email });
function showUser (data) {
let workerEmail = data.email;
let workerId = data.id;
let workersList = document.querySelector("#workers").innerHTML !== "" ? Array.from(document.querySelectorAll("#workers > a")).map((elem) => { return elem.dataset["email"] }) : undefined;
if (!workersList || !workersList.includes(workerEmail)) {
fetch(`https://bugs.etersoft.ru/rest/user/${workerEmail}`).then((name) => { return name.json() }).then((name) => {
name = name.users[0].real_name;
let worker = `
<a href="maito:${workerEmail}" id="${workerId}" data-email="${workerEmail}" title="${name}">${name}</a><span class="worker ${workerId}"></span>
`;
document.querySelector("#workers").innerHTML += worker;
});
}
}
socket.on('showAllUsers', function (data) {
if (data[bugID] !== undefined) {
for (worker in data[bugID]) {
let user = { id: worker, email: data[bugID][worker] }
showUser(user);
}
}
})
socket.on('deleteUser', function (data) {
let id = data.id;
let email = data.email;
if (document.getElementById(id)) {
document.getElementById(id).remove();
document.querySelector(`.${id}`).remove();
}
})
});
......@@ -8,6 +8,7 @@
[% PROCESS bug/time.html.tmpl %]
[% PROCESS etersoft/timersplash.html.tmpl %]
[% IF Param('comment_taggers_group') %]
[% IF user.can_tag_comments %]
<div id="bz_ctag_div" class="bz_default_hidden">
......@@ -110,6 +111,9 @@
<td id="bz_show_bug_column_2" class="bz_show_bug_column">
<table>
[%# *** Reported and modified dates *** %]
[% PROCESS etersoft/bugswatcher.html.tmpl %]
[% PROCESS section_dates %]
[% PROCESS section_cclist %]
......
<tr><th class="field_label bugs-watcher">In work:</th><td class="field-value" id="workers"></td></tr>
<div style="display: none;" id="useremail" class="[% user.email FILTER html %]"></div>
<link rel="stylesheet" type="text/css" href="/js/etersoft/bugs-watcher.css" />
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
<script language="javascript" type="text/javascript" src="/js/etersoft/bugsWatcher.js?20_07_2020"></script>
......@@ -9,7 +9,6 @@
[% PROCESS bug/time.html.tmpl %]
[% PROCESS etersoft/timersplash.html.tmpl %]
[% IF Param('comment_taggers_group') %]
[% IF user.can_tag_comments %]
<div id="bz_ctag_div" class="bz_default_hidden">
......@@ -112,6 +111,9 @@
<td id="bz_show_bug_column_2" class="bz_show_bug_column">
<table>
[%# *** Reported and modified dates *** %]
[% PROCESS etersoft/bugswatcher.html.tmpl %]
[% PROCESS section_dates %]
[% PROCESS section_cclist %]
......
<tr><th class="field_label bugs-watcher">В работе у:</th><td class="field-value" id="workers"></td></tr>
<div style="display: none;" id="useremail" class="[% user.email FILTER html %]"></div>
<link rel="stylesheet" type="text/css" href="/js/etersoft/bugs-watcher.css" />
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
<script language="javascript" type="text/javascript" src="/js/etersoft/bugsWatcher.js?20_07_2020"></script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment