Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/126234
Change subject: Mask the templates and make it not editable ...................................................................... Mask the templates and make it not editable Change-Id: I2a43e51893e94a2340fc4536e422c330fee90a62 --- M modules/translation/ext.cx.translation.js M modules/translation/styles/ext.cx.translation.less 2 files changed, 15 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/34/126234/1 diff --git a/modules/translation/ext.cx.translation.js b/modules/translation/ext.cx.translation.js index 2436b95..0135952 100644 --- a/modules/translation/ext.cx.translation.js +++ b/modules/translation/ext.cx.translation.js @@ -201,7 +201,7 @@ */ ContentTranslationEditor.prototype.addPlaceholders = function () { var cxSectionSelector = this.getSectionSelector(), - $content, + $content, template, $sections, i, $section, sourceSectionId, $sourceSection; // Clone the source article and work on this detached object @@ -209,6 +209,7 @@ $content = $( '.cx-column--source .cx-column__content' ).clone(); $sections = $content.find( cxSectionSelector ); for ( i = 0; i < $sections.length; i++ ) { + template = false; $section = $( $sections[ i ] ); sourceSectionId = $section.attr( 'id' ); $sourceSection = $( jquerySelectorForId( sourceSectionId ) ); @@ -220,6 +221,13 @@ continue; } + // Mask the templates + if ( $sourceSection.attr( 'typeof' ) === 'mw:Transclusion' ) { + $section.addClass( 'cx-mw-template' ); + $sourceSection.addClass( 'cx-mw-template' ); + template = true; + } + $section.empty(); $section.css( { 'min-height': $sourceSection.height(), @@ -228,8 +236,8 @@ $section.attr( { 'id': 't' + sourceSectionId, 'data-source': sourceSectionId, - // Sections are editable - 'contenteditable': true + // Sections are editable if they are not templates + 'contenteditable': template ? false : true } ); // Attach event handlers for sections diff --git a/modules/translation/styles/ext.cx.translation.less b/modules/translation/styles/ext.cx.translation.less index 217db28..bf70c96 100644 --- a/modules/translation/styles/ext.cx.translation.less +++ b/modules/translation/styles/ext.cx.translation.less @@ -18,4 +18,8 @@ font-weight: lighter; color: #AAA; cursor: pointer; +} + +.cx-mw-template { + -webkit-mask-image: -webkit-linear-gradient(top, rgba(0,0,0,0.4), rgba(0,0,0,0.4)); } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/126234 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2a43e51893e94a2340fc4536e422c330fee90a62 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