r107689 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107688‎ | r107689 | r107690 >
Date:01:44, 31 December 2011
Author:neilk
Status:deferred (Comments)
Tags:
Comment:
when nothing to undo or redo, grey out appropriate buttons - fix bug #33112, based on patch from ashish.dubey91@gmail.com
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.ButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.HistoryButtonTool.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/tools/es.ButtonTool.js
@@ -39,6 +39,15 @@
4040 throw 'ButtonTool.onClick not implemented in this subclass:' + this.constructor;
4141 };
4242
 43+es.ButtonTool.prototype.updateEnabled = function() {
 44+ if ( this.enabled ) {
 45+ this.$.removeClass( 'es-toolbarButtonTool-disabled' );
 46+ } else {
 47+ this.$.addClass( 'es-toolbarButtonTool-disabled' );
 48+ }
 49+};
 50+
 51+
4352 /* Inheritance */
4453
45 -es.extendClass( es.ButtonTool, es.Tool );
\ No newline at end of file
 54+es.extendClass( es.ButtonTool, es.Tool );
Index: trunk/extensions/VisualEditor/modules/es/tools/es.HistoryButtonTool.js
@@ -13,6 +13,7 @@
1414
1515 // Properties
1616 this.data = data;
 17+ this.enabled = false;
1718 };
1819
1920 /* Methods */
@@ -29,9 +30,20 @@
3031 };
3132
3233 es.HistoryButtonTool.prototype.updateState = function( annotations ) {
33 - //
34 -};
 34+ var surfaceModel = this.toolbar.surfaceView.model;
 35+ switch( this.name ) {
 36+ case 'undo':
 37+ this.enabled = surfaceModel.bigStack.length - surfaceModel.undoIndex > 0;
 38+ break;
 39+ case 'redo':
 40+ this.enabled = surfaceModel.undoIndex > 0;
 41+ break;
 42+ }
3543
 44+ this.updateEnabled();
 45+}
 46+
 47+
3648 /* Registration */
3749
3850 es.Tool.tools.undo = {
Index: trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css
@@ -87,6 +87,11 @@
8888 .es-toolbarButtonTool-outdent:before {
8989 background-image: url(../images/outdent.png);
9090 }
 91+.es-toolbarButtonTool-disabled {
 92+ -moz-opacity: 0.25;
 93+ filter:alpha(opacity=25);
 94+ opacity: 0.25;
 95+}
9196 .es-toolbarButtonTool-disabled.es-toolbarButtonTool-clear:before,
9297 .es-toolbarButtonTool-disabled.es-toolbarButtonTool-indent:before,
9398 .es-toolbarButtonTool-disabled.es-toolbarButtonTool-outdent:before {

Comments

#Comment by Krinkle (talk | contribs)   00:14, 2 January 2012
+	-moz-opacity: 0.25;

This was last supported in Mozilla 1.7 (Firefox 0.9) and removed in Gecko 1.9.1 (Firefox 3.5), so we probably don't need that.

+	filter:alpha(opacity=25);

Is hasLayout already enforced by other means ? Otherwise we need a hack here to do so as filter declarations for IE don't work for elements without hasLayout (if I recall correctly)

#Comment by Krinkle (talk | contribs)   00:18, 2 January 2012

jQuery uses zoom: 1; to do so ([1]]

Status & tagging log