Fix hint helper alert
Change-Id: I6e1ac9fa03f62bd25b1139764d727922a5f61c20
diff --git a/Changes b/Changes
index f71a0d0..0b0f846 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.59 2024-12-10
+0.59 2025-01-14
- Improve appearance of title-addon on logo. (uyen-nhu)
- Create and style new item on top navbar for 'News'. (uyen-nhu)
- Change settings link in logout.html.ep to dynamic link. (uyen-nhu)
@@ -20,6 +20,7 @@
small devices. (uyen-nhu)
- Return cursor position for query object (fixes #228; diewald)
- Keep plugin state in statemanager (fixes #201; diewald)
+ - Fix alerts in hint helper (diewald)
0.58 2024-11-15
- Cookie path is settable now (hebasta)
diff --git a/README.md b/README.md
index 51b8ecb..61500c8 100644
--- a/README.md
+++ b/README.md
@@ -335,7 +335,7 @@
### Original Software
-Copyright (C) 2015-2024, [IDS Mannheim](https://www.ids-mannheim.de/)<br>
+Copyright (C) 2015-2025, [IDS Mannheim](https://www.ids-mannheim.de/)<br>
Author: [Nils Diewald](https://www.nils-diewald.de/), Helge Stallkamp<br>
Contributor: Uyen-Nhu Tran, Eliza Margaretha (Documentation), Susanne Feix
and Rebecca Wilm (Translation), Leo Repp
diff --git a/dev/js/spec/hintSpec.js b/dev/js/spec/hintSpec.js
index e98b92a..3b07bd9 100644
--- a/dev/js/spec/hintSpec.js
+++ b/dev/js/spec/hintSpec.js
@@ -271,6 +271,14 @@
expect(hint.alert().active).toBeTruthy();
expect(hint.active()).toBeTruthy();
+ // Show again with the same message
+ expect(hint.alert().active).toBeTruthy();
+ hint.update();
+ expect(hint.alert().active).toBeFalsy();
+ hint.alert().show();
+ expect(hint.alert().active).toBeTruthy();
+ expect(hint.alert().element().textContent).toEqual("That does not work!");
+
// Show menu, hide alert!
hint.show(false);
});
diff --git a/dev/js/src/hint/alert.js b/dev/js/src/hint/alert.js
index 7847af2..f142890 100644
--- a/dev/js/src/hint/alert.js
+++ b/dev/js/src/hint/alert.js
@@ -30,9 +30,12 @@
* Show alert.
*/
show : function (msg) {
- this.active = true;
const e = this._el;
- e.textContent = msg;
+ if (msg !== undefined)
+ e.textContent = msg;
+ if (e.textContent == "")
+ return;
+ this.active = true;
e.style.display = 'block';
},
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 13904ec..7be0a13 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -307,6 +307,7 @@
if (hint) {
shiftContent();
observer.disconnect();
+ KorAP.Hint.alert().show();
}
}
}
diff --git a/dev/scss/header/hint.scss b/dev/scss/header/hint.scss
index 11f0411..6184dc1 100644
--- a/dev/scss/header/hint.scss
+++ b/dev/scss/header/hint.scss
@@ -30,7 +30,7 @@
margin-top: 8px;
box-shadow: $choose-box-shadow;
width: auto;
- min-width: 10em;
+ min-width: 20em;
max-width: 23em !important;
transition: opacity 0.2s ease 0s;