diff --git a/ckan/public/base/javascript/main.js b/ckan/public/base/javascript/main.js index bb4fd41225d..7ad9c9250b5 100644 --- a/ckan/public/base/javascript/main.js +++ b/ckan/public/base/javascript/main.js @@ -78,6 +78,15 @@ this.ckan = this.ckan || {}; })(this.ckan, this.jQuery); +// Forces this to redraw in Internet Explorer 7 +// This is useful for when IE7 doesn't properly render parts of the page after +// some dom manipulation has happened +this.jQuery.fn.ie7redraw = function() { + if (jQuery.browser.msie && jQuery.browser.version == '7.0') { + jQuery(this).css('zoom', 1); + } +}; + // Temporary banner to let users on IE7 know that it may not display as // expected. (function showIEBanner() { diff --git a/ckan/public/base/javascript/modules/slug-preview.js b/ckan/public/base/javascript/modules/slug-preview.js index 9152d7ef5b2..2545daf6ee6 100644 --- a/ckan/public/base/javascript/modules/slug-preview.js +++ b/ckan/public/base/javascript/modules/slug-preview.js @@ -68,6 +68,20 @@ this.ckan.module('slug-preview-slug', function (jQuery, _) { }); sandbox.publish('slug-preview-created', preview[0]); + + // Horrible hack to make sure that IE7 rerenders the subsequent + // DOM children correctly now that we've render the slug preview element + // We should drop this horrible hack ASAP + if (jQuery.browser.msie && jQuery.browser.version == '7.0') { + jQuery('.btn').on('click', preview, function(){ + jQuery('.controls').ie7redraw(); + }); + preview.hide(); + setTimeout(function() { + preview.show(); + jQuery('.controls').ie7redraw(); + }, 10); + } } // Watch for updates to the target field and update the hidden slug field