Actions
Improvements #10586
openRevise WPanel
Start date:
07/01/2022
Due date:
% Done:
0%
Estimated time:
Description
WPanel
needs to be revised. It should conceptually be a rather simple widget, but seems a lot messier than it needs to be.
Exhibit 1:
setJavaScriptMember
(WT_RESIZE_JS,
"function(self, w, h, s) {"
"""var hdefined = h >= 0;"
"""if (hdefined) {"
"" "var mh = " WT_CLASS ".px(self, 'maxHeight');"
"" "if (mh > 0) h = Math.min(h, mh);"
"""}"
"""if (" WT_CLASS ".boxSizing(self)) {"
"" "h -= " WT_CLASS ".px(self, 'borderTopWidth') + "
"" WT_CLASS ".px(self, 'borderBottomWidth');"
"""}"
"""var c = self.lastChild;"
"""var t = c.previousSibling;"
"""if (t)"
"" "h -= t.offsetHeight;"
"""h -= 8;" // padding
"""if (hdefined && h > 0) {"
"" "c.lh = true;"
"" "c.style.height = h + 'px';"
// the panel is indirectly hidden: will this back-fire ?
"" "$(c).children().each(function() { "
"" "var self = $(this), "
"" "padding = self.outerHeight() - self.height();"
"" "self.height(h - padding);"
"" "this.lh = true;"
"" "});"
"""} else {"
"" "c.style.height = '';"
"" "c.lh = false;"
"" "$(c).children().each(function() { "
"" "this.style.height = '';"
"" "this.lh = false;"
"" "});"
"""}"
"};");
The inline JavaScript at the very least needs to move to a separate JavaScript file, but modern CSS can likely make it obsolete.
For Bootstrap 5 we made collapsible panels use accordion
instead of card
, but we should probably reenable collapse/expand in C++ code, and make it use card
as well for consistency.
Files
Updated by Roel Standaert over 2 years ago
- Related to Improvements #10395: WPanel::setTitleBar(false) should probably call WPanel::setCollapsible(false) added
Updated by Roel Standaert over 2 years ago
- Related to Feature #10364: WBootstrap5Theme: re-add support for collapsible WPanel? added
Updated by Roel Standaert over 2 years ago
Updated by Roel Standaert over 2 years ago
- Related to Bug #9590: Panel header looses "panel-heading" class if titleBarWidget is created manually added
Actions