Santhosh has uploaded a new change for review.

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

Change subject: Refactor the render method of source content column
......................................................................

Refactor the render method of source content column

Simplify the jquery appends

Change-Id: I7b3a48c52052fa93919449047c874537f4375a55
---
M modules/source/ext.cx.source.js
1 file changed, 25 insertions(+), 27 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index db4b0b0..f2e4602 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -32,7 +32,12 @@
                this.listen();
        };
 
+       /**
+        * Render the source content column
+        */
        ContentTranslationSource.prototype.render = function () {
+               var $heading, $languageLabel, $articleLink, $subHeading, 
$loader;
+
                mw.cx.sourceLanguage = mw.config.get( 'wgContentLanguage' );
 
                this.$container.prop( {
@@ -40,35 +45,28 @@
                        dir: $.uls.data.getDir( mw.cx.sourceLanguage )
                } );
 
-               this.$container.append(
-                       $( '<h2>' )
-                               .addClass( 'cx-column__title' )
-                               .text( mw.cx.sourceTitle )
+               $heading = $( '<h2>' )
+                       .addClass( 'cx-column__title' )
+                       .text( mw.cx.sourceTitle );
+               $languageLabel = $( '<span>' )
+                       .addClass( 'cx-column__language-label' )
+                       .text( $.uls.data.getAutonym( mw.cx.sourceLanguage ) );
+               $articleLink = $( '<span>' )
+                       .addClass( 'cx-column__sub-heading__view-page' )
+                       .html(
+                               mw.message(
+                                       'cx-source-view-page',
+                                       mw.util.getUrl( mw.cx.sourceTitle )
+                               ).parse()
                );
+               $subHeading = $( '<div>' )
+                       .addClass( 'cx-column__sub-heading' )
+                       .append( $languageLabel, $articleLink );
+               $loader = $( '<div>' )
+                       .addClass( 'cx-column__content' )
+                       .text( mw.msg( 'cx-source-loading', mw.cx.sourceTitle ) 
);
+               this.$container.append( $heading, $subHeading, $loader );
 
-               this.$container.append(
-                       $( '<div>' )
-                               .addClass( 'cx-column__sub-heading' )
-                               .append(
-                                       $( '<span>' )
-                                               .addClass( 
'cx-column__language-label' )
-                                               .text( $.uls.data.getAutonym( 
mw.cx.sourceLanguage ) ),
-                                       $( '<span>' )
-                                               .addClass( 
'cx-column__sub-heading__view-page' )
-                                               .html(
-                                                       mw.message(
-                                                               
'cx-source-view-page',
-                                                               mw.util.getUrl( 
mw.cx.sourceTitle )
-                                                       ).parse()
-                                               )
-                               )
-               );
-
-               this.$container.append(
-                       $( '<div>' )
-                               .addClass( 'cx-column__content' )
-                               .text( mw.msg( 'cx-source-loading', 
mw.cx.sourceTitle ) )
-               );
                this.$title = this.$container.find( '.cx-column__title' );
                this.$content = this.$container.find( '.cx-column__content' );
        };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b3a48c52052fa93919449047c874537f4375a55
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to