Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108020


Change subject: Add the "view page" link
......................................................................

Add the "view page" link

Change-Id: I7e14c14a685909174d863bcb6db3a234f51a7cbd
---
M Resources.php
M i18n/en.json
M i18n/qqq.json
M modules/source/ext.cx.source.js
M tests/browser/features/step_definitions/special_content_translation_steps.rb
M tests/browser/features/support/pages/content_translation_page.rb
6 files changed, 17 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/20/108020/1

diff --git a/Resources.php b/Resources.php
index 50c1748..c10a664 100644
--- a/Resources.php
+++ b/Resources.php
@@ -53,6 +53,7 @@
                'mediawiki.Uri',
        ),
        'messages' => array(
+               'cx-source-view-page',
                'cx-source-loading'
        ),
 ) + $resourcePaths;
diff --git a/i18n/en.json b/i18n/en.json
index 7d62a50..4a93941 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -9,6 +9,7 @@
     "cx-desc": "A tool that allows editors to translate pages from one 
language to another with the help of machine translation and other translation 
aids",
     "cx-header-progressbar-text": "$1% translated",
     "cx-header-translation-center": "Translation center",
+    "cx-source-view-page": "[$1 view page]",
     "cx-publish-page": "Page published at [$1 $2]",
     "cx-publish-page-error": "Error while saving page.",
     "cx-publish-button": "Publish translation",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 856c975..d197c86 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,6 +10,7 @@
     "cx-desc": 
"{{desc|name=ContentTranslation|url=http://www.mediawiki.org/wiki/Extension:ContentTranslation}}";,
     "cx-header-progressbar-text": "Text to be shown with the progress bar in 
[[Special:ContentTranslation]]. $1 is translation progress in percentage.",
     "cx-header-translation-center": "Text for translation center title.",
+    "cx-source-view-page": "A link that points to the source page under the 
heading of the source article. $1 is the source article title.",
     "cx-publish-page": "Link of the page to be publish.",
     "cx-publish-page-error": "Error message to display when page saving 
fails.",
     "cx-publish-button": "Publish button text in 
[[Special:ContentTranslation]].",
@@ -20,4 +21,4 @@
     "cx-tools-instructions-text3": "Help text for the translation aids pane.",
     "cx-tools-instructions-text4": "Help text for the translation aids pane.",
     "cx-tools-instructions-text5": "Help text for the translation aids pane."
-}
\ No newline at end of file
+}
diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index a5e3649..8c5d266 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -50,7 +50,13 @@
                                .append(
                                        $( '<span>' )
                                                .addClass( 
'cx-column__language-label' )
-                                               .text( $.uls.data.getAutonym( 
contentLanguage ) )
+                                               .text( $.uls.data.getAutonym( 
contentLanguage ) ),
+                                       $( '<span>' )
+                                               .addClass( 
'cx-column__sub-heading__view-page' )
+                                               .html( '&nbsp;' + mw.message(
+                                                       'cx-source-view-page',
+                                                       mw.util.getUrl( 
this.page )
+                                               ).parse() )
                                )
                );
 
diff --git 
a/tests/browser/features/step_definitions/special_content_translation_steps.rb 
b/tests/browser/features/step_definitions/special_content_translation_steps.rb
index 9ee2c41..4913f81 100644
--- 
a/tests/browser/features/step_definitions/special_content_translation_steps.rb
+++ 
b/tests/browser/features/step_definitions/special_content_translation_steps.rb
@@ -28,7 +28,8 @@
 end
 
 Then(/^I see a "(.*?)" link that points to the page "(.*?)" on the same 
wiki$/) do |link_name, page_title|
-       pending # express the regexp above with the code you wish you had
+       page_title_in_url = page_title.gsub(" ", "_")
+       on(ContentTranslationPage).view_page.attribute_value("href").should 
match(/#{page_title_in_url}$/)
 end
 
 Then(/^I see a "Publish Translation" button$/) do
@@ -115,9 +116,4 @@
        # The .style method returns the computed value in px,
        # but we need the specified CSS value, so we chech it manually
        
on(ContentTranslationPage).progress_bar_element.attribute("style").should 
match(/width: #{width};/)
-end
-
-Then(/^the "view page" link points to the page "(.+?)" on the same wiki$/) do 
|source_page|
-       source_page_in_url = source_page.gsub(" ", "_")
-       on(ContentTranslationPage).view_page_element.attribute("href").should 
match(/#{source_page_in_url}$/)
 end
diff --git a/tests/browser/features/support/pages/content_translation_page.rb 
b/tests/browser/features/support/pages/content_translation_page.rb
index eb2030a..0116555 100644
--- a/tests/browser/features/support/pages/content_translation_page.rb
+++ b/tests/browser/features/support/pages/content_translation_page.rb
@@ -4,7 +4,6 @@
        page_url URL.url("Special:ContentTranslation?<%=params[:extra]%>")
 
        a(:user_name, class: "cx-header__user-details__user-name")
-       a(:view_page, class: "view-page")
 
        button(:publish_translation, class: "cx-header__publish")
 
@@ -45,4 +44,8 @@
        def translation_editor
                content("translation")
        end
+
+       def view_page
+               column("source").span(class: 
"cx-column__sub-heading__view-page").a
+       end
 end

-- 
To view, visit https://gerrit.wikimedia.org/r/108020
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e14c14a685909174d863bcb6db3a234f51a7cbd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to