Skip to content

Commit 26f2fb8

Browse files
committed
Add zen mode for feedback tags
Add "zen mode", where the inactive feedback tags are white (lightly outlined) in the feedback message panels. The feedback tags turn visible when the cursor is in the the tag panel (or when the focus has been moved there with keyboard navigation). The user can select to use this mode by checking a checkbox. The mode is in use (and the opt-in checkbox is visible) only on devices where hovering is possible. The checkbox state persists even when the page is reloaded or the user goes to a new page (saved via localStrorage). Fixes #69
1 parent 2708a4c commit 26f2fb8

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

feedback/locale/fi/LC_MESSAGES/django.po

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@ msgstr "Luettelo palautetägeistä"
416416
msgid "Unable to fetch student's response."
417417
msgstr "Opiskelijan vastauksen hakeminen ei onnistunut."
418418

419+
#: feedback/templates/manage/_conversations_as_list.html
420+
msgid ""
421+
"Turns inactive feedback tags invisible. The feedback tag buttons reappear "
422+
"when hovering over the tag panel."
423+
msgstr ""
424+
"Muuttaa epäaktiiviset palautetägit näkymättömiksi. Palautetägipainikkeet "
425+
"näkyvät, kun hiiri on tägikentän päällä."
426+
427+
#: feedback/templates/manage/_conversations_as_list.html
428+
msgid "Zen mode"
429+
msgstr "Zen-tila"
430+
419431
#: feedback/templates/manage/_conversations_as_list.html
420432
msgid "No feedback shown as there are errors in the filter form"
421433
msgstr "Palautteita ei näytetä, sillä lomakkeessa on virhe"

feedback/static/feedback.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ body {
77
margin-right: 0.4em;
88
}
99

10+
#pagination-and-zen {
11+
display: flex;
12+
justify-content: space-between;
13+
align-items: flex-end;
14+
}
15+
#zen-mode {
16+
display: none;
17+
flex-shrink: 0;
18+
margin-bottom: 10px;
19+
}
1020

1121
/* Filter panel */
1222

@@ -344,6 +354,17 @@ input[type="checkbox"].combosearch + label {
344354
}
345355
}
346356

357+
@media (hover: hover) {
358+
#zen-mode {
359+
display: block;
360+
}
361+
body:has( #zen-mode-cb:checked) .conversation-tag-panel:not(:hover):not(:has( *:focus-visible)) > .colortag:not(.colortag-active) {
362+
background-color: white;
363+
color: white;
364+
border: var(--colortag-inactive-color) 1px solid;
365+
}
366+
}
367+
347368
/* Feedback exercise/chapter heading */
348369
.conversation-panel > .panel-heading {
349370
padding: 0;

feedback/static/feedback.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,15 @@ function toggleShowAll(event) {
545545

546546

547547
window.addEventListener("load", (event) => {
548+
549+
/* Set up zen mode checkbox (persist state on reload) */
550+
if (localStorage.getItem('zenMode') == "true") {
551+
document.getElementById("zen-mode-cb").checked = true;
552+
}
553+
document.getElementById("zen-mode-cb").addEventListener('change', (e) => {
554+
localStorage.setItem('zenMode', e.target.checked);
555+
});
556+
548557
/* Set up showall buttons */
549558
const showallDivs = document.getElementsByClassName("toggle-showall");
550559
for (let i = 0; i < showallDivs.length; i++) {

feedback/templates/manage/_conversations_as_list.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@
88
{% endcomment %}
99

1010
{% include "_errors_box.html" %}
11-
{% include "_pagination.html" %}
11+
<div id="pagination-and-zen">
12+
{% include "_pagination.html" %}
13+
14+
<div id="zen-mode"
15+
data-toggle="tooltip"
16+
title="{% translate 'Turns inactive feedback tags invisible. The feedback tag buttons reappear when hovering over the tag panel.' %}"
17+
>
18+
<input type="checkbox" id="zen-mode-cb" name="zen-mode-cb">
19+
<label for="zen-mode-cb">
20+
{% translate 'Zen mode' %}
21+
</label>
22+
</div>
23+
</div>
1224

1325
{% for conv in conversations %}
1426
<div class="panel panel-default feedback-response-panel">

0 commit comments

Comments
 (0)