jenkins-bot has submitted this change and it was merged.
Change subject: Add missing documentation for category widgets
......................................................................
Add missing documentation for category widgets
Change-Id: Idd01bb8d01363cb2eaf311abae8fa5ecf7b36f0e
---
M modules/ve/ui/widgets/ve.ui.MWCategoryItemWidget.js
M modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js
M modules/ve/ui/widgets/ve.ui.MWCategoryWidget.js
3 files changed, 68 insertions(+), 7 deletions(-)
Approvals:
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ui/widgets/ve.ui.MWCategoryItemWidget.js
b/modules/ve/ui/widgets/ve.ui.MWCategoryItemWidget.js
index c8f4d21..d3899dc 100644
--- a/modules/ve/ui/widgets/ve.ui.MWCategoryItemWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MWCategoryItemWidget.js
@@ -14,7 +14,7 @@
*
* @constructor
* @param {Object} [config] Config options
- * @cfg {Object} [metaItem] Meta Item Reference
+ * @cfg {Object} [item] Category item
*/
ve.ui.MWCategoryItemWidget = function VeUiMWCategoryItemWidget( config ) {
// Config intialization
@@ -68,14 +68,22 @@
/* Methods */
/**
- * Emits savePopupState on mousedown
+ * Handle mouse down events.
+ *
+ * @method
+ * @param {jQuery.Event} e Mouse down event
+ * @emits savePopupState on mousedown.
*/
ve.ui.MWCategoryItemWidget.prototype.onMouseDown = function () {
this.emit( 'savePopupState' );
};
/**
- * Emits togglePopupMenu on click
+ * Handle mouse click events.
+ *
+ * @method
+ * @param {jQuery.Event} e Mouse click event
+ * @emits togglePopupMenu on mousedown.
*/
ve.ui.MWCategoryItemWidget.prototype.onClick = function () {
this.emit( 'togglePopupMenu', this );
diff --git a/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js
b/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js
index 144e086..0a05c34 100644
--- a/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MWCategoryPopupWidget.js
@@ -66,25 +66,47 @@
/**
* @event removeCategory
+ * @param {string} category Category name
*/
/**
* @event updateSortkey
+ * @param {string} category Category name
+ * @param {string} sortkey New sortkey
*/
/* Methods */
+/**
+ * Handle category remove events.
+ *
+ * @method
+ * @emits removeCategory
+ */
ve.ui.MWCategoryPopupWidget.prototype.onRemoveCategory = function () {
this.emit( 'removeCategory', this.category );
this.closePopup();
};
+/**
+ * Handle sort key form submit events.
+ *
+ * @method
+ * @param {jQuery.Event} e Form submit event
+ * @emits updateSortkey
+ */
ve.ui.MWCategoryPopupWidget.prototype.onSortKeySubmit = function () {
this.emit( 'updateSortkey', this.category,
this.sortKeyInput.$input.val() );
this.closePopup();
return false;
};
+/**
+ * Open a category item popup.
+ *
+ * @method
+ * @param {ve.ui.MWCategoryItemWidget} item Category item
+ */
ve.ui.MWCategoryPopupWidget.prototype.openPopup = function ( item ) {
this.show();
this.popupOpen = true;
@@ -93,19 +115,42 @@
this.setPopup( item );
};
+/**
+ * Load item information into the popup.
+ *
+ * @method
+ * @param {ve.ui.MWCategoryItemWidget} item Category item
+ */
ve.ui.MWCategoryPopupWidget.prototype.loadCategoryIntoPopup = function ( item
) {
this.sortKeyInput.$input.val( item.sortKey );
};
+/**
+ * Close the popup.
+ *
+ * @method
+ */
ve.ui.MWCategoryPopupWidget.prototype.closePopup = function () {
this.hide();
this.popupOpen = false;
};
+/**
+ * Set the default sort key.
+ *
+ * @method
+ * @param {string} value Default sort key value
+ */
ve.ui.MWCategoryPopupWidget.prototype.setDefaultSortKey = function ( value ) {
this.sortKeyInput.$input.attr( 'placeholder', value );
};
+/**
+ * Display the popup next to an item.
+ *
+ * @method
+ * @param {ve.ui.MWCategoryItemWidget} item Category item
+ */
ve.ui.MWCategoryPopupWidget.prototype.setPopup = function ( item ) {
var left = item.$.offset().left + ( item.$.width() - 17 ),
top = item.$.offset().top + item.$.height(),
diff --git a/modules/ve/ui/widgets/ve.ui.MWCategoryWidget.js
b/modules/ve/ui/widgets/ve.ui.MWCategoryWidget.js
index b83ca6d..781ae88 100644
--- a/modules/ve/ui/widgets/ve.ui.MWCategoryWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MWCategoryWidget.js
@@ -63,12 +63,18 @@
/**
* @event newCategory
- * @param {Object} item category group item
+ * @param {Object} item Category item
+ * @param {string} item.name Fully prefixed category name
+ * @param {string} item.value Category value (name without prefix)
+ * @param {Object} item.metaItem Category meta item
*/
/**
* @event updateSortkey
- * * @param {Object} item category group item
+ * @param {Object} item Category item
+ * @param {string} item.name Fully prefixed category name
+ * @param {string} item.value Category value (name without prefix)
+ * @param {Object} item.metaItem Category meta item
*/
/* Methods */
@@ -103,8 +109,9 @@
};
/**
- * Calls metaItem remove method
+ * Removes category from model.
*
+ * @method
* @param {string} name category name
*/
ve.ui.MWCategoryWidget.prototype.onRemoveCategory = function ( name ) {
@@ -112,8 +119,9 @@
};
/**
- * Update sortkey value, emit upsteSortkey event
+ * Update sortkey value, emit updateSortkey event
*
+ * @method
* @param {string} name
* @param {string} value
*/
--
To view, visit https://gerrit.wikimedia.org/r/67902
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idd01bb8d01363cb2eaf311abae8fa5ecf7b36f0e
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits