Kaldari has uploaded a new change for review.

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


Change subject: Adding editing tutorial
......................................................................

Adding editing tutorial

Don't merge: Still waiting for assets from Vibha

Change-Id: Ic5ff437d5c219a87e0a8820c35ac987806048910
---
M MobileFrontend.i18n.php
M includes/Resources.php
M javascripts/common/Overlay.js
M javascripts/modules/tutorials/PageActionOverlay.js
M javascripts/modules/tutorials/newbie.js
M less/modules/tutorials.less
M stylesheets/common/overlays.css
M stylesheets/modules/tutorials.css
M templates/pageActionTutorial.html
9 files changed, 52 insertions(+), 11 deletions(-)


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

diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index e0f8ae3..c500b11 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -262,6 +262,8 @@
        'mobile-frontend-editor-error-loading' => 'Error, can\'t load section.',
        'mobile-frontend-editor-preview-header' => 'Preview',
        'mobile-frontend-editor-error-preview' => 'Error, something unexpected 
happened upon loading the preview. Please close and try again.',
+       'mobile-frontend-editor-tutorial-summary' => 'Be bold!',
+       'mobile-frontend-editor-tutorial-confirm' => 'Start editing',
 
        // Change tags
        'tag-mobile_edit' => 'Mobile edit',
diff --git a/includes/Resources.php b/includes/Resources.php
index 4d4d074..50128a9 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -294,6 +294,8 @@
 
                        // newbie.js
                        'mobile-frontend-lead-image-tutorial-summary',
+                       'mobile-frontend-editor-tutorial-summary',
+                       'mobile-frontend-editor-tutorial-confirm',
 
                        // for talk.js
                        'mobile-frontend-talk-explained',
@@ -429,6 +431,7 @@
 
                        // LearnMoreOverlay.js, newbie.js
                        'mobile-frontend-photo-ownership-confirm',
+                       'cancel',
 
                        // PhotoApi.js
                        'mobile-frontend-photo-article-edit-comment',
diff --git a/javascripts/common/Overlay.js b/javascripts/common/Overlay.js
index f2ee363..227594f 100644
--- a/javascripts/common/Overlay.js
+++ b/javascripts/common/Overlay.js
@@ -34,7 +34,7 @@
                },
                postRender: function() {
                        var self = this;
-                       this.$( '.cancel,.confirm' ).click( function( ev ) {
+                       this.$( '.cancel' ).click( function( ev ) {
                                ev.preventDefault();
                                if ( self.closeOnBack ) {
                                        window.history.back();
diff --git a/javascripts/modules/tutorials/PageActionOverlay.js 
b/javascripts/modules/tutorials/PageActionOverlay.js
index 86a17f9..57f97f0 100644
--- a/javascripts/modules/tutorials/PageActionOverlay.js
+++ b/javascripts/modules/tutorials/PageActionOverlay.js
@@ -5,8 +5,7 @@
        PageActionOverlay = ContentOverlay.extend( {
                template: M.template.get( 'pageActionTutorial' ),
                defaults: {
-                       summary: mw.msg( 
'mobile-frontend-lead-image-tutorial-summary' ),
-                       cancelMsg: mw.msg( 
'mobile-frontend-photo-ownership-confirm' )
+                       cancelMsg: mw.msg( 'cancel' )
                }
        } );
 
diff --git a/javascripts/modules/tutorials/newbie.js 
b/javascripts/modules/tutorials/newbie.js
index 6b2e304..68f41ad 100644
--- a/javascripts/modules/tutorials/newbie.js
+++ b/javascripts/modules/tutorials/newbie.js
@@ -7,12 +7,35 @@
                        window.location.search.indexOf( 
'article_action=photo-upload' ) > -1;
        }
 
-       $( function() {
-               var photoOverlay;
+       function shouldShowEditTutorial() {
+               // FIXME: Limit audience to only users with low edit count
+               return $( '#ca-edit' ).hasClass( 'enabled' ) &&
+                       window.location.search.indexOf( 'article_action=edit' ) 
> -1;
+       }
 
-               if ( shouldShowUploadTutorial() ) {
+       $( function() {
+               var photoOverlay, editOverlay;
+
+               if ( shouldShowEditTutorial() ) {
+                       editOverlay = new PageActionOverlay( {
+                               target: $( '#ca-edit' ),
+                               summary: mw.msg( 
'mobile-frontend-editor-tutorial-summary' ),
+                               confirmMsg: mw.msg( 
'mobile-frontend-editor-tutorial-confirm' )
+                       } );
+                       editOverlay.show();
+                       $( '#ca-edit' ).on( 'mousedown', $.proxy( editOverlay, 
'hide' ) );
+                       $( '.tutorial .confirm' ).click( function( ev ) {
+                               ev.preventDefault();
+                               // Hide the tutorial
+                               editOverlay.hide();
+                               // Load the editing interface
+                               window.location.href = $( '#ca-edit 
a.edit-page' ).attr( 'href' );
+                       } );
+               } else if ( shouldShowUploadTutorial() ) {
                        photoOverlay = new PageActionOverlay( {
-                               target: $( '#ca-upload' )
+                               target: $( '#ca-upload' ),
+                               summary: mw.msg( 
'mobile-frontend-lead-image-tutorial-summary' ),
+                               confirmMsg: mw.msg( 
'mobile-frontend-photo-ownership-confirm' )
                        } );
                        photoOverlay.show();
                        $( '#ca-upload' ).on( 'mousedown', $.proxy( 
photoOverlay, 'hide' ) );
diff --git a/less/modules/tutorials.less b/less/modules/tutorials.less
index 47a95cf..1c5c185 100644
--- a/less/modules/tutorials.less
+++ b/less/modules/tutorials.less
@@ -29,6 +29,13 @@
                }
 
                .cancel {
+                       color: white;
+                       padding: 12px;
+                       border: none;
+                       font-weight: bold;
+               }
+
+               .confirm {
                        color: #006398;
                        padding: 12px;
                        border: none;
diff --git a/stylesheets/common/overlays.css b/stylesheets/common/overlays.css
index 21b3bb5..dc72e6b 100644
--- a/stylesheets/common/overlays.css
+++ b/stylesheets/common/overlays.css
@@ -5,15 +5,15 @@
  * Please edit the corresponding less file instead.
  * See README.mediawiki for details on installing.
  */
-html.overlayModeEnabled .mw-mf-overlay {
+.overlayModeEnabled .mw-mf-overlay {
   display: block;
 }
-html.overlayModeEnabled #mw-mf-page-center,
-html.overlayModeEnabled #content_wrapper {
+.overlayModeEnabled #mw-mf-page-center,
+.overlayModeEnabled #content_wrapper {
   height: 100%;
   overflow: hidden;
 }
-html.overlayModeEnabled #footer {
+.overlayModeEnabled #footer {
   display: none !important;
 }
 html[dir="rtl"] .mw-mf-overlay .header .cancel {
diff --git a/stylesheets/modules/tutorials.css 
b/stylesheets/modules/tutorials.css
index d6e7e16..1dcbc55 100644
--- a/stylesheets/modules/tutorials.css
+++ b/stylesheets/modules/tutorials.css
@@ -32,6 +32,12 @@
   margin: 0 26px;
 }
 .tutorial .slide .cancel {
+  color: white;
+  padding: 12px;
+  border: none;
+  font-weight: bold;
+}
+.tutorial .slide .confirm {
   color: #006398;
   padding: 12px;
   border: none;
diff --git a/templates/pageActionTutorial.html 
b/templates/pageActionTutorial.html
index 425c001..e8332df 100644
--- a/templates/pageActionTutorial.html
+++ b/templates/pageActionTutorial.html
@@ -3,6 +3,7 @@
                <p>{{summary}}</p>
                <div class="button-bar-centered">
                        <button class="cancel inline">{{cancelMsg}}</button>
+                       <button class="confirm inline">{{confirmMsg}}</button>
                </div>
        </div>
 </div>

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

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

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

Reply via email to