WMDE-Fisch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403146 )

Change subject: [WIP] add labels to selection
......................................................................

[WIP] add labels to selection

Change-Id: I3cdcc8658645d8f037983db214734c48c9de0c63
---
M includes/GoatTwoColConflict/HtmlGoatConflictView.php
M modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js
M modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less
3 files changed, 27 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwoColConflict 
refs/changes/46/403146/1

diff --git a/includes/GoatTwoColConflict/HtmlGoatConflictView.php 
b/includes/GoatTwoColConflict/HtmlGoatConflictView.php
index 8facc3e..72aaff8 100644
--- a/includes/GoatTwoColConflict/HtmlGoatConflictView.php
+++ b/includes/GoatTwoColConflict/HtmlGoatConflictView.php
@@ -75,7 +75,14 @@
        }
 
        private function buildSideSelector( $rowNum ) {
-               return Html::openElement( 'div', [ 'class' => 
'mw-twocolconflict-goat-toggle' ] ) .
+               // TODO: i18n
+               return Html::openElement( 'div', [ 'class' => 
'mw-twocolconflict-goat-selection' ] ) .
+                       Html::element(
+                               'span',
+                               [ 'class' => 'mw-twocolconflict-goat-label' ],
+                               'Please choose a version'
+                       ) .
+                       Html::openElement( 'div', [ 'class' => 
'mw-twocolconflict-goat-toggle' ] ) .
                        new OOUI\RadioInputWidget( [
                                'name' => 'mw-twocolconflict-side-selector[' . 
$rowNum . ']',
                                'value' => 'your',
@@ -86,6 +93,7 @@
                                'value' => 'foreign',
                                'autocomplete' => 'off',
                        ] ) .
+                       Html::closeElement( 'div' ) .
                        Html::closeElement( 'div' );
        }
 
diff --git a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js 
b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js
index 6fa582f..3df9e7b 100644
--- a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js
+++ b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js
@@ -151,21 +151,27 @@
        }
 
        $( function () {
-               var $switches = $( '.mw-twocolconflict-goat-toggle' );
+               var $switches = $( '.mw-twocolconflict-goat-toggle' ),
+                       $radioButtons = $switches.find( 'input' );
                // TODO sync views and textareas when reloading
 
                // TODO put into own function
-               // TODO force neutral position when page loads ( avoid 
preselection on reload )
-               $switches.find( 'input' ).on( 'change', function () {
+               $radioButtons.prop( 'checked', false );
+               $radioButtons.on( 'change', function () {
                        var $switch = $( this ),
                                $row = $switch.closest( 
'.mw-twocolconflict-goat-row' ),
+                               $label = $row.find( 
'.mw-twocolconflict-goat-label' ),
                                $selectedColumn, $unselectedColumn;
 
                        saveAndStopCurrentEditing();
                        if ( $switch.val() === 'your' ) {
+                               // TODO: i18n
+                               $label.text( 'Your version' );
                                $selectedColumn = $row.find( 
'.mw-twocolconflict-goat-delete' );
                                $unselectedColumn = $row.find( 
'.mw-twocolconflict-goat-add' );
                        } else {
+                               // TODO: i18n
+                               $label.text( 'Other version' );
                                $selectedColumn = $row.find( 
'.mw-twocolconflict-goat-add' );
                                $unselectedColumn = $row.find( 
'.mw-twocolconflict-goat-delete' );
                        }
diff --git a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less 
b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less
index 1b42ce2..51d5263 100644
--- a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less
+++ b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less
@@ -32,11 +32,18 @@
 
 .mw-twocolconflict-goat-row {
        display: flex;
-       min-height: 90px;
+       min-height: 110px;
+}
+
+.mw-twocolconflict-goat-selection {
+       margin-top: 14px;
+       width: 66px;
+       text-align: center;
+       line-height: 1.2em;
 }
 
 .mw-twocolconflict-goat-toggle {
-       margin-top: 14px;
+       margin-top: 4px;
        padding: 2px;
        border: 2px solid #b4bac1;
        border-radius: 22px;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3cdcc8658645d8f037983db214734c48c9de0c63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwoColConflict
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <[email protected]>

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

Reply via email to