Move redlink CTA out of skins.minerva.editor
It is not part of the editor. Redlinks are part of page content. Bug: T198765 Change-Id: Iee77a228b6f2db1c5f2e85226d6cc1c6a73a89be
This commit is contained in:
parent
1b61a14535
commit
1a89047d3b
|
@ -10,8 +10,6 @@
|
|||
overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ),
|
||||
loader = M.require( 'mobile.startup/rlModuleLoader' ),
|
||||
Icon = M.require( 'mobile.startup/Icon' ),
|
||||
Button = M.require( 'mobile.startup/Button' ),
|
||||
Anchor = M.require( 'mobile.startup/Anchor' ),
|
||||
skin = M.require( 'skins.minerva.scripts/skin' ),
|
||||
currentPage = M.getCurrentPage(),
|
||||
// TODO: create a utility method to generate class names instead of
|
||||
|
@ -263,28 +261,6 @@
|
|||
}
|
||||
} );
|
||||
updateEditPageButton( true );
|
||||
currentPage.getRedLinks().on( 'click', function ( ev ) {
|
||||
var drawerOptions = {
|
||||
progressiveButton: new Button( {
|
||||
progressive: true,
|
||||
label: mw.msg( 'mobile-frontend-editor-redlink-create' ),
|
||||
href: $( this ).attr( 'href' )
|
||||
} ).options,
|
||||
closeAnchor: new Anchor( {
|
||||
progressive: true,
|
||||
label: mw.msg( 'mobile-frontend-editor-redlink-leave' ),
|
||||
additionalClassNames: 'hide'
|
||||
} ).options,
|
||||
content: mw.msg( 'mobile-frontend-editor-redlink-explain' ),
|
||||
actionAnchor: false
|
||||
},
|
||||
drawer = new CtaDrawer( drawerOptions );
|
||||
|
||||
// use preventDefault() and not return false to close other open
|
||||
// drawers or anything else.
|
||||
ev.preventDefault();
|
||||
drawer.show();
|
||||
} );
|
||||
|
||||
// Make sure we never create two edit links by accident
|
||||
// FIXME: split the selector and cache it
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
loader = M.require( 'mobile.startup/rlModuleLoader' ),
|
||||
router = require( 'mediawiki.router' ),
|
||||
OverlayManager = M.require( 'mobile.startup/OverlayManager' ),
|
||||
CtaDrawer = M.require( 'mobile.startup/CtaDrawer' ),
|
||||
Button = M.require( 'mobile.startup/Button' ),
|
||||
Anchor = M.require( 'mobile.startup/Anchor' ),
|
||||
overlayManager = new OverlayManager( require( 'mediawiki.router' ) ),
|
||||
page = M.getCurrentPage(),
|
||||
api = new mw.Api(),
|
||||
|
@ -276,6 +279,39 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize red links call-to-action
|
||||
*
|
||||
* Upon clicking a red link, show an interstitial CTA explaining that the page doesn't exist
|
||||
* with a button to create it, rather than directly navigate to the edit form.
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
function initRedlinksCta() {
|
||||
page.getRedLinks().on( 'click', function ( ev ) {
|
||||
var drawerOptions = {
|
||||
progressiveButton: new Button( {
|
||||
progressive: true,
|
||||
label: mw.msg( 'mobile-frontend-editor-redlink-create' ),
|
||||
href: $( this ).attr( 'href' )
|
||||
} ).options,
|
||||
closeAnchor: new Anchor( {
|
||||
progressive: true,
|
||||
label: mw.msg( 'mobile-frontend-editor-redlink-leave' ),
|
||||
additionalClassNames: 'hide'
|
||||
} ).options,
|
||||
content: mw.msg( 'mobile-frontend-editor-redlink-explain' ),
|
||||
actionAnchor: false
|
||||
},
|
||||
drawer = new CtaDrawer( drawerOptions );
|
||||
|
||||
// use preventDefault() and not return false to close other open
|
||||
// drawers or anything else.
|
||||
ev.preventDefault();
|
||||
drawer.show();
|
||||
} );
|
||||
}
|
||||
|
||||
$( function () {
|
||||
// Update anything else that needs enhancing (e.g. watchlist)
|
||||
initModifiedInfo();
|
||||
|
@ -284,6 +320,7 @@
|
|||
M.on( 'resize', loadTabletModules );
|
||||
loadTabletModules();
|
||||
appendDownloadButton();
|
||||
initRedlinksCta();
|
||||
// Setup the issues banner on the page
|
||||
// Pages which dont exist (id 0) cannot have issues
|
||||
if ( !page.isMissing ) {
|
||||
|
|
|
@ -411,6 +411,9 @@
|
|||
"mobile-frontend-meta-data-issues-header-talk",
|
||||
"mobile-frontend-languages-not-available",
|
||||
"mobile-frontend-cookies-required",
|
||||
"mobile-frontend-editor-redlink-create",
|
||||
"mobile-frontend-editor-redlink-leave",
|
||||
"mobile-frontend-editor-redlink-explain",
|
||||
"minerva-download",
|
||||
"mobile-frontend-redirected-from"
|
||||
],
|
||||
|
@ -533,9 +536,6 @@
|
|||
"mobile-frontend-editor-uploadenable",
|
||||
"mobile-frontend-editor-cta",
|
||||
"mobile-frontend-editor-edit",
|
||||
"mobile-frontend-editor-redlink-create",
|
||||
"mobile-frontend-editor-redlink-leave",
|
||||
"mobile-frontend-editor-redlink-explain",
|
||||
"apierror-readonly"
|
||||
],
|
||||
"scripts": [
|
||||
|
|
Loading…
Reference in New Issue