From 1261ad4b3de02c405e1e90a38869f6940ff661a2 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 2 Jul 2014 18:00:58 -0700 Subject: [PATCH] Followup 26fd3777: hide "Go back" in insertion mode "Go back" should only be shown if there's something to go back to. So it should be visible if you came from "Change image", but not if you came from "Insert media". If the "Go back" button is hidden, the footer is empty, so hide it completely in that case. Hiding the footer is tricky due to how dialogs position things, so I hacked around OO.ui.Dialog's lack of an API for toggling the visibility of the footer. Change-Id: Ic97c4a2bf7beaa240e5a4dfda1e605752e1f4189 --- modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index 013d96362d..9201c5eb3b 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -630,6 +630,10 @@ ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel ) { this.changeImageButton.$element.show(); this.goBackButton.$element.hide(); this.applyButton.$element.show(); + // Show the foot in case it was hidden before + this.$foot.show(); + // HACK: OO.ui.Dialog needs an API for this + this.frame.$content.removeClass( 'oo-ui-dialog-content-footless' ); // Hide/show the panels this.bookletLayout.$element.show(); this.mediaSearchPanel.$element.hide(); @@ -666,8 +670,13 @@ ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel ) { this.panels.setItem( this.mediaSearchPanel ); // Hide/show buttons this.changeImageButton.$element.hide(); - this.goBackButton.$element.show(); this.applyButton.$element.hide(); + // In insertion mode, hide the foot; in non-insertion mode, show "Go back" + this.goBackButton.$element.toggle( !!this.imageModel ); + this.$foot.toggle( !!this.imageModel ); + // HACK: OO.ui.Dialog needs an API for this + this.frame.$content.toggleClass( 'oo-ui-dialog-content-footless', !this.imageModel ); + // Hide/show the panels this.bookletLayout.$element.hide(); this.mediaSearchPanel.$element.show();