Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/223348
Change subject: Add MobileFrontendLogo to alpha login/create page ...................................................................... Add MobileFrontendLogo to alpha login/create page Like the own userlogin and usercreate pages, add a watermark image to both special pages after the error/warning message. Depends on: Ia81f7c52f08e8dcc73ac751432560c4077d4bd39 Bug: T87261 Change-Id: Ib05f0753b0abbbc9e81ca2dcf1f1c6fe4fa7e908 --- M includes/MobileFrontend.hooks.php M resources/skins.minerva.special.userlogin.styles/userlogin.less 2 files changed, 45 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/48/223348/1 diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index 0fe355c..389d1ee 100644 --- a/includes/MobileFrontend.hooks.php +++ b/includes/MobileFrontend.hooks.php @@ -563,6 +563,47 @@ } /** + * Decide if the login/usercreate page should be overwritten by a mobile only + * special specialpage. If not, do some changes to the template. + * @param QuickTemplate $tpl Login or Usercreate template + * @param String $mode Is this function called in context of UserCreate or UserLogin? + */ + public static function changeUserLoginCreateForm( &$tpl, $mode = 'userlogin' ) { + $context = MobileContext::singleton(); + if ( + !$context->getMFConfig()->get( 'MFNoLoginOverride' ) && + !$context->isAlphaGroupMember() && + $context->shouldDisplayMobileView() + ) { + if ( $mode === 'userlogin' ) { + $tpl = new UserLoginMobileTemplate( $tpl ); + } else { + $tpl = new UserAccountCreateMobileTemplate( $tpl ); + } + } else { + $mfLogo = $context->getMFConfig() + ->get( 'MobileFrontendLogo' ); + + if ( $mfLogo ) { + $tpl->extend( + 'bannerhtml', + Html::openElement( + 'div', + array( 'class' => 'watermark' ) + ) . + Html::element( 'img', + array( + 'src' => $mfLogo, + 'alt' => '', + ) + ) . + Html::closeElement( 'div' ) + ); + } + } + } + + /** * UserLoginForm hook handler * @see https://www.mediawiki.org/wiki/Manual:Hooks/UserLoginForm * @@ -570,14 +611,7 @@ * @return bool */ public static function onUserLoginForm( &$template ) { - $context = MobileContext::singleton(); - if ( - !$context->getMFConfig()->get( 'MFNoLoginOverride' ) && - !$context->isAlphaGroupMember() && - $context->shouldDisplayMobileView() - ) { - $template = new UserLoginMobileTemplate( $template ); - } + self::changeUserLoginCreateForm( $template ); return true; } @@ -590,14 +624,7 @@ * @return bool */ public static function onUserCreateForm( &$template ) { - $context = MobileContext::singleton(); - if ( - !$context->getMFConfig()->get( 'MFNoLoginOverride' ) && - !$context->isAlphaGroupMember() && - $context->shouldDisplayMobileView() - ) { - $template = new UserAccountCreateMobileTemplate( $template ); - } + self::changeUserLoginCreateForm( $template, 'usercreate' ); return true; } diff --git a/resources/skins.minerva.special.userlogin.styles/userlogin.less b/resources/skins.minerva.special.userlogin.styles/userlogin.less index 72e0a7f..f2292fc 100644 --- a/resources/skins.minerva.special.userlogin.styles/userlogin.less +++ b/resources/skins.minerva.special.userlogin.styles/userlogin.less @@ -43,7 +43,8 @@ .stable, .beta { #mw-mf-login, - #mw-mf-accountcreate { + #mw-mf-accountcreate, + #userloginForm { .watermark { text-align: center; // FIXME: Should we set the height here? -- To view, visit https://gerrit.wikimedia.org/r/223348 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib05f0753b0abbbc9e81ca2dcf1f1c6fe4fa7e908 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits