Henning Snater has uploaded a new change for review.
https://gerrit.wikimedia.org/r/62794
Change subject: Toggler widget: Implemented "disabled" functionality and hover
......................................................................
Toggler widget: Implemented "disabled" functionality and hover
Change-Id: Ibbdf21645d42ce1bc67415d2b48753fc9c1d03af
---
M ValueView/resources/jquery.ui/jquery.ui.toggler.js
M ValueView/resources/jquery.ui/themes/default/jquery.ui.toggler.css
2 files changed, 15 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues
refs/changes/94/62794/1
diff --git a/ValueView/resources/jquery.ui/jquery.ui.toggler.js
b/ValueView/resources/jquery.ui/jquery.ui.toggler.js
index b38631b..fee6594 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.toggler.js
+++ b/ValueView/resources/jquery.ui/jquery.ui.toggler.js
@@ -9,7 +9,7 @@
* element the toggler is initialized on. The toggler considers the subject's
current "display"
* style, so if it is set to "none", it is considered invisible initially.
*
- * @option {string} $subject (REQUIRED) The node whose visibility shall be
toggled.
+ * @option {jQuery} $subject (REQUIRED) The node whose visibility shall be
toggled.
*
* @dependency jquery.ui.Widget
*/
@@ -89,7 +89,7 @@
this.element
.text( '' )
- .addClass( this.widgetBaseClass + ' ' +
this.widgetBaseClass + '-toggle');
+ .addClass( this.widgetBaseClass + ' ' +
this.widgetBaseClass + '-toggle ' + 'ui-state-default' );
if( this.element[0].nodeName === 'A' ) {
this.element.attr( 'href',
'javascript:void(0);' );
@@ -100,9 +100,17 @@
this.element
.on( 'click', function( event ) {
- // Change toggle icon to reflect current state
of toggle subject visibility:
- self._reflectVisibilityOnToggleIcon( true );
- self.options.$subject.slideToggle();
+ if( !self.element.hasClass( 'ui-state-disabled'
) ) {
+ // Change toggle icon to reflect
current state of toggle subject visibility:
+ self._reflectVisibilityOnToggleIcon(
true );
+ self.options.$subject.slideToggle();
+ }
+ } )
+ .on( 'mouseover', function( event ) {
+ self.element.addClass( 'ui-state-hover' );
+ } )
+ .on( 'mouseout', function( event ) {
+ self.element.removeClass( 'ui-state-hover' );
} )
.append( this.$toggleIcon )
.append( $toggleLabel );
diff --git a/ValueView/resources/jquery.ui/themes/default/jquery.ui.toggler.css
b/ValueView/resources/jquery.ui/themes/default/jquery.ui.toggler.css
index 9e5ffde..eb579b4 100644
--- a/ValueView/resources/jquery.ui/themes/default/jquery.ui.toggler.css
+++ b/ValueView/resources/jquery.ui/themes/default/jquery.ui.toggler.css
@@ -11,6 +11,8 @@
display: block;
margin-top: .5em;
white-space: nowrap;
+ border: none;
+ background: none;
}
.ui-toggler .ui-toggler-icon,
.ui-toggler .ui-toggler-label {
--
To view, visit https://gerrit.wikimedia.org/r/62794
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbdf21645d42ce1bc67415d2b48753fc9c1d03af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits