From ba9b0c280b806d1f871375d855800a574084c3d9 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Mon, 22 Jul 2019 11:46:57 -0500 Subject: [PATCH] Tracking for change events in citation-templates Bug: T221305 Change-Id: I4aa099ae1f7a6a2bb49b28c6d1452d077ffa61b7 --- modules/ve-cite/ve.ui.MWCitationDialog.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/ve-cite/ve.ui.MWCitationDialog.js b/modules/ve-cite/ve.ui.MWCitationDialog.js index f6e3e102c..43bd3e14c 100644 --- a/modules/ve-cite/ve.ui.MWCitationDialog.js +++ b/modules/ve-cite/ve.ui.MWCitationDialog.js @@ -85,6 +85,8 @@ ve.ui.MWCitationDialog.prototype.initialize = function ( data ) { // HACK: Use the same styling as single-mode transclusion dialog - this should be generalized this.$content.addClass( 've-ui-mwTransclusionDialog-single' ); + + this.$content.on( 'change', this.onInputChange.bind( this ) ); }; /** @@ -97,6 +99,8 @@ ve.ui.MWCitationDialog.prototype.getSetupProcess = function ( data ) { this.inDialog = data.inDialog; this.citationTemplate = data.template; this.citationTitle = data.title; + + this.trackedCitationInputChange = false; }, this ) .next( function () { this.updateTitle(); @@ -245,6 +249,18 @@ ve.ui.MWCitationDialog.prototype.getTeardownProcess = function ( data ) { }, this ); }; +/** + * Handle change events on the transclusion inputs + * + * @param {jQuery.Event} ev The browser event + */ +ve.ui.MWCitationDialog.prototype.onInputChange = function () { + if ( !this.trackedCitationInputChange ) { + ve.track( 'activity.' + this.constructor.static.name, { action: 'manual-template-input' } ); + this.trackedCitationInputChange = true; + } +}; + /* Registration */ ve.ui.windowFactory.register( ve.ui.MWCitationDialog );