]>
BookStack Code Mirror - bookstack/commitdiff
projects
/
bookstack
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
a9634b6
)
Auto-expand collapsible sections if containing error
author
Dan Brown
<redacted>
Mon, 16 Dec 2019 13:27:17 +0000
(13:27 +0000)
committer
Dan Brown
<redacted>
Mon, 16 Dec 2019 13:27:17 +0000
(13:27 +0000)
For #1693
resources/js/components/collapsible.js
patch
|
blob
|
history
diff --git
a/resources/js/components/collapsible.js
b/resources/js/components/collapsible.js
index 464f394c1e7e42a8d1dc568c94568d53f1498819..a630f38f2a577591916f2e86796d8b796f4634a1 100644
(file)
--- a/
resources/js/components/collapsible.js
+++ b/
resources/js/components/collapsible.js
@@
-12,8
+12,8
@@
class Collapsible {
this.content = elem.querySelector('[collapsible-content]');
if (!this.trigger) return;
-
this.trigger.addEventListener('click', this.toggle.bind(this));
+ this.openIfContainsError();
}
open() {
@@
-36,6
+36,13
@@
class Collapsible {
}
}
+ openIfContainsError() {
+ const error = this.content.querySelector('.text-neg');
+ if (error) {
+ this.open();
+ }
+ }
+
}
export default Collapsible;
\ No newline at end of file