Jdlrobson has uploaded a new change for review.

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

Change subject: WIP: Wikigrok B
......................................................................

WIP: Wikigrok B

TODO:
* Populate the statements
* Add the heart SVG to final pane
* Work out what mediawiki ui element is for the tags

Change-Id: I0e83d4555378d19231b04fd0d1c0f27c053c50f2
---
M includes/Resources.php
M javascripts/modules/wikigrok/WikiGrokDialog.js
M javascripts/modules/wikigrok/WikiGrokDialogB.js
M javascripts/modules/wikigrok/wikigrok.js
M javascripts/modules/wikigrok/wikigrokeval.js
A templates/modules/wikigrok/WikiGrokDialogB.hogan
6 files changed, 54 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/88/162188/1

diff --git a/includes/Resources.php b/includes/Resources.php
index ebfbb40..b5dcadf 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -895,12 +895,14 @@
                ),
                'templates' => array(
                        'modules/wikigrok/WikiGrokDialog.hogan',
+                       'modules/wikigrok/WikiGrokDialogB.hogan',
                        'modules/wikigrok/WikiGrokMoreInfo.hogan',
                ),
                'scripts' => array(
                        'javascripts/modules/wikigrok/WikiDataApi.js',
                        'javascripts/modules/wikigrok/WikiGrokApi.js',
                        'javascripts/modules/wikigrok/WikiGrokDialog.js',
+                       'javascripts/modules/wikigrok/WikiGrokDialogB.js',
                        'javascripts/modules/wikigrok/WikiGrokMoreInfo.js',
                        'javascripts/modules/wikigrok/wikigrokeval.js',
                ),
diff --git a/javascripts/modules/wikigrok/WikiGrokDialog.js 
b/javascripts/modules/wikigrok/WikiGrokDialog.js
index a640341..eb01365 100644
--- a/javascripts/modules/wikigrok/WikiGrokDialog.js
+++ b/javascripts/modules/wikigrok/WikiGrokDialog.js
@@ -16,6 +16,7 @@
         * in Wikidata (https://www.wikidata.org).
         */
        WikiGrokDialog = Panel.extend( {
+               version: 'a',
                className: 'wikigrok',
                defaults: {
                        beginQuestions: false,
@@ -44,7 +45,7 @@
                log: function( action ) {
                        var data = {
                                action: action,
-                               version: 'version a'
+                               version: 'version ' + this.version
                        };
                        schema.log( data );
                },
diff --git a/javascripts/modules/wikigrok/WikiGrokDialogB.js 
b/javascripts/modules/wikigrok/WikiGrokDialogB.js
index d2d39e3..e78662c 100644
--- a/javascripts/modules/wikigrok/WikiGrokDialogB.js
+++ b/javascripts/modules/wikigrok/WikiGrokDialogB.js
@@ -1,4 +1,4 @@
-( function( M ) {
+( function( M, $ ) {
        M.assertMode( [ 'beta', 'alpha' ] );
 
        var WikiGrokDialog = M.require( 'modules/wikigrok/WikiGrokDialog' ),
@@ -14,14 +14,39 @@
         */
        WikiGrokDialogB = WikiGrokDialog.extend( {
                version: 'b',
+               template: M.template.get( 
'modules/wikigrok/WikiGrokDialogB.hogan' ),
                defaults: {
-                       headerMsg: ''
+                       contentMsg: 'Which of these tags best describe Paul 
Rand?'
                },
-               postRender: function( options ) {
-                       console.log( this );
-                       this.askWikidataQuestion( options );
+               postRender: function() {
+                       var self = this;
+                       this.$save = this.$( '.mw-ui-constructive' );
+                       WikiGrokDialog.prototype.postRender.apply( this, 
arguments );
+                       // hide the completion screen
+                       self.$( '.final-pane' ).hide();
+
+                       // render checkboxes
+                       new $.Deferred().resolve().done( function() {
+                               var claims = [ 'a', 'b', 'c', 'd' ];
+                               self.$( '.spinner' ).remove();
+                               $.each( claims, function( i, claim ) {
+                                       console.log( 'add' );
+                                       $( '<button class="mw-ui-button">' 
).text( claim ).
+                                               on( 'click', function() {
+                                                       $( this ).toggleClass( 
'mw-ui-progressive' );
+                                                       setTimeout( function() {
+                                                               
self.$save.prop( 'disabled', self.$( '.initial-pane .mw-ui-progressive' 
).length === 0 );
+                                                       }, 100 );
+                                               } ).appendTo( self.$( 
'.wg-buttons' ) );
+                               } );
+                       } );
+
+                       this.$save.on( 'click', function() {
+                               self.$( '.initial-pane' ).hide();
+                               self.$( '.final-pane' ).show();
+                       } );
                }
        } );
 
        M.define( 'modules/wikigrok/WikiGrokDialogB', WikiGrokDialogB );
-}( mw.mobileFrontend ) );
+}( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/modules/wikigrok/wikigrok.js 
b/javascripts/modules/wikigrok/wikigrok.js
index e14ff32..51bae1b 100644
--- a/javascripts/modules/wikigrok/wikigrok.js
+++ b/javascripts/modules/wikigrok/wikigrok.js
@@ -25,7 +25,7 @@
                // We're not on the Main Page
                !mw.config.get( 'wgIsMainPage' ) &&
                // We're not on a tablet
-               !M.isWideScreen() &&
+               //!M.isWideScreen() &&
                // We're in 'view' mode
                mw.config.get( 'wgAction' ) === 'view' &&
                // Wikibase is active and this page has an item ID
diff --git a/javascripts/modules/wikigrok/wikigrokeval.js 
b/javascripts/modules/wikigrok/wikigrokeval.js
index 9a04dd6..06177b1 100644
--- a/javascripts/modules/wikigrok/wikigrokeval.js
+++ b/javascripts/modules/wikigrok/wikigrokeval.js
@@ -3,6 +3,7 @@
                wikidataID = mw.config.get( 'wgWikibaseItemId' ),
                WikiGrokDialog = M.require( 'modules/wikigrok/WikiGrokDialog' ),
                WikiDataApi = M.require( 'modules/wikigrok/WikiDataApi' ),
+               WikiGrokDialogB = M.require( 'modules/wikigrok/WikiGrokDialogB' 
),
                WikiGrokMoreInfo = M.require( 
'modules/wikigrok/WikiGrokMoreInfo' );
 
        // Get existing Wikidata claims about this page so we can decide if 
it's appropriate
@@ -52,5 +53,5 @@
                // Load the More Info overlay when the link is clicked.
                return new WikiGrokMoreInfo();
        } );
-
+       new WikiGrokDialogB( { itemId: wikidataID } ).insertBefore( 
M.getLeadSection() );
 }( mw.mobileFrontend, jQuery ) );
diff --git a/templates/modules/wikigrok/WikiGrokDialogB.hogan 
b/templates/modules/wikigrok/WikiGrokDialogB.hogan
new file mode 100644
index 0000000..66233ef
--- /dev/null
+++ b/templates/modules/wikigrok/WikiGrokDialogB.hogan
@@ -0,0 +1,16 @@
+<!-- note English language only! -->
+<div class="initial-pane">
+       <p class="wg-content">{{contentMsg}}</p>
+       <div class="spinner loading"></div>
+       <p class="wg-buttons">
+       </p>
+       <div class="footer">
+       <span>All submissions are licensed freely.</span>
+       <button class="mw-ui-button mw-ui-constructive" disabled>next</button>
+       </div>
+</div>
+<div class="final-pane">
+       <p class="wg-content">You just made Wikipedia a little better, 
thanks!</p>
+       <img src="">
+       <a href="#/wikigrok/about" class="mw-ui-button mw-ui-progressive">Tell 
me more</a>
+</div>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e83d4555378d19231b04fd0d1c0f27c053c50f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to