Jforrester has uploaded a new change for review.
https://gerrit.wikimedia.org/r/95723
Change subject: Let users set __NOEDITSECTION__ status
......................................................................
Let users set __NOEDITSECTION__ status
Adds a checkbox to the page settings pane of the meta dialog that lets
users set or unset the __NOEDITSECTION__ flag on the page.
Change-Id: If1eca58e28d214021f5f5582856e595d4d0fbc43
---
M VisualEditor.i18n.php
M VisualEditor.php
A modules/ve-mw/dm/metaitems/ve.dm.MWNoEditSectionMetaItem.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js
4 files changed, 81 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/23/95723/1
diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 56e5fd5..3b04d14 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -83,6 +83,7 @@
'visualeditor-dialog-meta-languages-readonlynote' => 'This is a list of
pages in other languages that are linked to this one; for now, it can only be
edited in source mode.',
'visualeditor-dialog-meta-languages-section' => 'Languages',
'visualeditor-dialog-meta-settings-label' => 'Page settings',
+ 'visualeditor-dialog-meta-settings-noeditsection-label' => 'Disable
section edit links next to each heading on this page.',
'visualeditor-dialog-meta-settings-redirect-label' => 'Redirect this
page to',
'visualeditor-dialog-meta-settings-redirect-placeholder' => 'Target
page for redirection',
'visualeditor-dialog-meta-settings-redirect-staticlabel' => 'Prevent
this redirect being updated when target page is moved.',
@@ -436,6 +437,7 @@
'visualeditor-dialog-meta-languages-section' => 'Label for the language
links dialog section.
{{Identical|Language}}',
'visualeditor-dialog-meta-settings-label' => 'Title for the page
settings dialog section',
+ 'visualeditor-dialog-meta-settings-noeditsection-label' => 'Prompt for
the checkbox to let the user disable section edit links on the page.',
'visualeditor-dialog-meta-settings-redirect-label' => 'Prompt for the
checkbox to let the user redirect the page.',
'visualeditor-dialog-meta-settings-redirect-placeholder' =>
'Placeholder for the target search box letting the user redirect the page.',
'visualeditor-dialog-meta-settings-redirect-staticlabel' => 'Prompt for
the checkbox to let the user stop the redirect being updated on page moves.',
diff --git a/VisualEditor.php b/VisualEditor.php
index 2f017c9..0d3ee18 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -437,6 +437,7 @@
've-mw/dm/metaitems/ve.dm.MWCategoryMetaItem.js',
've-mw/dm/metaitems/ve.dm.MWDefaultSortMetaItem.js',
've-mw/dm/metaitems/ve.dm.MWLanguageMetaItem.js',
+ 've-mw/dm/metaitems/ve.dm.MWNoEditSectionMetaItem.js',
've-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js',
've-mw/dm/metaitems/ve.dm.MWStaticRedirectMetaItem.js',
've-mw/dm/metaitems/ve.dm.MWTOCDisableMetaItem.js',
@@ -653,6 +654,7 @@
'visualeditor-dialog-meta-languages-readonlynote',
'visualeditor-dialog-meta-languages-section',
'visualeditor-dialog-meta-settings-label',
+ 'visualeditor-dialog-meta-settings-noeditsection-label',
'visualeditor-dialog-meta-settings-redirect-label',
'visualeditor-dialog-meta-settings-redirect-placeholder',
'visualeditor-dialog-meta-settings-section',
diff --git a/modules/ve-mw/dm/metaitems/ve.dm.MWNoEditSectionMetaItem.js
b/modules/ve-mw/dm/metaitems/ve.dm.MWNoEditSectionMetaItem.js
new file mode 100644
index 0000000..1cfe307
--- /dev/null
+++ b/modules/ve-mw/dm/metaitems/ve.dm.MWNoEditSectionMetaItem.js
@@ -0,0 +1,47 @@
+/*!
+ * VisualEditor DataModel MWNoEditSectionMetaItem class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * DataModel disable section edit links meta item.
+ *
+ * @class
+ * @extends ve.dm.MetaItem
+ * @constructor
+ * @param {Object} element Reference to element in meta-linmod
+ */
+ve.dm.MWNoEditSectionMetaItem = function VeDmMWNoEditSectionMetaItem( element
) {
+ // Parent constructor
+ ve.dm.MetaItem.call( this, element );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.dm.MWNoEditSectionMetaItem, ve.dm.MetaItem );
+
+/* Static Properties */
+
+ve.dm.MWNoEditSectionMetaItem.static.name = 'mwNoEditSection';
+
+ve.dm.MWNoEditSectionMetaItem.static.group = 'mwNoEditSection';
+
+ve.dm.MWNoEditSectionMetaItem.static.matchTagNames = [ 'meta' ];
+
+ve.dm.MWNoEditSectionMetaItem.static.matchRdfaTypes = [
'mw:PageProp/noeditsection' ];
+
+ve.dm.MWNoEditSectionMetaItem.static.toDataElement = function ( ) {
+ return { 'type': this.name };
+};
+
+ve.dm.MWNoEditSectionMetaItem.static.toDomElements = function ( dataElement,
doc ) {
+ var meta = doc.createElement( 'meta' );
+ meta.setAttribute( 'property', 'mw:PageProp/noeditsection' );
+ return [ meta ];
+};
+
+/* Registration */
+
+ve.dm.modelRegistry.register( ve.dm.MWNoEditSectionMetaItem );
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js
index 3044918..b645cfd 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js
@@ -327,8 +327,6 @@
return redirects.length ? redirects[0] : null;
};
-
-
/**
* Get Table Of Contents options
*
@@ -336,6 +334,16 @@
*/
ve.ui.MWMetaDialog.prototype.getTOCOptionItems = function () {
return this.metaList.getItemsInGroup( 'mwTOC' );
+};
+
+/**
+ * Get the no edit section item
+ *
+ * @returns {Object|null} Redirect target, if any
+ */
+ve.ui.MWMetaDialog.prototype.getDisableSectionEditLinksItem = function () {
+ var metaItems = this.metaList.getItemsInGroup( 'mwNoEditSection' );
+ return metaItems.length ? metaItems[0] : null;
};
/**
@@ -423,6 +431,10 @@
)
};
this.tocOptionSelector.addItems( ve.getObjectValues(
this.tocOptionWidgets ) );
+ this.disableSectionEditLinksInput = new OO.ui.CheckboxInputWidget( {
+ '$': this.$,
+ 'label': ve.msg(
'visualeditor-dialog-meta-settings-noeditsection-label' )
+ } );
// General items
this.applyButton = new OO.ui.PushButtonWidget( {
@@ -520,7 +532,9 @@
this.$( '<span>' )
.text( ve.msg(
'visualeditor-dialog-meta-settings-toc-label' ) ),
- this.tocOptionSelector.$element
+ this.tocOptionSelector.$element,
+
+ this.disableSectionEditLinksInput.$element
);
};
@@ -570,6 +584,8 @@
this.tocOptionSelector.selectItem( this.tocOptionWidgets[tocType] );
this.tocOptionChanged = false;
+ this.disableSectionEditLinksInput.setValue(
this.getDisableSectionEditLinksItem() );
+
// Force all previous transactions to be separate from this history
state
surfaceModel.breakpoint();
surfaceModel.stopHistoryTracking();
@@ -603,7 +619,11 @@
// Table of Contents items
currentTOCItemsIndex,
currentTOCItems = this.getTOCOptionItems(),
- newTOCOptionData = this.tocOptionSelector.getSelectedItem();
+ newTOCOptionData = this.tocOptionSelector.getSelectedItem(),
+
+ // Disable section edit links items
+ currentDisableSectionEditLinksItem =
this.getDisableSectionEditLinksItem(),
+ newDisableSectionEditState =
this.disableSectionEditLinksInput.getValue();
// Place transactions made while dialog was open in a common history
state
hasTransactions = surfaceModel.breakpoint();
@@ -668,6 +688,12 @@
}
}
+ if ( !currentDisableSectionEditLinksItem && newDisableSectionEditState
) {
+ this.insertMetaListItem( new
ve.dm.mwNoEditSectionMetaItem() );
+ } else if ( !newDisableSectionEditState ) {
+ currentDisableSectionEditLinksItem.remove();
+ }
+
// Return to normal tracking behavior
surfaceModel.startHistoryTracking();
--
To view, visit https://gerrit.wikimedia.org/r/95723
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1eca58e28d214021f5f5582856e595d4d0fbc43
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits