src/main/webapp/issue-overview.js

Sat, 09 Nov 2024 10:08:10 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 09 Nov 2024 10:08:10 +0100
changeset 333
124f605ec40a
parent 313
7cfe88b8e219
permissions
-rw-r--r--

remove custom font - fixes #456

207
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
266
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
2 * Copyright 2023 Mike Becker. All rights reserved.
207
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 *
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 * Redistribution and use in source and binary forms, with or without
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 * modification, are permitted provided that the following conditions are met:
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 *
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * 1. Redistributions of source code must retain the above copyright
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 * notice, this list of conditions and the following disclaimer.
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 *
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * documentation and/or other materials provided with the distribution.
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 *
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 */
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 /**
266
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
27 * Hides and shows the project details.
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
28 *
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
29 * Following elements are required on the page (element ID):
207
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 *
266
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
31 * - toggle-details-button
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
32 * - project-details-header-reduced
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
33 * - project-details-header
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
34 *
207
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 */
266
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
36 projectDetailsVisible = true
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
37 function toggleProjectDetails() {
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
38 const button = document.getElementById('toggle-details-button')
311
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
39
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
40 if (!button) {
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
41 // no project details available
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
42 window.projectDetailsVisible = false
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
43 return
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
44 }
bf67e0ff7131 add new global issues page - fixes #404
Mike Becker <universe@uap-core.de>
parents: 307
diff changeset
45
266
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
46 const reduced = document.getElementById('project-details-header-reduced')
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
47 const full = document.getElementById('project-details-header')
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
48
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
49 const v = !window.projectDetailsVisible
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
50 window.projectDetailsVisible = v
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
51
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
52 if (v) {
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
53 button.dataset.toggle = 'true'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
54 reduced.style.display = 'none'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
55 full.style.display = 'block'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
56 } else {
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
57 delete button.dataset.toggle
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
58 reduced.style.display = 'block'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
59 full.style.display = 'none'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
60 }
207
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 }
268
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
62
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
63 function toggleFilterDetails() {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
64 const filters = document.getElementById('more-filters')
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
65 const toggle = document.getElementById('show-more-filters')
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
66 if (toggle.checked) {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
67 filters.style.display = 'flex'
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
68 } else {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
69 filters.style.display = 'none'
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
70 }
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
71 }
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
72
307
23fe9f174d2d add filter for assignee - fixes #403
Mike Becker <universe@uap-core.de>
parents: 268
diff changeset
73 function toggleAssigneeOnlyMine() {
23fe9f174d2d add filter for assignee - fixes #403
Mike Becker <universe@uap-core.de>
parents: 268
diff changeset
74 const filters = document.getElementById('filter-assignee')
23fe9f174d2d add filter for assignee - fixes #403
Mike Becker <universe@uap-core.de>
parents: 268
diff changeset
75 const toggle = document.getElementById('filter-only-mine')
313
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
76 filters.disabled = !!toggle.checked;
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
77 }
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
78
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
79 function removeAllFilters() {
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
80 document.querySelectorAll('#filter-form *[name=filter]')
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
81 .forEach((elem) => elem.value = '');
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
82 document.getElementById('filter-remove').value = 'clear'
7cfe88b8e219 fix removing filter not working
Mike Becker <universe@uap-core.de>
parents: 311
diff changeset
83 document.getElementById('filter-form').submit()
307
23fe9f174d2d add filter for assignee - fixes #403
Mike Becker <universe@uap-core.de>
parents: 268
diff changeset
84 }
23fe9f174d2d add filter for assignee - fixes #403
Mike Becker <universe@uap-core.de>
parents: 268
diff changeset
85
268
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
86 function toggleDetails() {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
87 toggleProjectDetails()
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
88 toggleFilterDetails()
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
89 }
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
90
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
91 window.addEventListener('load', function() { toggleDetails() }, false)

mercurial