EBernhardson (WMF) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61939


Change subject: Tooltips for HTMLCheckMatrix
......................................................................

Tooltips for HTMLCheckMatrix

Generates tooltips on the columns labels of HTMLCheckMatrix.
Bug: 47094

Change-Id: I9670ecdc2cb553df07ee06e3b83b003382471d27
---
M includes/HTMLForm.php
M resources/mediawiki/mediawiki.htmlform.js
A skins/common/images/question-hover.png
A skins/common/images/question.png
M skins/common/shared.css
5 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/39/61939/1

diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php
index c08206d..5cd51f1 100644
--- a/includes/HTMLForm.php
+++ b/includes/HTMLForm.php
@@ -1868,8 +1868,20 @@
                }
                $tableContents .= Html::rawElement( 'tr', array(), 
"\n$headerContents\n" );
 
+               $tooltipClass = 'mw-icon-question';
+               if ( isset( $this->mParams['tooltip-class'] ) ) {
+                       $tooltipClass = $this->mParams['tooltip-class'];
+               }
+
                // Build the options matrix
                foreach ( $rows as $rowLabel => $rowTag ) {
+                       if ( isset( $this->mParams['tooltips'][$rowLabel] ) ) {
+                               $tooltipAttribs = array(
+                                       'class' => "mw-htmlform-tooltip 
$tooltipClass",
+                                       'title' =>  
$this->mParams['tooltips'][$rowLabel],
+                               );
+                               $rowLabel .= ' '.Html::rawElement('span', 
$tooltipAttribs, '');
+                       }
                        $rowContents = Html::rawElement( 'td', array(), 
$rowLabel );
                        foreach ( $columns as $columnTag ) {
                                // Knock out any options that are not wanted
diff --git a/resources/mediawiki/mediawiki.htmlform.js 
b/resources/mediawiki/mediawiki.htmlform.js
index 4336790..198259e 100644
--- a/resources/mediawiki/mediawiki.htmlform.js
+++ b/resources/mediawiki/mediawiki.htmlform.js
@@ -123,4 +123,9 @@
                } );
        }
 
+       if ( $( '.mw-htmlform-matrix .mw-htmlform-tooltip' ).length ) {
+               mw.loader.using( 'jquery.tipsy', function () {
+                       $( '.mw-htmlform-matrix .mw-htmlform-tooltip' ).tipsy();
+               } );
+       }
 }( mediaWiki, jQuery ) );
diff --git a/skins/common/images/question-hover.png 
b/skins/common/images/question-hover.png
new file mode 100644
index 0000000..1050e5e
--- /dev/null
+++ b/skins/common/images/question-hover.png
Binary files differ
diff --git a/skins/common/images/question.png b/skins/common/images/question.png
new file mode 100644
index 0000000..d106282
--- /dev/null
+++ b/skins/common/images/question.png
Binary files differ
diff --git a/skins/common/shared.css b/skins/common/shared.css
index 99e7d6d..52955fb 100644
--- a/skins/common/shared.css
+++ b/skins/common/shared.css
@@ -235,6 +235,18 @@
 .prefsection table.mw-htmlform-matrix {
        width: auto;
 }
+.mw-icon-question {
+       /* @embed */
+       background: url('images/question.png') no-repeat;
+       display: inline-block;
+       height: 11px;
+       width: 11px;
+       margin-left: 4px;
+}
+.mw-icon-question:hover {
+       /* @embed */
+       background: url('images/question-hover.png') no-repeat;
+}
 td.mw-submit {
        white-space: nowrap;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/61939
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9670ecdc2cb553df07ee06e3b83b003382471d27
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EBernhardson (WMF) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to