From b19997a97075d94b6d0a8dd6cfa116c6867829ad Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Fri, 25 Aug 2017 10:17:03 -0500 Subject: [PATCH] Collapse amboxes in edit view In edit mode various amboxes are shown which push the editor area below the fold. We solved this problem already for "page issues" in normal page views so we should apply the same solution here. "Editing help" message will show under the heading. When clicked information will show in an overlay. Change-Id: Ia6e478f289267d22adc55532221cba2aae16ff36 --- .../skins.minerva.scripts/cleanuptemplates.js | 14 ++++++++++---- skin.json | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/resources/skins.minerva.scripts/cleanuptemplates.js b/resources/skins.minerva.scripts/cleanuptemplates.js index 5e7affc..5f2ba21 100644 --- a/resources/skins.minerva.scripts/cleanuptemplates.js +++ b/resources/skins.minerva.scripts/cleanuptemplates.js @@ -1,7 +1,8 @@ ( function ( M, $ ) { ( function () { - var overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ), + var action = mw.config.get( 'wgAction' ), + overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ), CleanupOverlay = M.require( 'mobile.issues/CleanupOverlay' ); /** @@ -50,7 +51,7 @@ * @ignore */ function createBanner( $container, labelText, headingText ) { - var selector = 'table.ambox, table.tmbox, table.cmbox', + var selector = 'table.ambox, table.tmbox, table.cmbox, table.fmbox', $metadata = $container.find( selector ), issues = [], $link; @@ -100,11 +101,16 @@ $container = ns === 14 ? $( '#bodyContent' ) : M.getCurrentPage().getLeadSectionElement(); - if ( $container === null ) { + if ( action === 'edit' ) { + $container = $( '#mw-content-text' ); + } else if ( $container === null ) { return; } - if ( ns === 0 ) { + if ( action === 'edit' ) { + createBanner( $container, mw.msg( 'edithelp' ), + mw.msg( 'edithelp' ) ); + } else if ( ns === 0 ) { createBanner( $container, mw.msg( 'mobile-frontend-meta-data-issues' ), mw.msg( 'mobile-frontend-meta-data-issues-header' ) ); // Create a banner for talk pages (namespace 1) in beta mode to make them more readable. diff --git a/skin.json b/skin.json index 47a89cb..1161b08 100644 --- a/skin.json +++ b/skin.json @@ -264,6 +264,7 @@ "mobile.betaoptin" ], "messages": [ + "edithelp", "mobile-frontend-language-change", "mobile-frontend-meta-data-issues", "mobile-frontend-meta-data-issues-talk",