From e70d060983c5fe9a9be88b453099710973678e51 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Sep 2007 00:48:48 +0000 Subject: [PATCH] elofgren: USABILITY: In 'Page Version History' left sidebar section, use a checkbox labeled 'Compare mode (click 2 below)' instead of a drop-down with only 'View (click to see)' and 'Compare (click 2 to see)' options. More info: http://www.elijahlofgren.com/silverstripe/inconsistent-go-buttons/ (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41845 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/SideTabs.js | 27 ++++++++++++++------------- templates/Includes/CMSMain_left.ss | 5 +---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/javascript/SideTabs.js b/javascript/SideTabs.js index fd4814cb..abc87a61 100755 --- a/javascript/SideTabs.js +++ b/javascript/SideTabs.js @@ -308,13 +308,14 @@ VersionAction = Class.create(); VersionAction.prototype = { initialize: function() { this.holder = $('versions_holder'); - this.selector = this.getElementsByTagName('select')[0]; - this.selector.holder = this; - this.selector.onchange = function() { this.holder.changed(this.value,this); return false; } this.showallCheckbox = $('versions_showall'); this.showallCheckbox.holder = this; this.showallCheckbox.onclick = this.showall_change; + + this.comparemodeCheckbox = $('versions_comparemode'); + this.comparemodeCheckbox.holder = this; + this.comparemodeCheckbox.onclick = function() { this.holder.comparemode_change(this.checked); } }, showall_change: function() { @@ -322,26 +323,26 @@ VersionAction.prototype = { }, destroy: function() { - if(this.selector) { - this.selector.holder = null; - this.selector.onchange = null; + if(this.comparemodeCheckbox) { + this.comparemodeCheckbox.holder = null; + this.comparemodeCheckbox.onclick = null; } if(this.showallCheckbox) { this.showallCheckbox.holder = null; this.showallCheckbox.onchange = null; } this.holder = null; - this.selector = null; + this.comparemodeCheckbox = null; }, /** - * Handler function whenever an action is clicked + * Handler function when comparemode checkbox is clicked */ - changed: function(url, selector) { - switch(url) { - case 'view': return this.view(); - case 'compare': return this.compare(); - default: errorMessage("VersionAction.changed: I don't know about action '" + url + "'"); + comparemode_change: function(isChecked) { + if (true == isChecked) { + return this.compare(); + } else { + return this.view(); } }, diff --git a/templates/Includes/CMSMain_left.ss b/templates/Includes/CMSMain_left.ss index f632e516..e5a248fb 100755 --- a/templates/Includes/CMSMain_left.ss +++ b/templates/Includes/CMSMain_left.ss @@ -103,10 +103,7 @@