Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52921


Change subject: Emit apply and close dialog when apply changes is clicked.
......................................................................

Emit apply and close dialog when apply changes is clicked.

* Cleanup cancel button click binding.

Change-Id: I959a1b33e06a344a7946de8709f71f9c265a7604
---
M modules/ve/ui/ve.ui.Dialog.js
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/21/52921/1

diff --git a/modules/ve/ui/ve.ui.Dialog.js b/modules/ve/ui/ve.ui.Dialog.js
index faf881a..c1eecfd 100644
--- a/modules/ve/ui/ve.ui.Dialog.js
+++ b/modules/ve/ui/ve.ui.Dialog.js
@@ -18,7 +18,6 @@
        // Parent constructor
        ve.EventEmitter.call( this );
 
-       var dialog = this;
        // Properties
        this.surface = surface;
        this.visible = false;
@@ -26,15 +25,14 @@
 
        // Initialization
        this.cancelButton = new ve.ui.ButtonWidget( { 'label': ve.msg( 'cancel' 
) } );
-
-       //this.cancelButton.on( 'click', ve.bind( 
this.surface.target.closeDialog, this ) );
-       this.cancelButton.on( 'click', function() { 
dialog.surface.target.closeDialog(); } );
+       this.cancelButton.on( 'click', ve.bind( surface.target.closeDialog, 
surface.target ) );
 
        this.applyButton = new ve.ui.ButtonWidget( {
                'label': ve.msg( 'visualeditor-dialog-label-apply' ),
                'flags': ['constructive'],
                'disabled': false
        } );
+       this.applyButton.on( 'click', ve.bind( this.onApply, this ) );
 
        // Base elements
        this.$title = $( '<div class="ve-ui-dialog-title"></div>' ).text(
@@ -67,3 +65,8 @@
        this.$.hide();
        this.visible = false;
 };
+
+ve.ui.Dialog.prototype.onApply = function () {
+       this.emit( 'apply' );
+       this.surface.target.closeDialog();
+};

-- 
To view, visit https://gerrit.wikimedia.org/r/52921
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I959a1b33e06a344a7946de8709f71f9c265a7604
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to