Jonas Kress (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250703
Change subject: Create methods to toggle and get toggle status from toggler
......................................................................
Create methods to toggle and get toggle status from toggler
Bug: T117558
Change-Id: I18ad60e2a10e2f9128caf54ba972be5c2fe2643e
---
M lib/jquery.ui/jquery.ui.toggler.js
1 file changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/data-values/value-view
refs/changes/03/250703/1
diff --git a/lib/jquery.ui/jquery.ui.toggler.js
b/lib/jquery.ui/jquery.ui.toggler.js
index bc0bb90..6ee20f4 100644
--- a/lib/jquery.ui/jquery.ui.toggler.js
+++ b/lib/jquery.ui/jquery.ui.toggler.js
@@ -106,6 +106,7 @@
this.element
.on( 'click.' + this.widgetName, function( event ) {
event.preventDefault();
+<<<<<<< HEAD
if ( !self.element.hasClass( 'ui-state-disabled' ) ) {
// Change toggle icon to reflect current state
of toggle subject visibility:
@@ -122,6 +123,9 @@
}
);
}
+=======
+ self.toggle();
+>>>>>>> Enable toggler to be toggled and get toggle status with actual methods.
} )
.on( 'mouseover.' + this.widgetName, function( event ) {
self.element.addClass( 'ui-state-hover' );
@@ -137,6 +141,39 @@
},
/**
+ * Toggle status of toggler to expand/collapse
+ */
+ toggle: function (){
+
+ var self = this;
+ if( !this.element.hasClass( 'ui-state-disabled' ) ) {
+ // Change toggle icon to reflect current state of
toggle subject visibility:
+ var visible = this._reflectVisibilityOnToggleIcon( true
);
+
+ this.options.$subject.stop().animateWithEvent(
+ 'togglerstatetransition',
+ 'slideToggle',
+ this.options,
+ function( animationEvent ) {
+ self._trigger( 'animation',
animationEvent, {
+ visible: visible
+ } );
+ }
+ );
+ }
+ },
+
+
+ /**
+ * Returns status of toggler.
+ * Is true when toggler is collapes
+ * @return {boolean}
+ */
+ isCollapsed: function(){
+ return this.element.hasClass( 'ui-toggler-toggle-collapsed' );
+ },
+
+ /**
* @see jQuery.Widget.destroy
*/
destroy: function() {
--
To view, visit https://gerrit.wikimedia.org/r/250703
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I18ad60e2a10e2f9128caf54ba972be5c2fe2643e
Gerrit-PatchSet: 1
Gerrit-Project: data-values/value-view
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits