src/main/webapp/project-details.js

Sun, 08 Jan 2023 17:57:05 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 08 Jan 2023 17:57:05 +0100
changeset 270
8c088c628a20
parent 268
ca5501d851fa
child 307
23fe9f174d2d
permissions
-rw-r--r--

#15 add remove filter button

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')
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
39 const reduced = document.getElementById('project-details-header-reduced')
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
40 const full = document.getElementById('project-details-header')
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
41
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
42 const v = !window.projectDetailsVisible
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
43 window.projectDetailsVisible = v
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
44
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
45 if (v) {
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
46 button.dataset.toggle = 'true'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
47 reduced.style.display = 'none'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
48 full.style.display = 'block'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
49 } else {
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
50 delete button.dataset.toggle
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
51 reduced.style.display = 'block'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
52 full.style.display = 'none'
65c72e65ff67 simplify project-details view
Mike Becker <universe@uap-core.de>
parents: 263
diff changeset
53 }
207
479dd7993ef9 #22 adds possibility to edit own comments
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 }
268
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
55
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
56 function toggleFilterDetails() {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
57 const filters = document.getElementById('more-filters')
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
58 const toggle = document.getElementById('show-more-filters')
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
59 if (toggle.checked) {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
60 filters.style.display = 'flex'
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
61 } else {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
62 filters.style.display = 'none'
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
63 }
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
64 }
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
65
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
66 function toggleDetails() {
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
67 toggleProjectDetails()
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
68 toggleFilterDetails()
ca5501d851fa #15 add issue filters
Mike Becker <universe@uap-core.de>
parents: 266
diff changeset
69 }
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 window.addEventListener('load', function() { toggleDetails() }, false)

mercurial