Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Fisher <jeffrey.fisher@rtspecialty.com>2018-06-12 13:50:41 -0400
committerJeffrey Fisher <jeffrey.fisher@rtspecialty.com>2018-06-19 10:28:48 -0400
commit345e570e67c3d92b5228053fad89128f565daa4c (patch)
treebb9179e6eebc30400d5bc35cfae7c4f0c7ab6156
parent8ac2a367db4d19d3523364a648d081f36096fee1 (diff)
downloadliza-345e570e67c3d92b5228053fad89128f565daa4c.tar.gz
liza-345e570e67c3d92b5228053fad89128f565daa4c.tar.bz2
liza-345e570e67c3d92b5228053fad89128f565daa4c.zip
[DEV-3192] Fix hiding the header when all contents are hidden
-rw-r--r--src/ui/group/GroupUi.js10
-rw-r--r--src/ui/group/StackedGroupUi.js45
2 files changed, 53 insertions, 2 deletions
diff --git a/src/ui/group/GroupUi.js b/src/ui/group/GroupUi.js
index 21824f8..de11c33 100644
--- a/src/ui/group/GroupUi.js
+++ b/src/ui/group/GroupUi.js
@@ -792,7 +792,7 @@ module.exports = Class( 'GroupUi' )
},
- 'public hideField': function( field, index )
+ 'virtual public hideField': function( field, index )
{
if ( this.isFieldVisible( field, index ) === false )
{
@@ -814,7 +814,13 @@ module.exports = Class( 'GroupUi' )
},
- 'public showField': function( field, index )
+ 'protected hasVisibleField'( index )
+ {
+ return this._visCount[ index ] > 0 ? true : false;
+ },
+
+
+ 'virtual public showField': function( field, index )
{
if ( this.isFieldVisible( field, index ) === true )
{
diff --git a/src/ui/group/StackedGroupUi.js b/src/ui/group/StackedGroupUi.js
index 0da7145..f5c3edf 100644
--- a/src/ui/group/StackedGroupUi.js
+++ b/src/ui/group/StackedGroupUi.js
@@ -100,4 +100,49 @@ module.exports = Class( 'StackedGroupUi' )
return this.__super( index );
},
+
+
+ /**
+ * Hide the header if there are no visible fields
+ *
+ * @param field
+ * @param index
+ */
+ 'public override hideField'( field, index )
+ {
+ this.__super( field, index );
+
+ if ( !this.hasVisibleField( index ) )
+ {
+ const header = this._$container.find( 'dl' )[ index ];
+ var attribute = header.getAttribute( 'class' );
+
+ attribute = attribute.includes( ' hidden ' ) ? attribute : attribute + ' hidden ';
+
+ header.setAttribute( 'class', attribute );
+ }
+ },
+
+
+ /**
+ * Show the header if there are visible fields
+ *
+ * @param field
+ * @param index
+ */
+ 'public override showField'( field, index )
+ {
+ this.__super( field, index );
+
+ if ( this.hasVisibleField( index ) )
+ {
+ const header = this._$container.find( 'dl' )[ index ];
+ var attribute = header.getAttribute( 'class' );
+
+ attribute = attribute.includes( ' hidden ' ) ? attribute.replace(' hidden ', '') : attribute;
+
+ header.setAttribute( 'class', attribute );
+ }
+
+ }
} );