diff --git a/i18n/en.json b/i18n/en.json index 9eef776..4c61b7c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -5,7 +5,6 @@ "minerva-last-modified-date": "Last edited on $1, at $2", "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-editor-blocked-info-loggedin": "Your account is blocked from editing. The block was made by {{GENDER:$2|$2}} for the following reason: $1", "mobile-frontend-editor-cta": "Help improve this page!", "minerva-pointer-dismiss": "Dismiss", "mobile-frontend-editor-disabled": "This page is protected to prevent vandalism.", @@ -61,9 +60,5 @@ "skin-minerva-mobile-option-MinervaShowCategoriesButton": "Categories", "skin-minerva-mobile-option-MinervaShowCategoriesButton-description": "View categories of pages", "skin-minerva-mobile-option-MinervaEnableBackToTop": "Jump to top", - "skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Jump to top of the current page using a floating button", - "skin-minerva-blocked-drawer-title": "Your account has been blocked from editing {{SITENAME}}", - "skin-minerva-blocked-drawer-reason-header": "Reason for the block", - "skin-minerva-blocked-drawer-creator-header": "{{GENDER:$1|Blocked}} by", - "skin-minerva-blocked-drawer-expiry-header": "Block will expire in" + "skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Jump to top of the current page using a floating button" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 9766b70..50bda07 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -14,7 +14,6 @@ "minerva-last-modified-date": "Text that displays the date the page was last modified. Parameters:\n* $1 - date\n* $2 - time\n{{Related|Mobile-frontend-last-modified}}", "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-editor-blocked-info-loggedin": "Toast message for logged in users that appears (before the user see the editor) when a user tries to edit a page, but is blocked from editing with reason and blocked by information.\n\nParameters:\n* $1 - blocked by information (Username of the user who crated this block)\n* $2 - Reason for this block, if any", "mobile-frontend-editor-cta": "Caption for call to action when an anonymous user clicks on edit icon. (Note the mobile site currently doesn't allow anonymous editing.)\n{{Identical|Help improve this page}}", "minerva-pointer-dismiss": "Label of button that dismisses overlay pointing at a particular new feature.", "mobile-frontend-editor-disabled": "Toast message that appears when a user is unable to edit a page and clicks edit icon.", @@ -70,9 +69,5 @@ "skin-minerva-mobile-option-MinervaShowCategoriesButton": "Label for categories mobile web beta feature.\n{{Identical|Category}}", "skin-minerva-mobile-option-MinervaShowCategoriesButton-description": "Description label for categories mobile web beta feature.", "skin-minerva-mobile-option-MinervaEnableBackToTop": "Label for jump to top mobile web beta feature", - "skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Description label for jump to top mobile web beta feature", - "skin-minerva-blocked-drawer-title": "Title for the drawer that appears when a blocked user attempts to edit.", - "skin-minerva-blocked-drawer-reason-header": "Header for the block reason message that appears when a blocked user attempts to edit.", - "skin-minerva-blocked-drawer-creator-header": "Header for the block creator that appears when a blocked user attempts to edit. \nParameters:\n* $1 - user's gender", - "skin-minerva-blocked-drawer-expiry-header": "Header for the block expiry that appears when a blocked user attempts to edit." + "skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Description label for jump to top mobile web beta feature" } diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index 7465042..8d7c79d 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -1272,45 +1272,7 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin { ]; if ( $this->isAuthenticatedUser() ) { - $blockInfo = false; - if ( $user->isBlockedFrom( $title, true ) ) { - $block = $user->getBlock(); - - $blockReason = $block->mReason ? - Linker::formatComment( $block->mReason ) : - false; - - $blockCreator = User::newFromName( $block->getByName() ); - - $blockExpiry = null; - $blockDuration = null; - if ( !wfIsInfinity( $block->getExpiry() ) ) { - $blockExpiry = $this->getLanguage()->translateBlockExpiry( - $block->getExpiry(), - $this->getUser(), - time() - ); - // Use the largest unit returned from Language::formatDuraiton() since - // we do not need to display the level of percision that the method - // returns. - list( $blockDuration ) = explode( - ', ', - $this->getLanguage()->formatDuration( wfTimestamp( TS_UNIX, $block->getExpiry() ) - time() ) - ); - } - $blockInfo = [ - 'creator' => [ - 'name' => $blockCreator->getName(), - 'url' => $blockCreator->getUserPage()->getLinkURL(), - 'gender' => $blockCreator->getOption( 'gender' ), - ], - 'expiry' => $blockExpiry, - 'duration' => $blockDuration, - // check, if a reason for this block is saved, otherwise use "no reason given" msg - 'reason' => $blockReason, - ]; - } - $vars['wgMinervaUserBlockInfo'] = $blockInfo; + $vars['wgMinervaUserBlockInfo'] = $user->isBlockedFrom( $title, true ); } return $vars; diff --git a/resources/skins.minerva.editor/BlockMessage.hogan b/resources/skins.minerva.editor/BlockMessage.hogan deleted file mode 100644 index ff52548..0000000 --- a/resources/skins.minerva.editor/BlockMessage.hogan +++ /dev/null @@ -1,34 +0,0 @@ -{{#collapseIcon}}{{>icon}}{{/collapseIcon}} -
-
- {{#stopHandIcon}}{{>icon}}{{/stopHandIcon}} -
-
-
-
{{ title }}
-
-
- {{#reason}} -
-
{{ reasonHeader }}
-
{{{ reason }}}
-
- {{/reason}} - - {{#expiry}} -
-
{{ expiryHeader }}
-
{{#duration}}{{ duration }} / {{/duration}}{{ expiry }}
-
- {{/expiry}} -
- {{#okButton}} -
- {{>button}} -
- {{/okButton}} -
-
diff --git a/resources/skins.minerva.editor/BlockMessage.js b/resources/skins.minerva.editor/BlockMessage.js deleted file mode 100644 index 18bbdb4..0000000 --- a/resources/skins.minerva.editor/BlockMessage.js +++ /dev/null @@ -1,53 +0,0 @@ -( function ( M ) { - 'use strict'; - - var Drawer = M.require( 'mobile.startup/Drawer' ), - Button = M.require( 'mobile.startup/Button' ), - Icon = M.require( 'mobile.startup/Icon' ), - util = M.require( 'mobile.startup/util' ); - - /** - * This creates the drawer at the bottom of the screen that appears when a - * blocked user tries to edit. - * @class BlockReason - * @extends Drawer - */ - function BlockMessage() { - Drawer.apply( this, arguments ); - } - - OO.mfExtend( BlockMessage, Drawer, { - defaults: util.extend( {}, Drawer.prototype.defaults, { - stopHandIcon: new Icon( { - glyphPrefix: 'minerva', - name: 'stop-hand' - } ).options, - userIcon: new Icon( { - tagName: 'span', - glyphPrefix: 'minerva', - name: 'profile' - } ).options, - okButton: new Button( { - label: mw.msg( 'ok' ), - tagName: 'button', - progressive: true, - additionalClassNames: 'cancel' - } ).options, - title: mw.msg( 'skin-minerva-blocked-drawer-title' ), - reasonHeader: mw.msg( 'skin-minerva-blocked-drawer-reason-header' ), - creatorHeader: function () { - return mw.msg( 'skin-minerva-blocked-drawer-creator-header', - this.creator.gender || 'unknown' ); - }, - expiryHeader: mw.msg( 'skin-minerva-blocked-drawer-expiry-header' ) - } ), - templatePartials: util.extend( {}, Drawer.prototype.templatePartials, { - button: Button.prototype.template, - icon: Icon.prototype.template - } ), - template: mw.template.get( 'skins.minerva.editor.blockMessage', 'BlockMessage.hogan' ) - } ); - - M.define( 'skins.minerva.editor/BlockMessage', BlockMessage ); - -}( mw.mobileFrontend ) ); diff --git a/resources/skins.minerva.editor/BlockMessage.less b/resources/skins.minerva.editor/BlockMessage.less deleted file mode 100644 index d6b56fb..0000000 --- a/resources/skins.minerva.editor/BlockMessage.less +++ /dev/null @@ -1,52 +0,0 @@ -@import 'mediawiki.ui/variables'; - -.block-message { - h5 { - font-weight: bold; - } - h6 { - margin-bottom: 0.187em; - } -} - -.block-message-icon { - float: left; - width: 20%; - margin-top: 0.3em; -} - -.block-message-info { - float: left; - width: 80%; - text-align: left; -} - -.block-message-item { - margin-bottom: 1em; -} - -.block-message-data { - margin-bottom: 1.875em; -} - -.block-message-buttons button.cancel { - margin: 0; -} - -.block-message-creator { - a { - color: inherit; - &:hover { - text-decoration: none; - } - } - .mw-ui-icon { - display: inline-block; - vertical-align: top; - margin: 0 -@iconGutterWidth; - } -} - -.block-message-title { - color: @colorDestructive; -} diff --git a/resources/skins.minerva.editor/init.js b/resources/skins.minerva.editor/init.js index 94dc56b..6cd7a68 100644 --- a/resources/skins.minerva.editor/init.js +++ b/resources/skins.minerva.editor/init.js @@ -10,7 +10,6 @@ Icon = M.require( 'mobile.startup/Icon' ), Button = M.require( 'mobile.startup/Button' ), Anchor = M.require( 'mobile.startup/Anchor' ), - BlockMessage = M.require( 'skins.minerva.editor/BlockMessage' ), skin = M.require( 'skins.minerva.scripts/skin' ), currentPage = M.getCurrentPage(), // TODO: create a utility method to generate class names instead of @@ -48,10 +47,8 @@ if ( user.isAnon() ) { blockInfo = false; - } else if ( isEditable ) { - // for logged in users check if they are blocked from editing this page - isEditable = !blockInfo; } + // TODO: rename addEditSectionButton and evaluate whether the page edit button // can leverage the same code. Also: change the CSS class name to use // the word "section" instead of "page". @@ -333,6 +330,10 @@ router.navigate( fragment ); } } + + if ( blockInfo ) { + updateEditPageButton( false ); + } } /** @@ -341,23 +342,12 @@ * @ignore */ function init() { - var message; - if ( isEditable ) { // Edit button updated in setupEditor. setupEditor( currentPage ); } else { updateEditPageButton( false ); - if ( blockInfo ) { - message = new BlockMessage( blockInfo ); - $( '#ca-edit' ).on( 'click', function ( ev ) { - message.toggle(); - ev.preventDefault(); - } ); - $( '.edit-page' ).detach(); - } else { - showSorryToast( mw.msg( 'mobile-frontend-editor-disabled' ) ); - } + showSorryToast( mw.msg( 'mobile-frontend-editor-disabled' ) ); } } diff --git a/resources/skins.minerva.icons.images.scripts.misc/stop-hand.svg b/resources/skins.minerva.icons.images.scripts.misc/stop-hand.svg deleted file mode 100644 index 1a9be0d..0000000 --- a/resources/skins.minerva.icons.images.scripts.misc/stop-hand.svg +++ /dev/null @@ -1 +0,0 @@ -stop hand \ No newline at end of file diff --git a/skin.json b/skin.json index 575dcf0..8b1d903 100644 --- a/skin.json +++ b/skin.json @@ -261,8 +261,7 @@ "class": "ResourceLoaderImageModule", "selector": ".mw-ui-icon-minerva-{name}:before", "images": { - "download": "resources/skins.minerva.icons.images.scripts.misc/download.svg", - "stop-hand": "resources/skins.minerva.icons.images.scripts.misc/stop-hand.svg" + "download": "resources/skins.minerva.icons.images.scripts.misc/download.svg" } }, "skins.minerva.icons.page.issues.uncolored": { @@ -501,31 +500,6 @@ "desktop" ] }, - "skins.minerva.editor.blockMessage": { - "dependencies": [ - "skins.minerva.scripts" - ], - "messages": [ - "ok", - "skin-minerva-blocked-drawer-title", - "skin-minerva-blocked-drawer-reason-header", - "skin-minerva-blocked-drawer-creator-header", - "skin-minerva-blocked-drawer-expiry-header" - ], - "templates": { - "BlockMessage.hogan": "resources/skins.minerva.editor/BlockMessage.hogan" - }, - "scripts": [ - "resources/skins.minerva.editor/BlockMessage.js" - ], - "styles": [ - "resources/skins.minerva.editor/BlockMessage.less" - ], - "targets": [ - "mobile", - "desktop" - ] - }, "skins.minerva.editor": { "targets": [ "mobile", @@ -539,14 +513,12 @@ "mediawiki.ui.input", "mobile.startup", "skins.minerva.toggling", - "mediawiki.jqueryMsg", - "skins.minerva.editor.blockMessage" + "mediawiki.jqueryMsg" ], "messages": [ "mobile-frontend-editor-disabled", "mobile-frontend-editor-unavailable", "mobile-frontend-editor-uploadenable", - "mobile-frontend-editor-blocked-info-loggedin", "mobile-frontend-editor-cta", "mobile-frontend-editor-undo-unsupported", "mobile-frontend-editor-edit",