From fc7799b9f340a0f3a03816596891107652d25d18 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Thu, 18 Aug 2016 15:20:48 -0700 Subject: [PATCH] Allow skins a mechanism to decide on placement of related pages * If a footer-content element is present prepend there * If no footer-content element given wrap the component in a container that is known to be compatible with known skins - this has post-content class (for backwards compatiblity with old Minerva skins) and a class to apply the correct margin to Vector Bug: T141002 Change-Id: Iac11948f8f5fdaad45d51b905bb7494a84775710 --- resources/ext.relatedArticles.readMore/index.js | 11 +++++++++-- .../readMore.default.less | 5 ++++- .../readMore.minerva.less | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/resources/ext.relatedArticles.readMore/index.js b/resources/ext.relatedArticles.readMore/index.js index ac1c912d..0e481434 100644 --- a/resources/ext.relatedArticles.readMore/index.js +++ b/resources/ext.relatedArticles.readMore/index.js @@ -44,11 +44,18 @@ cards = new CardListView( getCards( pages ) ); - $readMore = $( '' ) + $readMore = $( '' ) .append( $( '

' ).text( mw.msg( 'relatedarticles-read-more-heading' ) ) ) .append( cards.$el ); - $readMore.insertAfter( '#content' ); + // If a skin has marked up a footer content area prepend it there + if ( $( '.footer-content' ).length ) { + $readMore.prependTo( '.footer-content' ); + } else { + $( '
' ) + .append( $readMore ) + .insertAfter( '#content' ); + } // the ReadMore code is ready mw.track( 'ext.relatedArticles.logReady', { $readMore: $readMore } ); diff --git a/resources/ext.relatedArticles.readMore/readMore.default.less b/resources/ext.relatedArticles.readMore/readMore.default.less index 795723ef..2ad1342a 100644 --- a/resources/ext.relatedArticles.readMore/readMore.default.less +++ b/resources/ext.relatedArticles.readMore/readMore.default.less @@ -5,8 +5,11 @@ } } -.ra-read-more { +.read-more-container { margin: 0 0 0 10em; +} + +.ra-read-more { padding: 1em; .ext-cards-card-list { diff --git a/resources/ext.relatedArticles.readMore/readMore.minerva.less b/resources/ext.relatedArticles.readMore/readMore.minerva.less index a11c1953..e72504e2 100644 --- a/resources/ext.relatedArticles.readMore/readMore.minerva.less +++ b/resources/ext.relatedArticles.readMore/readMore.minerva.less @@ -1,4 +1,4 @@ -.ra-read-more { +.read-more-container { margin-top: 35px; }