jenkins-bot has submitted this change and it was merged.
Change subject: Show talk button only when JS enabled or talk page not empty
......................................................................
Show talk button only when JS enabled or talk page not empty
Add hidden class to talk button in PHP if no content on talk page.
Remove hidden in talk.js (only when JS enabled) to hide button for
users, which disabled JS in thier browsers.
Bug: 67819
Change-Id: I4311e23c6796548c91ace799ce66fb6d38242e17
---
M includes/skins/SkinMinerva.php
M includes/skins/SkinMinervaAlpha.php
M javascripts/modules/talk/talk.js
M less/common/common-js.less
M less/common/common.less
5 files changed, 19 insertions(+), 2 deletions(-)
Approvals:
Kaldari: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index d80812c..50e005b 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -702,7 +702,14 @@
}
if ( isset( $menu['talk'] ) ) {
- $menu['talk']['class'] = 'icon icon-32px
icon-talk';
+ // It's only possible for a user to create a
new talk page if they have
+ // Javascript, so if the talk page hasn't been
created yet, add a 'hidden'
+ // CSS class which will be removed later via
Javascript.
+ if ( $menu['talk']['class'] === 'new' ) {
+ $menu['talk']['class'] = 'hidden icon
icon-32px icon-talk';
+ } else {
+ $menu['talk']['class'] = 'icon
icon-32px icon-talk';
+ }
if ( isset( $tpl->data['_talkdata'] ) ) {
$menu['talk']['text'] =
$tpl->data['_talkdata']['text'];
$menu['talk']['class'] =
$tpl->data['_talkdata']['class'];
diff --git a/includes/skins/SkinMinervaAlpha.php
b/includes/skins/SkinMinervaAlpha.php
index 4e3d052..4612611 100644
--- a/includes/skins/SkinMinervaAlpha.php
+++ b/includes/skins/SkinMinervaAlpha.php
@@ -61,7 +61,9 @@
$class = 'count icon icon-32px icon-talk';
} else {
$talkLabel = wfMessage(
'mobile-frontend-talk-overlay-header' );
- $class = 'icon icon-32px icon-talk';
+ // add hidden css class to hide talk button,
when no content there. Adding content
+ // isn't possible without JS, so remove the
class in talk.js
+ $class = 'hidden icon icon-32px icon-talk';
}
$menu = $tpl->data['page_actions'];
if ( isset( $menu['talk'] ) ) {
diff --git a/javascripts/modules/talk/talk.js b/javascripts/modules/talk/talk.js
index 2a8c9a7..1922d94 100644
--- a/javascripts/modules/talk/talk.js
+++ b/javascripts/modules/talk/talk.js
@@ -23,6 +23,8 @@
var talkPrefix = mw.config.get( 'wgFormattedNamespaces' )[
mw.config.get( 'wgNamespaceNumber' ) + 1 ] + ':';
// FIXME change when micro.tap.js in stable
$( '#ca-talk' ).on( M.tapEvent( 'click' ), onTalkClick ).data(
'title', talkPrefix + title );
+ // enable Talk button (only to hide when JS disabled)
+ $( '#ca-talk' ).removeClass( 'hidden' );
}
init( mw.config.get( 'wgTitle' ) );
diff --git a/less/common/common-js.less b/less/common/common-js.less
index 522b777..0ab2e9b 100644
--- a/less/common/common-js.less
+++ b/less/common/common-js.less
@@ -46,6 +46,7 @@
}
}
+// FIXME: Remove when cache has cleared. This is now in common.less instead.
--2014/07/29
.hidden {
display: none !important;
}
diff --git a/less/common/common.less b/less/common/common.less
index 81b64b7..a8a7679 100644
--- a/less/common/common.less
+++ b/less/common/common.less
@@ -171,3 +171,8 @@
outline: 0;
}
}
+
+// currently used to hide talk button
+.hidden {
+ display: none !important;
+}
--
To view, visit https://gerrit.wikimedia.org/r/145411
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4311e23c6796548c91ace799ce66fb6d38242e17
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits