From b28a625f0ba0584218956cbf45c5789950d27f3b Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Fri, 11 May 2012 16:06:25 +1200 Subject: [PATCH 1/3] BUGFIX: clean up Chosen classess, so the cached panel can be rebuilt (os7304) There is no way to clean up attached Chosen instance in a nice way - there is no destroy, nor remove on the library. Also, we can't use the onunmatch on this entwine - it only triggers after the cache snapshot has been taken. This is because the cache function is on different namespace. --- admin/javascript/LeftAndMain.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 2a9d5b543..451e71631 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -489,6 +489,10 @@ jQuery.noConflict(); // Explicitly disable default placeholder if no custom one is defined if(!this.data('placeholder')) this.data('placeholder', ' '); + // We could've gotten stale classes and DOM elements from deferred cache. + this.removeClass('has-chzn chzn-done'); + this.siblings('.chzn-container').remove(); + // Apply Chosen applyChosen(this); From 905115b4dbdbccbbe146b3cbd73fe68d6997e611 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Fri, 11 May 2012 12:53:40 +1200 Subject: [PATCH 2/3] BUGFIX: Update the batch action select state also on load (os7304) This approach should cover more situations than the previous one. It will owrk regardless of the initial state in the HTML (which can be loaded from deferred cache). --- admin/javascript/LeftAndMain.BatchActions.js | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/admin/javascript/LeftAndMain.BatchActions.js b/admin/javascript/LeftAndMain.BatchActions.js index 625c619da..f49114265 100644 --- a/admin/javascript/LeftAndMain.BatchActions.js +++ b/admin/javascript/LeftAndMain.BatchActions.js @@ -43,7 +43,7 @@ tree.bind('check_node.jstree', function(e, data) { self.serializeFromTree(); }); - + $('.cms-tree-view-modes :input[name=view-mode]').bind('click', function(e) { var val = $(e.target).val(), dropdown = self.find(':input[name=Action]'); if(val == 'multiselect') { @@ -53,14 +53,26 @@ tree.removeClass('multiple'); } - // Batch actions only make sense when multiselect is enabled - if(val == 'multiselect') dropdown.removeAttr('disabled').change(); - else dropdown.attr('disabled', 'disabled').change(); + self._updateStateFromViewMode(); }); - + + self._updateStateFromViewMode(); + this._super(); }, + /** + * Updates the select box state according to the current view mode. + */ + _updateStateFromViewMode: function() { + var viewMode = $('.cms-tree-view-modes :input[name=view-mode]:checked').val(); + var dropdown = this.find(':input[name=Action]'); + + // Batch actions only make sense when multiselect is enabled. + if(viewMode == 'multiselect') dropdown.removeAttr('disabled').trigger("liszt:updated"); + else dropdown.attr('disabled', true).trigger("liszt:updated"); + }, + /** * Function: register * @@ -350,4 +362,4 @@ }); }); -})(jQuery); \ No newline at end of file +})(jQuery); From be06ae7e5f8f2d81756504075f6ae1a1977f6663 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Fri, 11 May 2012 10:11:10 +1200 Subject: [PATCH 3/3] MINOR: change the tree reorganisation message. --- admin/code/LeftAndMain.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index 9d64ab9d5..8a5895eee 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -805,7 +805,7 @@ class LeftAndMain extends Controller implements PermissionProvider { } } - $this->response->addHeader('X-Status', _t('LeftAndMain.SAVED','saved')); + $this->response->addHeader('X-Status', _t('LeftAndMain.REORGANISATIONSUCCESSFUL', 'Reorganised the site tree successfully.')); } // Update sorting @@ -826,7 +826,7 @@ class LeftAndMain extends Controller implements PermissionProvider { } } - $this->response->addHeader('X-Status', _t('LeftAndMain.SAVED','saved')); + $this->response->addHeader('X-Status', _t('LeftAndMain.REORGANISATIONSUCCESSFUL', 'Reorganised the site tree successfully.')); } return Convert::raw2json($statusUpdates);