jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/344807 )
Change subject: Fix stuff I broke, also changes
......................................................................
Fix stuff I broke, also changes
* Some more consistent naming, classes and ids
* Changed private functions to protected
* Half-arsed formatting for echo
* Made search better
* ...
Change-Id: I889f2dbb15d0a9f601d5210dd13f95c24d9a9adf
---
M GreyStuffTemplate.php
M resources/main.less
M resources/screen-full.less
M resources/screen-mobile.less
4 files changed, 93 insertions(+), 30 deletions(-)
Approvals:
jenkins-bot: Verified
Isarra: Looks good to me, approved
diff --git a/GreyStuffTemplate.php b/GreyStuffTemplate.php
index 8f05b25..bf8fc6b 100644
--- a/GreyStuffTemplate.php
+++ b/GreyStuffTemplate.php
@@ -18,13 +18,7 @@
*/
class GreyStuffTemplate extends BaseTemplate {
- /**
- * Template filter callback for GreyStuff skin.
- * Takes an associative array of data set from a SkinTemplate-based
- * class, and a wrapper for MediaWiki's localization database, and
- * outputs a formatted page.
- */
- function execute() {
+ public function execute() {
// Apparently not set by default?
$this->data['pageLanguage'] =
$this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
@@ -91,7 +85,7 @@
$this->clear() .
- Html::rawElement( 'div', [ 'id' =>
'bodyContent', 'class' => 'mw-body' ],
+ Html::rawElement( 'div', [ 'id' =>
'bodyContent', 'class' => 'mw-body-content' ],
Html::rawElement( 'div', [ 'id' =>
'siteSub' ], $this->getMsg( 'tagline' ) ) .
$this->get( 'bodytext' ) .
$this->clear()
@@ -135,7 +129,7 @@
*
* @return string html
*/
- private function getPortlet( $name, $content, $dropdown = false, $msg =
null ) {
+ protected function getPortlet( $name, $content, $dropdown = false, $msg
= null ) {
if ( $msg === null ) {
$msg = $name;
} elseif ( is_array( $msg ) ) {
@@ -185,7 +179,7 @@
$dropdown ? 'dropdown' : ''
] ],
$contentText .
- $this->renderAfterPortlet( $name )
+ $this->getAfterPortlet( $name )
)
);
@@ -197,7 +191,7 @@
*
* @return string html
*/
- private function getMainNavigation() {
+ protected function getMainNavigation() {
$html = '';
$sidebar = $this->getSidebar();
@@ -256,7 +250,7 @@
*
* @return string html
*/
- private function getBanner() {
+ protected function getBanner() {
$html = Html::rawElement( 'div', [ 'class' => 'p-logo', 'role'
=> 'banner' ],
Html::element( 'a', array_merge( [
'class' => 'mw-wiki-logo',
@@ -290,8 +284,22 @@
*
* @return string html
*/
- private function getPersonalNavigation() {
+ protected function getPersonalNavigation() {
$user = $this->getSkin()->getUser();
+ $personalTools = $this->getPersonalTools();
+
+ $html = '';
+ $extraTools = [];
+
+ // Remove Echo badges
+ if ( isset( $personalTools['notifications-alert'] ) ) {
+ $extraTools['notifications-alert'] =
$personalTools['notifications-alert'];
+ unset( $personalTools['notifications-alert'] );
+ }
+ if ( isset( $personalTools['notifications-notice'] ) ) {
+ $extraTools['notifications-notice'] =
$personalTools['notifications-notice'];
+ unset( $personalTools['notifications-notice'] );
+ }
if ( $user->isLoggedIn() ) {
$headerMsg = [ 'greystuff-loggedinas', $user->getName()
];
@@ -299,7 +307,8 @@
$headerMsg = 'greystuff-notloggedin';
}
- $personalTools = $this->getPersonalTools();
+ $html .= Html::openElement( 'div', [ 'id' =>
'p-personal-container' ] );
+
if ( isset( $personalTools['userpage'] ) ) {
$personalTools['userpage']['links'][0]['text'] =
$this->getMsg( 'greystuff-userpage' );
}
@@ -307,7 +316,25 @@
$personalTools['mytalk']['links'][0]['text'] =
$this->getMsg( 'greystuff-talkpage' );
}
- return $this->getPortlet( 'personal',
$this->getPersonalTools(), true, $headerMsg );
+ // Re-add Echo badges
+ if ( !empty( $extraTools ) ) {
+ $iconList = '';
+ foreach ( $extraTools as $key => $item ) {
+ $iconList .= $this->makeListItem( $key, $item );
+ }
+
+ $html .= Html::rawElement(
+ 'div',
+ [ 'id' => 'p-personal-extra', 'class' =>
'p-body' ],
+ Html::rawElement( 'ul', [], $iconList )
+ );
+ }
+
+ $html .= $this->getPortlet( 'personal', $personalTools, true,
$headerMsg );
+
+ $html .= Html::closeElement( 'div' );
+
+ return $html;
}
/**
@@ -315,14 +342,14 @@
*
* @return string html
*/
- private function getSearch() {
+ protected function getSearch() {
$html = '';
$html .= Html::openElement( 'div', [ 'class' => 'mw-portlet',
'id' => 'p-search', 'role' => 'search' ] );
$html .= Html::rawElement(
'h3',
- [],
+ [ 'lang' => $this->get( 'userlang' ), 'dir' =>
$this->get( 'dir' ) ],
Html::rawElement( 'label', [ 'for' => 'searchInput' ],
$this->getMsg( 'search' ) )
);
@@ -332,9 +359,10 @@
Html::rawElement( 'div', [ 'id' =>
'searchInput-container' ],
$this->makeSearchInput( [ 'id'
=> 'searchInput', 'type' => 'text' ] )
)
- ). $this->makeSearchButton( 'fulltext', [ 'id'
=> 'mw-searchButton', 'class' => 'searchButton mw-fallbackSearchButton' ] ) .
+ ) .
+ $this->makeSearchButton( 'fulltext', [ 'id' =>
'mw-searchButton', 'class' => 'searchButton mw-fallbackSearchButton' ] ) .
$this->makeSearchButton( 'go', [ 'id' =>
'searchGoButton', 'class' => 'searchButton' ] ) .
- Html::rawElement( 'input', [ 'type' =>
'hidden', 'name' => 'title', 'value' => $this->get( 'searchtitle' ) ] )
+ Html::hidden( 'title', $this->get(
'searchtitle' ) )
)
);
@@ -346,7 +374,7 @@
/**
* @return string html
*/
- private function getSiteNotice() {
+ protected function getSiteNotice() {
$html = '';
if ( $this->data['sitenotice'] ) {
@@ -362,12 +390,16 @@
*
* @return string html
*/
- private function getSubtitle() {
+ protected function getSubtitle() {
$html = '';
if ( $this->data['subtitle'] || $this->data['undelete'] ||
$this->data['newtalk'] ) {
$html .= Html::openElement( 'div', [ 'id' =>
'content-top-stuff' ] );
- $html .= Html::rawElement( 'div', [ 'id' =>
'contentSub', 'lang' => $this->get( 'userlang' ), 'dir' => $this->get( 'dir' )
],
+ $html .= Html::rawElement( 'div', [
+ 'id' => 'contentSub',
+ 'lang' => $this->get( 'userlang' ),
+ 'dir' => $this->get( 'dir' )
+ ],
$this->get( 'subtitle' )
);
if ( $this->data['undelete'] ) {
@@ -392,7 +424,7 @@
*
* @return string html
*/
- private function getAfterContent() {
+ protected function getAfterContent() {
$html = '';
if ( $this->data['catlinks'] || $this->data['dataAfterContent']
) {
@@ -414,9 +446,9 @@
*
* @return string html
*/
- private function getFooter() {
- $validFooterIcons = $this->getFooterIcons( 'icononly' );
- $validFooterLinks = $this->getFooterLinks( 'flat' );
+ protected function getFooter( $iconStyle = 'icononly', $linkStyle =
'flat' ) {
+ $validFooterIcons = $this->getFooterIcons( $iconStyle );
+ $validFooterLinks = $this->getFooterLinks( $linkStyle );
$html = '';
@@ -452,7 +484,7 @@
}
/**
- * Override BaseTemplate to not just immediately poop out hand-written
html
+ * BaseTemplate::renderAfterPortlet, but sans immediate pooping
* Allows extensions to hook into known portlets and add stuff to them
(an archaic approach;
* assumes standardised, consistent portlet handling/naming, when the
only standard portlets
* that exist consistently are 'tbx' and 'personal', and tbx is already
a mess )
@@ -460,20 +492,22 @@
* @param string $name
* @return string html
*/
- protected function renderAfterPortlet( $name ) {
+ protected function getAfterPortlet( $name ) {
$content = '';
Hooks::run( 'BaseTemplateAfterPortlet', [ $this, $name,
&$content ] );
if ( $content !== '' ) {
return Html::rawElement( 'div', [ 'class' => [
'after-portlet', 'after-portlet-' . $name ] ], $content );
}
+
+ return $content;
}
/**
* @param string $prefix generally 'mobile' or 'visual' for visualClear
or mobileClear classes
* @return string html
*/
- private function clear( $prefix = 'visual' ) {
+ protected function clear( $prefix = 'visual' ) {
return Html::element( 'div', [ 'class' => $prefix . 'Clear' ] );
}
}
diff --git a/resources/main.less b/resources/main.less
index c043626..08d87a7 100644
--- a/resources/main.less
+++ b/resources/main.less
@@ -159,6 +159,28 @@
border-bottom: solid 1px @soft-border;
}
+/* Echo junk */
+
+#p-personal,
+#p-personal-extra,
+#p-personal-extra ul,
+#p-personal-extra li {
+ display: inline-block;
+ float: right;
+}
+#p-personal-extra {
+ margin: 0 0 0 0;
+
+ ul {
+ list-style: none;
+ margin: 0 -.5em 0 1em;
+ padding: 0;
+ }
+ li {
+ margin: 0 .75em 0 0;
+ }
+}
+
/*
*
* FOOTER STUFF
diff --git a/resources/screen-full.less b/resources/screen-full.less
index 2f8bd24..78d9907 100644
--- a/resources/screen-full.less
+++ b/resources/screen-full.less
@@ -16,7 +16,7 @@
}
/* Login stuff */
-#p-personal {
+#p-personal-container {
float: right;
color: @text-grey;
font-size: 85%;
@@ -43,6 +43,10 @@
right: 0;
}
}
+#p-personal {
+ position: relative;
+}
+
.p-banner.title-banner {
margin-top: 1em;
diff --git a/resources/screen-mobile.less b/resources/screen-mobile.less
index 543dd90..07db1a7 100644
--- a/resources/screen-mobile.less
+++ b/resources/screen-mobile.less
@@ -23,6 +23,9 @@
#content {
overflow: auto;
}
+#p-personal-extra {
+ margin: 1em 1.25em 0 1em;
+}
/* Full-width search */
#header-container #p-search {
--
To view, visit https://gerrit.wikimedia.org/r/344807
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I889f2dbb15d0a9f601d5210dd13f95c24d9a9adf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/skins/GreyStuff
Gerrit-Branch: master
Gerrit-Owner: Isarra <[email protected]>
Gerrit-Reviewer: Isarra <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits