Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/170431
Change subject: Link to Special:Nearby out of the article
......................................................................
Link to Special:Nearby out of the article
If the article has coordinates.
Change-Id: Id76fd55a6fcfe14870c44fdc599161f0e6d66c6a
---
M i18n/en.json
M i18n/qqq.json
M includes/skins/MinervaTemplateAlpha.php
M includes/skins/SkinMinervaAlpha.php
4 files changed, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/31/170431/1
diff --git a/i18n/en.json b/i18n/en.json
index ca2491a..987cd4f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -185,6 +185,7 @@
"mobile-frontend-nearby-requirements": "Sorry! Your web browser doesn't
support {{SITENAME}} Nearby.",
"mobile-frontend-nearby-requirements-guidance": "Try a different
browser or enable JavaScript if you've disabled it.",
"mobile-frontend-nearby-title": "Nearby",
+ "mobile-frontend-nearby-sectiontext": "Find articles related to the
location of the article's topic",
"mobile-frontend-news-items": "In the news",
"mobile-frontend-opt-in-explain": "By joining the beta, you will get
access to experimental features, at the risk of encountering bugs and issues.",
"mobile-frontend-overlay-close": "Close",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c5d4529..933653b 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -212,6 +212,7 @@
"mobile-frontend-nearby-requirements": "Message shown to users who have
no JavaScript or a browser that is not capable",
"mobile-frontend-nearby-requirements-guidance": "Message explaining
actions user can take when keying error
{{msg-mw|mobile-frontend-nearby-requirements}}",
"mobile-frontend-nearby-title": "Title of
[[Special:Nearby]].\n{{Identical|Nearby}}",
+ "mobile-frontend-nearby-sectiontext": "Name of the link, which links
the user to [[Special:Nearby]] if the article has coordinates.",
"mobile-frontend-news-items": "The title that will appear before the
element with the mf-itn selector.",
"mobile-frontend-opt-in-explain": "Used as description for the \"Beta\"
in [[Special:MobileOptions]], if the beta is not enabled.",
"mobile-frontend-overlay-close": "Text for the button in an overlay
that, when clicked, dismisses the overlay.\n{{Identical|Close}}",
diff --git a/includes/skins/MinervaTemplateAlpha.php
b/includes/skins/MinervaTemplateAlpha.php
index 53cd771..c04d976 100644
--- a/includes/skins/MinervaTemplateAlpha.php
+++ b/includes/skins/MinervaTemplateAlpha.php
@@ -32,9 +32,36 @@
}
/**
+ * Render a link to Special:Nearby to find articles (geographically)
related to this
+ */
+ public function renderNearbyThisPage() {
+ $title = $this->getSkin()->getTitle();
+
+ if ( class_exists( 'GeoData' ) && GeoData::getPageCoordinates(
$title ) ) {
+ ?>
+ <h2 id="collapsible-heading-nearthispage">
+ <span><?php $this->msg(
'mobile-frontend-main-menu-nearby' ) ?></span>
+ </h2>
+ <div id="collapsible-block-nearthispage">
+ <?php
+ echo '<a href="' .
+ SpecialPage::getTitleFor(
'Nearby' )->getFullUrl() .
+ '#/page/' . $title->getText() .
'">';
+
+ $this->msg(
'mobile-frontend-nearby-sectiontext' );
+
+ echo '</a>';
+ ?>
+ </div>
+ <?php
+ }
+ }
+
+ /**
* Add categories section to Meta section in page
*/
protected function renderMetaSections() {
+ $this->renderNearbyThisPage();
$this->renderCategories();
parent::renderMetaSections();
}
diff --git a/includes/skins/SkinMinervaAlpha.php
b/includes/skins/SkinMinervaAlpha.php
index d1b2456..1779f47 100644
--- a/includes/skins/SkinMinervaAlpha.php
+++ b/includes/skins/SkinMinervaAlpha.php
@@ -26,6 +26,11 @@
public function getDefaultModules() {
$modules = parent::getDefaultModules();
$modules['alpha'] = array( 'mobile.alpha' );
+
+ if ( class_exists( 'GeoData' ) && GeoData::getPageCoordinates(
$this->getTitle() ) ) {
+ $modules['nearthispage'] = array( 'mobile.nearthispage'
);
+ }
+
return $modules;
}
--
To view, visit https://gerrit.wikimedia.org/r/170431
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id76fd55a6fcfe14870c44fdc599161f0e6d66c6a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits