jenkins-bot has submitted this change and it was merged.

Change subject: (mingle #405) Add dynamic head msg on login/acct create form
......................................................................


(mingle #405) Add dynamic head msg on login/acct create form

* Preserves 'sign up', 'sign in' overlay headers on login/acct create form
* Sets head msg to 'You must be logged in to watch pages.' when login/acct
create form reached from tapping watchlist start
* Sets head msg to 'You must be logged in to see your uploads.' when
login/acct create form reached from Special:DonateImage

Change-Id: I07b1be58ae227d973d4981819da6a8dd38e77142
---
M MobileFrontend.i18n.php
M includes/skins/SkinMobile.php
M includes/skins/UserAccountCreateMobileTemplate.php
M includes/skins/UserLoginAndCreateTemplate.php
M includes/skins/UserLoginMobileTemplate.php
M stylesheets/less/specials/userlogin.less
M stylesheets/specials/userlogin.css
7 files changed, 60 insertions(+), 13 deletions(-)

Approvals:
  Brion VIBBER: Looks good to me, approved
  JGonera: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index d6f88c1..85f3317 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -169,7 +169,7 @@
        'mobile-frontend-nearby-error' => 'An unexpected error occurred whilst 
trying to find pages nearby',
 
        // image donation
-       'mobile-frontend-donate-image-login' => 'Sign in to view your uploads',
+       'mobile-frontend-donate-image-login' => 'You must be logged in to see 
your uploads.',
        'mobile-frontend-photo-upload-generic' => 'Donate an image',
        'mobile-frontend-donate-image-title' => 'Donate an image',
        'mobile-frontend-donate-image-summary' => 'Photos bring pages on 
{{SITENAME}} to life.
@@ -190,6 +190,7 @@
        'mobile-frontend-watchlist-cta' => 'Please login or sign up to watch 
this page.',
        'mobile-frontend-watchlist-cta-button-login' => 'Login',
        'mobile-frontend-watchlist-cta-button-signup' => 'Sign up',
+       'mobile-frontend-watch-login' => 'You must be logged in to watch 
pages.',
 
        'mobile-frontend-watchlist-a-z' => 'All',
        'mobile-frontend-watchlist-feed' => 'Modified',
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 958f619..ff6abbf 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -258,17 +258,8 @@
         * @return string
         */
        protected function getLoginPageHeading() {
-               $req = $this->getRequest();
-               if ( $req->getVal( 'returnto' ) && ( $title = 
Title::newFromText( $req->getVal( 'returnto' ) ) ) ) {
-                       list( $returnto, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
-               } else {
-                       $returnto = '';
-               }
-
-               if ( $req->getVal( 'type' ) == 'signup' ) {
+               if ( $this->getRequest()->getVal( 'type' ) == 'signup' ) {
                        $key = 'mobile-frontend-sign-up-heading';
-               } else if ( $returnto == 'DonateImage' ) {
-                       $key = 'mobile-frontend-donate-image-login';
                } else {
                        $key = 'mobile-frontend-sign-in-heading';
                }
diff --git a/includes/skins/UserAccountCreateMobileTemplate.php 
b/includes/skins/UserAccountCreateMobileTemplate.php
index b8c9edb..244e2ed 100644
--- a/includes/skins/UserAccountCreateMobileTemplate.php
+++ b/includes/skins/UserAccountCreateMobileTemplate.php
@@ -18,12 +18,17 @@
                $msgBox = ''; // placeholder for displaying any login-related 
system messages (eg errors)
                // handle captcha
                $captcha = $this->handleCaptcha( $this->data['header'] );
+               $headMsg = $this->getHeadMsg();
 
                MobileContext::singleton()->getSkin()->addArticleClass( 
'noMargins' );
 
                $accountCreation = Html::openElement( 'div', array( 'id' => 
'mw-mf-accountcreate' ) );
 
                // @TODO refactor this into base class
+               if ( $headMsg ) {
+                       $msgBox .= Html::Element( 'div', array( 'class' => 
'headmsg' ), $headMsg );
+               }
+
                if ( $message ) {
                        $heading = '';
                        $class = 'alert';
@@ -37,7 +42,7 @@
                        $msgBox .= $message;
                        $msgBox .= Html::closeElement( 'div' );
                } else {
-                       $msgBox = Html::rawElement( 'div', array(
+                       $msgBox .= Html::rawElement( 'div', array(
                                'class' => 'watermark' ) );
                }
 
diff --git a/includes/skins/UserLoginAndCreateTemplate.php 
b/includes/skins/UserLoginAndCreateTemplate.php
index 4410b1a..a89da4e 100644
--- a/includes/skins/UserLoginAndCreateTemplate.php
+++ b/includes/skins/UserLoginAndCreateTemplate.php
@@ -69,4 +69,22 @@
                }
                return false;
        }
+
+       protected function getHeadMsg() {
+               $req = $this->getRequestContext()->getRequest();
+               if ( $req->getVal( 'returnto' ) && ( $title = 
Title::newFromText( $req->getVal( 'returnto' ) ) ) ) {
+                       list( $returnto, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
+               } else {
+                       $returnto = '';
+               }
+               $returntoQuery = $req->getVal( 'returntoquery' );
+               if ( $returnto == 'DonateImage' ) {
+                       $key = 'mobile-frontend-donate-image-login';
+               } elseif ( strstr( $returntoQuery, 'article_action=watch' ) ) {
+                       $key = 'mobile-frontend-watch-login';
+               } else {
+                       return '';
+               }
+               return wfMessage( $key )->plain();
+       }
 }
diff --git a/includes/skins/UserLoginMobileTemplate.php 
b/includes/skins/UserLoginMobileTemplate.php
index 5ada1b5..24538ea 100644
--- a/includes/skins/UserLoginMobileTemplate.php
+++ b/includes/skins/UserLoginMobileTemplate.php
@@ -16,6 +16,7 @@
                $message = $this->data['message'];
                $messageType = $this->data['messagetype'];
                $msgBox = ''; // placeholder for displaying any login-related 
system messages (eg errors)
+               $headMsg = $this->getHeadMsg();
 
                MobileContext::singleton()->getSkin()->addArticleClass( 
'noMargins' );
 
@@ -38,6 +39,10 @@
 
                $login = Html::openElement( 'div', array( 'id' => 'mw-mf-login' 
) );
 
+               if ( $headMsg ) {
+                       $msgBox .= Html::Element( 'div', array( 'class' => 
'headmsg' ), $headMsg );
+               }
+
                if ( $message ) {
                        $heading = '';
                        $class = 'alert';
@@ -51,7 +56,7 @@
                        $msgBox .= $message;
                        $msgBox .= Html::closeElement( 'div' );
                } else {
-                       $msgBox = Html::rawElement( 'div', array(
+                       $msgBox .= Html::rawElement( 'div', array(
                                'class' => 'watermark' ) );
                }
 
diff --git a/stylesheets/less/specials/userlogin.less 
b/stylesheets/less/specials/userlogin.less
index bb95ec3..5639fb8 100644
--- a/stylesheets/less/specials/userlogin.less
+++ b/stylesheets/less/specials/userlogin.less
@@ -26,6 +26,20 @@
                background-image: url(images/W.png);
                background-repeat: no-repeat;
        }
+
+       .headmsg {
+               background-color: #eee;
+               border: 1px solid #ccc;
+               color: #252525;
+               font-weight: bold;
+               padding: 0.5em 1em;
+               margin: 1em 0;
+       }
+}
+
+#mw-mf-login .headmsg {
+       margin-left: @searchBoxMarginLeft;
+       margin-right: @searchBoxMarginLeft;
 }
 
 #mw-mf-accountcreate,
diff --git a/stylesheets/specials/userlogin.css 
b/stylesheets/specials/userlogin.css
index 5b8879e..bfb81df 100644
--- a/stylesheets/specials/userlogin.css
+++ b/stylesheets/specials/userlogin.css
@@ -12,6 +12,19 @@
   background-image: url(images/W.png);
   background-repeat: no-repeat;
 }
+#mw-mf-login .headmsg,
+#mw-mf-accountcreate .headmsg {
+  background-color: #eee;
+  border: 1px solid #ccc;
+  color: #252525;
+  font-weight: bold;
+  padding: 0.5em 1em;
+  margin: 1em 0;
+}
+#mw-mf-login .headmsg {
+  margin-left: 40px;
+  margin-right: 40px;
+}
 #mw-mf-accountcreate,
 #userloginForm {
   margin-left: 40px;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I07b1be58ae227d973d4981819da6a8dd38e77142
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: awjrichards <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to