jenkins-bot has submitted this change and it was merged.

Change subject: Allow inspectors to not show the delete button
......................................................................


Allow inspectors to not show the delete button

This functionality makes sense for annotations, but not for extensions.

Change-Id: I64fea941f8e01d0464eb9a045257f4810d789d60
---
M modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
M modules/ve/ui/ve.ui.Inspector.js
2 files changed, 24 insertions(+), 6 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
index 8367a18..563acd4 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
@@ -31,6 +31,8 @@
 
 ve.ui.MWExtensionInspector.static.nodeModel = null;
 
+ve.ui.MWExtensionInspector.static.removeable = false;
+
 /* Methods */
 
 /**
diff --git a/modules/ve/ui/ve.ui.Inspector.js b/modules/ve/ui/ve.ui.Inspector.js
index e56dc06..93f2082 100644
--- a/modules/ve/ui/ve.ui.Inspector.js
+++ b/modules/ve/ui/ve.ui.Inspector.js
@@ -35,6 +35,15 @@
 
 ve.ui.Inspector.static.titleMessage = 've-ui-inspector-title';
 
+/**
+ * The inspector comes with a remove button
+
+ * @static
+ * @inheritable
+ * @property {boolean}
+ */
+ve.ui.Inspector.static.removeable = true;
+
 /* Methods */
 
 /**
@@ -52,9 +61,11 @@
        this.closeButton = new ve.ui.IconButtonWidget( {
                '$$': this.$$, 'icon': 'previous', 'title': ve.msg( 
'visualeditor-inspector-close-tooltip' )
        } );
-       this.removeButton = new ve.ui.IconButtonWidget( {
-               '$$': this.$$, 'icon': 'remove', 'title': ve.msg( 
'visualeditor-inspector-remove-tooltip' )
-       } );
+       if ( this.constructor.static.removeable ) {
+               this.removeButton = new ve.ui.IconButtonWidget( {
+                       '$$': this.$$, 'icon': 'remove', 'title': ve.msg( 
'visualeditor-inspector-remove-tooltip' )
+               } );
+       }
 
        // Events
        this.$form.on( {
@@ -62,12 +73,17 @@
                'keydown': ve.bind( this.onFormKeyDown, this )
        } );
        this.closeButton.connect( this, { 'click': 'onCloseButtonClick' } );
-       this.removeButton.connect( this, { 'click': 'onRemoveButtonClick' } );
+       if ( this.constructor.static.removeable ) {
+               this.removeButton.connect( this, { 'click': 
'onRemoveButtonClick' } );
+       }
 
        // Initialization
        this.closeButton.$.addClass( 've-ui-inspector-closeButton' );
-       this.removeButton.$.addClass( 've-ui-inspector-removeButton' );
-       this.$head.prepend( this.closeButton.$ ).append( this.removeButton.$ );
+       this.$head.prepend( this.closeButton.$ );
+       if ( this.constructor.static.removeable ) {
+               this.removeButton.$.addClass( 've-ui-inspector-removeButton' );
+               this.$head.append( this.removeButton.$ );
+       }
        this.$body.append( this.$form );
 };
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I64fea941f8e01d0464eb9a045257f4810d789d60
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to