diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php index c821c167d9..6db02a8fe4 100644 --- a/VisualEditor.i18n.php +++ b/VisualEditor.i18n.php @@ -49,6 +49,7 @@ $messages['en'] = array( 'visualeditor-savedialog-label-restore' => 'Restore page', 'visualeditor-editnotices-tool' => '$1 {{PLURAL:$1|notice|notices}}', 'visualeditor-feedback-tool' => 'Leave feedback', + 'visualeditor-meta-tool' => 'Page settings', 'visualeditor-window-title' => 'Inspect', 'visualeditor-linkinspector-title' => 'Hyperlink', 'visualeditor-linkinspector-suggest-matching-page' => 'Matching page', @@ -188,7 +189,8 @@ See also: {{Identical|Save page}}', 'visualeditor-savedialog-label-restore' => 'Label text for save button when the user is editing a previous revision', 'visualeditor-editnotices-tool' => 'Text of tool in the toolbar that shows edit notices (such as [[MediaWiki:editnotice-0]] and [[MediaWiki:editnotice-8/en]]) as a pop-up', - 'visualeditor-feedback-tool' => 'Text of tool in the toolbar that lets user provide feedback', + 'visualeditor-feedback-tool' => 'Text of tool in the toolbar that lets users provide feedback', + 'visualeditor-meta-tool' => 'Text of tool in the toolbar the lets users set categories, language links and other page settings', 'visualeditor-window-title' => 'Title of an unnamed inspector', 'visualeditor-linkinspector-title' => 'Title of the link inspector dialog. {{Identical|Hyperlink}}', diff --git a/VisualEditor.php b/VisualEditor.php index 52833c6dbb..276245ae4e 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -162,6 +162,7 @@ $wgResourceModules += array( 'visualeditor-problem', 'visualeditor-editnotices-tool', 'visualeditor-feedback-tool', + 'visualeditor-meta-tool', 'visualeditor-restore-page', 'visualeditor-create-page', 'visualeditor-save-title', @@ -424,6 +425,7 @@ $wgResourceModules += array( 've/ui/dialogs/ve.ui.ContentDialog.js', 've/ui/dialogs/ve.ui.MediaDialog.js', 've/ui/dialogs/ve.ui.PagedDialog.js', + 've/ui/dialogs/ve.ui.MWMetaDialog.js', 've/ui/tools/ve.ui.ButtonTool.js', 've/ui/tools/ve.ui.AnnotationButtonTool.js', @@ -547,9 +549,6 @@ $wgResourceModules += array( 've/ce/nodes/ve.ce.MWReferenceListNode.js', 've/ce/nodes/ve.ce.MWReferenceNode.js', - 've/ui/dialogs/ve.ui.MWMetaDialog.js', - - 've/ui/tools/buttons/ve.ui.MWMetaButtonTool.js', 've/ui/tools/buttons/ve.ui.MWReferenceButtonTool.js', 've/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js', 've/ui/dialogs/ve.ui.MWReferenceDialog.js', diff --git a/demos/ve/index.php b/demos/ve/index.php index d012cb7149..f759d68fbe 100644 --- a/demos/ve/index.php +++ b/demos/ve/index.php @@ -280,6 +280,7 @@ $html = file_get_contents( $page ); + @@ -316,8 +317,6 @@ $html = file_get_contents( $page ); - - diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js index 8422f231f1..1907c28910 100644 --- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js @@ -49,6 +49,7 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { this.$toolbarFeedbackTool = $( '
' ).addClass( 've-init-mw-viewPageTarget-tool' ); + this.$toolbarMwMetaButton = $( '
' ).addClass( 've-init-mw-viewPageTarget-tool' ); this.$saveDialog = $( '
' ).addClass( 've-init-mw-viewPageTarget-saveDialog' ); this.onBeforeUnloadFallback = null; this.onBeforeUnloadHandler = null; @@ -169,8 +170,7 @@ ve.init.mw.ViewPageTarget.static.toolbarTools = [ { 'items': ['undo', 'redo'] }, { 'items': ['mwFormat'] }, { 'items': ['bold', 'italic', 'mwLink', 'clear'] }, - { 'items': ['number', 'bullet', 'outdent', 'indent'] }, - { 'items': ['mwMeta'] } + { 'items': ['number', 'bullet', 'outdent', 'indent'] } ]; ve.init.mw.ViewPageTarget.static.surfaceCommands = [ @@ -590,6 +590,17 @@ ve.init.mw.ViewPageTarget.prototype.onToolbarCancelButtonClick = function () { this.deactivate(); }; +/** + * Handle clicks on the MwMeta button in the toolbar. + * + * @method + * @param {jQuery.Event} e Mouse click event + */ +ve.init.mw.ViewPageTarget.prototype.onToolbarMwMetaButtonClick = function () { + this.surface.getDialogs().open( 'mwMeta' ); +}; + + /** * Handle clicks on the edit notices tool in the toolbar. * @@ -966,6 +977,16 @@ ve.init.mw.ViewPageTarget.prototype.setupToolbarButtons = function () { this.toolbarCancelButton.connect( this, { 'click': 'onToolbarCancelButtonClick' } ); this.toolbarSaveButton.connect( this, { 'click': 'onToolbarSaveButtonClick' } ); + this.$toolbarMwMetaButton + .addClass( 've-ui-icon-settings' ) + .append( + $( '' ) + .addClass( 've-init-mw-viewPageTarget-tool-label' ) + .text( ve.msg( 'visualeditor-meta-tool' ) ) + ) + .click( ve.bind( this.onToolbarMwMetaButtonClick, this ) ); + + if ( editNoticeCount ) { this.$toolbarEditNoticesTool .addClass( 've-ui-icon-alert' ) @@ -996,6 +1017,7 @@ ve.init.mw.ViewPageTarget.prototype.setupToolbarButtons = function () { ve.init.mw.ViewPageTarget.prototype.tearDownToolbarButtons = function () { this.toolbarCancelButton.disconnect( this ); this.toolbarSaveButton.disconnect( this ); + this.$toolbarMwMetaButton.empty().off( 'click' ); this.$toolbarEditNoticesTool.empty().off( 'click' ); this.$toolbarFeedbackTool.empty().off( 'click' ); }; @@ -1011,7 +1033,11 @@ ve.init.mw.ViewPageTarget.prototype.attachToolbarButtons = function () { if ( !ve.isEmptyObject( this.editNotices ) ) { $target.append( this.$toolbarEditNoticesTool ); } - $target.append( this.toolbarCancelButton.$, this.toolbarSaveButton.$ ); + $target.append( + this.$toolbarMwMetaButton, + this.toolbarCancelButton.$, + this.toolbarSaveButton.$ + ); }; /** @@ -1022,6 +1048,7 @@ ve.init.mw.ViewPageTarget.prototype.attachToolbarButtons = function () { ve.init.mw.ViewPageTarget.prototype.detachToolbarButtons = function () { this.toolbarCancelButton.$.detach(); this.toolbarSaveButton.$.detach(); + this.$toolbarMwMetaButton.detatch(); this.$toolbarEditNoticesTool.detach(); this.$toolbarFeedbackTool.detach(); }; diff --git a/modules/ve/test/index.php b/modules/ve/test/index.php index 8ed86bdd1c..2b3338561b 100644 --- a/modules/ve/test/index.php +++ b/modules/ve/test/index.php @@ -233,6 +233,7 @@ + @@ -269,8 +270,6 @@ - - diff --git a/modules/ve/ui/tools/buttons/ve.ui.MWMetaButtonTool.js b/modules/ve/ui/tools/buttons/ve.ui.MWMetaButtonTool.js deleted file mode 100644 index 5fd92ed749..0000000000 --- a/modules/ve/ui/tools/buttons/ve.ui.MWMetaButtonTool.js +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * VisualEditor UserInterface MWMetaButtonTool class. - * - * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt - * @license The MIT License (MIT); see LICENSE.txt - */ - -/** - * Meta button tool. - * - * @class - * @extends ve.ui.DialogButtonTool - * @constructor - * @param {ve.ui.Toolbar} toolbar - * @param {Object} [config] Config options - */ -ve.ui.MWMetaButtonTool = function VeUiMWMetaButtonTool( toolbar, config ) { - // Parent constructor - ve.ui.DialogButtonTool.call( this, toolbar, config ); -}; - -/* Inheritance */ - -ve.inheritClass( ve.ui.MWMetaButtonTool, ve.ui.DialogButtonTool ); - -/* Static Properties */ - -ve.ui.MWMetaButtonTool.static.name = 'mwMeta'; - -ve.ui.MWMetaButtonTool.static.icon = 'settings'; - -ve.ui.MWMetaButtonTool.static.titleMessage = 'visualeditor-dialogbutton-meta-tooltip'; - -ve.ui.MWMetaButtonTool.static.dialog = 'mwMeta'; - -/* Registration */ - -ve.ui.toolFactory.register( 'mwMeta', ve.ui.MWMetaButtonTool );