Commit 29053d1b authored by Aaron Wells's avatar Aaron Wells
Browse files

Explicitly tell the template to use the AJAX block loader

Bug 1444229: It was hacky to rely on the block content being empty
to signal the AJAX block loader. We should tell it to do so explicitly.

Change-Id: I9816c43c96ffed85282ac0d874fa5bfe1ca62e00
parent aad93394
...@@ -894,11 +894,16 @@ class BlockInstance { ...@@ -894,11 +894,16 @@ class BlockInstance {
if (!safe_require_plugin('blocktype', $this->get('blocktype'))) { if (!safe_require_plugin('blocktype', $this->get('blocktype'))) {
return; return;
} }
$smarty = smarty_core();
$classname = generate_class_name('blocktype', $this->get('blocktype')); $classname = generate_class_name('blocktype', $this->get('blocktype'));
if (get_config('ajaxifyblocks') && call_static_method($classname, 'should_ajaxify')) { if (get_config('ajaxifyblocks') && call_static_method($classname, 'should_ajaxify')) {
$content = ''; $content = '';
$smarty->assign('loadbyajax', true);
} }
else { else {
$smarty->assign('loadbyajax', false);
try { try {
$content = call_static_method($classname, 'render_instance', $this); $content = call_static_method($classname, 'render_instance', $this);
} }
...@@ -915,7 +920,6 @@ class BlockInstance { ...@@ -915,7 +920,6 @@ class BlockInstance {
} }
} }
$smarty = smarty_core();
$smarty->assign('id', $this->get('id')); $smarty->assign('id', $this->get('id'));
$smarty->assign('blocktype', $this->get('blocktype')); $smarty->assign('blocktype', $this->get('blocktype'));
// hide the title if required and no content is present // hide the title if required and no content is present
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
<span class="cb"></span> <span class="cb"></span>
</div>{/if} </div>{/if}
<div id="blockinstance-content-{$id}" class="blockinstance-content{if $retractable && $retractedonload} js-hidden{/if}"> <div id="blockinstance-content-{$id}" class="blockinstance-content{if $retractable && $retractedonload} js-hidden{/if}">
{if $content} {if $loadbyajax}
{$content|safe}
{else}
<img src="{theme_image_url filename="loading"}" /> <img src="{theme_image_url filename="loading"}" />
<script type="text/javascript"> <script type="text/javascript">
jQuery("div#blockinstance-content-{$id}").load("{$WWWROOT}blocktype/blocktype.ajax.php?blockid={$id}"); jQuery("div#blockinstance-content-{$id}").load("{$WWWROOT}blocktype/blocktype.ajax.php?blockid={$id}");
</script> </script>
{else}
{$content|safe}
{/if} {/if}
</div> </div>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment