jenkins-bot has submitted this change and it was merged.
Change subject: Show view translations for anon and sandboxed users
......................................................................
Show view translations for anon and sandboxed users
Also correct the message keys used for the links in the project tiles.
Change-Id: If8e44a8a18e752dfae1029a38299cce38a3ecd41
---
M MainPage.i18n.php
M specials/SpecialTwnMainPage.php
2 files changed, 43 insertions(+), 13 deletions(-)
Approvals:
Santhosh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MainPage.i18n.php b/MainPage.i18n.php
index 2e17b11..87e33ca 100644
--- a/MainPage.i18n.php
+++ b/MainPage.i18n.php
@@ -32,9 +32,10 @@
'twnmp-search-choose-project' => 'Choose a project to translate',
'twnmp-translate-link' => 'Translate',
'twnmp-proofread-link' => 'Review',
+ 'twnmp-view-link' => 'View translations',
'twnmp-translate-button' => 'Translate',
- 'twnmp-view-button' => 'View translations',
'twnmp-proofread-button' => 'Review',
+ 'twnmp-view-button' => 'View translations',
'twnmp-your-translations-stats' => 'Your translation statistics',
'twnmp-your-translations-stats-all-languages' => 'For all languages',
@@ -132,6 +133,8 @@
{{Identical|Translate}}',
'twnmp-proofread-link' => 'A link that appears at the bottom of a box
with the project icon near {{msg-mw|twnmp-translate-link}}.
{{Identical|Review}}',
+ 'twnmp-view-link' => 'A link that appears at the bottom of a box with
the project icon.
+{{Identical|View translation}}',
'twnmp-translate-button' => "A label for the button that appears near
the user's translation statistics.
Pressing the button brings the user to the translation editor. Parallel to
{{msg-mw|twnmp-proofread-button}}.
{{Identical|Translate}}",
diff --git a/specials/SpecialTwnMainPage.php b/specials/SpecialTwnMainPage.php
index bbdf744..1c17112 100644
--- a/specials/SpecialTwnMainPage.php
+++ b/specials/SpecialTwnMainPage.php
@@ -252,16 +252,6 @@
$image = Html::element( 'div', array( 'class' => $class ) );
$label = htmlspecialchars( $group->getLabel(
$this->getContext() ) );
- $title = SpecialPage::getTitleFor( 'Translate' );
- $translate = Html::element( 'a', array(
- 'class' => 'translate',
- 'href' => $title->getLocalUrl( array( 'group' => $id ) )
- ), $this->msg( 'twnmp-translate-button' )->text() );
-
- $proofread = Html::element( 'a', array(
- 'class' => 'proofread',
- 'href' => $title->getLocalUrl( array( 'group' => $id,
'action' => 'proofread' ) )
- ), $this->msg( 'twnmp-proofread-button' )->text() );
$msggroupid = htmlspecialchars( $id );
$out = <<<HTML
<div class="three columns twn-mainpage-project-tile">
@@ -277,8 +267,7 @@
</div>
</div>
<div class="row project-actions hide">
- <div class="six columns action">$translate</div>
- <div class="six columns action">$proofread</div>
+ {$this->getProjectActions( $id )}
</div>
</div>
</div>
@@ -287,6 +276,44 @@
return $out;
}
+ /**
+ * @param string $id Message group id
+ * @return string HTML
+ */
+ protected function getProjectActions( $id ) {
+ $user = $this->getUser();
+ $title = SpecialPage::getTitleFor( 'Translate' );
+
+ $view = Html::element( 'a', array(
+ 'class' => 'translate',
+ 'href' => $title->getLocalUrl( array( 'group' => $id ) )
+ ), $this->msg( 'twnmp-view-link' )->text() );
+
+ $translate = Html::element( 'a', array(
+ 'class' => 'translate',
+ 'href' => $title->getLocalUrl( array( 'group' => $id ) )
+ ), $this->msg( 'twnmp-translate-link' )->text() );
+
+ $proofread = Html::element( 'a', array(
+ 'class' => 'proofread',
+ 'href' => $title->getLocalUrl( array( 'group' => $id,
'action' => 'proofread' ) )
+ ), $this->msg( 'twnmp-proofread-link' )->text() );
+
+ if ( $user->isAnon() || TranslateSandbox::isSandboxed( $user )
) {
+ return <<<HTML
+<div class="twelve columns action">$view</div>
+
+HTML;
+
+ } else {
+ return <<<HTML
+<div class="six columns action">$translate</div>
+<div class="six columns action">$proofread</div>
+
+HTML;
+ }
+ }
+
public function banner() {
global $wgMainPageImages;
--
To view, visit https://gerrit.wikimedia.org/r/101186
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If8e44a8a18e752dfae1029a38299cce38a3ecd41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwnMainPage
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Pginer <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits