MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/299204
Change subject: Add a link to the annotations page from file page
......................................................................
Add a link to the annotations page from file page
Bug: 140502
Change-Id: Ia042ef423e3352b549954ca057a1a4fa9f0f59fc
---
M FileAnnotations.hooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
4 files changed, 26 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations
refs/changes/04/299204/1
diff --git a/FileAnnotations.hooks.php b/FileAnnotations.hooks.php
index fd6da57..44f401d 100644
--- a/FileAnnotations.hooks.php
+++ b/FileAnnotations.hooks.php
@@ -35,4 +35,26 @@
$out->addModules( array( 'fileannotations' ) );
}
}
+
+ public static function addFileAnnotationsTab( SkinTemplate
&$sktemplate, array &$links ) {
+ $title = $sktemplate->getTitle();
+ if ( $title->inNamespace( NS_FILE ) ) {
+ $fatitle = Title::makeTitle(
+ NS_FILE_ANNOTATIONS,
+ $title->getDBkey()
+ );
+
+ $tabMessage = new Message(
+ 'fileannotations-tab'
+ );
+
+ $links['namespaces']['annotations'] = [
+ 'class' => '',
+ 'text' => $tabMessage->text(),
+ 'href' => $sktemplate->makeArticleUrlDetails(
+ $fatitle->getFullText()
+ )['href'],
+ ];
+ }
+ }
}
diff --git a/extension.json b/extension.json
index 7c0c45e..dbde3c7 100644
--- a/extension.json
+++ b/extension.json
@@ -36,7 +36,8 @@
]
},
"Hooks": {
- "BeforePageDisplay":
"FileAnnotationsHooks::getModulesForFilePage"
+ "BeforePageDisplay":
"FileAnnotationsHooks::getModulesForFilePage",
+ "SkinTemplateNavigation":
"FileAnnotationsHooks::addFileAnnotationsTab"
},
"ResourceModules": {
"fileannotations": {
diff --git a/i18n/en.json b/i18n/en.json
index 65e07e0..9b2a0db 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -4,6 +4,7 @@
},
"fileannotations-desc": "Displays and edits annotations on file pages.",
"file-has-annotations": "There are annotations on this file. Mouse over
the image to view them.",
+ "fileannotations-tab": "Annotations",
"fileannotation-create": "Add file annotation",
"save-fileannotation": "Save",
"cancel-fileannotation": "Cancel",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 14670e4..4dedd17 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -4,6 +4,7 @@
},
"fileannotations-desc": "Description of the FileAnnotations extension.",
"file-has-annotations": "Note on file page indicating the file has
annotations.",
+ "fileannotations-tab": "Text for a tab that links to the file
annotations page from the file page.",
"fileannotation-create": "Text of a button to create a new annotation
on a file.",
"save-fileannotation": "Text of a button to save a new or edited
annotation.",
"cancel-fileannotation": "Text of a button that cancels creating or
editing an annotation.",
--
To view, visit https://gerrit.wikimedia.org/r/299204
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia042ef423e3352b549954ca057a1a4fa9f0f59fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits