Add drawer when user is not logged in and anonymous edits are disabled
Bug: T206823 Change-Id: Ibd77ff0966f2d4b86e61f66caaafb94e85b02235
This commit is contained in:
parent
6a73c395f1
commit
10978e5022
|
@ -6,6 +6,7 @@
|
||||||
"minerva-talk-add-topic": "Add discussion",
|
"minerva-talk-add-topic": "Add discussion",
|
||||||
"mobile-frontend-cookies-required": "Cookies are required to switch view modes. Please enable them and try again.",
|
"mobile-frontend-cookies-required": "Cookies are required to switch view modes. Please enable them and try again.",
|
||||||
"mobile-frontend-editor-disabled": "This page is protected to prevent vandalism.",
|
"mobile-frontend-editor-disabled": "This page is protected to prevent vandalism.",
|
||||||
|
"mobile-frontend-editor-disabled-anon": "You need to log in to edit this page.",
|
||||||
"mobile-frontend-editor-edit": "Edit",
|
"mobile-frontend-editor-edit": "Edit",
|
||||||
"minerva-download": "Download",
|
"minerva-download": "Download",
|
||||||
"skin-minerva-share": "Share",
|
"skin-minerva-share": "Share",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"minerva-talk-add-topic": "Label for button which shows at bottom of talk pages in mobile view prompting addition of topic",
|
"minerva-talk-add-topic": "Label for button which shows at bottom of talk pages in mobile view prompting addition of topic",
|
||||||
"mobile-frontend-cookies-required": "Error message shown when user attempts to switch site modes and cookies are not enabled.",
|
"mobile-frontend-cookies-required": "Error message shown when user attempts to switch site modes and cookies are not enabled.",
|
||||||
"mobile-frontend-editor-disabled": "Toast message that appears when a user is unable to edit a page and clicks edit icon.",
|
"mobile-frontend-editor-disabled": "Toast message that appears when a user is unable to edit a page and clicks edit icon.",
|
||||||
|
"mobile-frontend-editor-disabled-anon": "Message that appears in a drawer when a user is not logged in and anonymous edits are disabled.",
|
||||||
"mobile-frontend-editor-edit": "Caption for the link showing edit form. (In the imperative mood)\n{{Identical|Edit}}",
|
"mobile-frontend-editor-edit": "Caption for the link showing edit form. (In the imperative mood)\n{{Identical|Edit}}",
|
||||||
"minerva-download": "Caption for the download button (in the imperative mood).\n{{Identical|Download}}",
|
"minerva-download": "Caption for the download button (in the imperative mood).\n{{Identical|Download}}",
|
||||||
"skin-minerva-share": "Caption for the share button (in the imperative mood).\n{{Identical|Share}}",
|
"skin-minerva-share": "Caption for the share button (in the imperative mood).\n{{Identical|Share}}",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
$allEditLinks = $( '#ca-edit a, .mw-editsection a, .edit-link' ),
|
$allEditLinks = $( '#ca-edit a, .mw-editsection a, .edit-link' ),
|
||||||
user = M.require( 'mobile.startup/user' ),
|
user = M.require( 'mobile.startup/user' ),
|
||||||
popup = M.require( 'mobile.startup/toast' ),
|
popup = M.require( 'mobile.startup/toast' ),
|
||||||
|
CtaDrawer = M.require( 'mobile.startup/CtaDrawer' ),
|
||||||
// FIXME: Disable on IE < 10 for time being
|
// FIXME: Disable on IE < 10 for time being
|
||||||
blacklisted = /MSIE \d\./.test( navigator.userAgent ),
|
blacklisted = /MSIE \d\./.test( navigator.userAgent ),
|
||||||
contentModel = mw.config.get( 'wgPageContentModel' ),
|
contentModel = mw.config.get( 'wgPageContentModel' ),
|
||||||
|
@ -219,7 +220,7 @@
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
function init() {
|
function init() {
|
||||||
var isReadOnly, isEditable, editErrorMessage;
|
var isReadOnly, isEditable, editErrorMessage, drawer, editRestrictions;
|
||||||
// see: https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#Page-specific
|
// see: https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#Page-specific
|
||||||
isReadOnly = mw.config.get( 'wgMinervaReadOnly' );
|
isReadOnly = mw.config.get( 'wgMinervaReadOnly' );
|
||||||
isEditable = !isReadOnly && mw.config.get( 'wgIsProbablyEditable' );
|
isEditable = !isReadOnly && mw.config.get( 'wgIsProbablyEditable' );
|
||||||
|
@ -229,8 +230,22 @@
|
||||||
setupEditor( currentPage );
|
setupEditor( currentPage );
|
||||||
} else {
|
} else {
|
||||||
hideSectionEditIcons();
|
hideSectionEditIcons();
|
||||||
editErrorMessage = isReadOnly ? mw.msg( 'apierror-readonly' ) : mw.msg( 'mobile-frontend-editor-disabled' );
|
editRestrictions = mw.config.get( 'wgRestrictionEdit' );
|
||||||
showSorryToast( editErrorMessage );
|
if ( mw.user.isAnon() && Array.isArray( editRestrictions ) && editRestrictions.indexOf( '*' ) !== -1 ) {
|
||||||
|
drawer = new CtaDrawer( {
|
||||||
|
content: mw.msg( 'mobile-frontend-editor-disabled-anon' ),
|
||||||
|
signupQueryParams: {
|
||||||
|
warning: 'mobile-frontend-watchlist-signup-action'
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
$allEditLinks.on( 'click', function ( ev ) {
|
||||||
|
drawer.show();
|
||||||
|
ev.preventDefault();
|
||||||
|
} );
|
||||||
|
} else {
|
||||||
|
editErrorMessage = isReadOnly ? mw.msg( 'apierror-readonly' ) : mw.msg( 'mobile-frontend-editor-disabled' );
|
||||||
|
showSorryToast( editErrorMessage );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -513,6 +513,7 @@
|
||||||
],
|
],
|
||||||
"messages": [
|
"messages": [
|
||||||
"mobile-frontend-editor-disabled",
|
"mobile-frontend-editor-disabled",
|
||||||
|
"mobile-frontend-editor-disabled-anon",
|
||||||
"mobile-frontend-editor-uploadenable",
|
"mobile-frontend-editor-uploadenable",
|
||||||
"apierror-readonly"
|
"apierror-readonly"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue