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

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 {
if (!safe_require_plugin('blocktype', $this->get('blocktype'))) {
return;
}
$smarty = smarty_core();
$classname = generate_class_name('blocktype', $this->get('blocktype'));
if (get_config('ajaxifyblocks') && call_static_method($classname, 'should_ajaxify')) {
$content = '';
$smarty->assign('loadbyajax', true);
}
else {
$smarty->assign('loadbyajax', false);
try {
$content = call_static_method($classname, 'render_instance', $this);
}
......@@ -915,7 +920,6 @@ class BlockInstance {
}
}
$smarty = smarty_core();
$smarty->assign('id', $this->get('id'));
$smarty->assign('blocktype', $this->get('blocktype'));
// hide the title if required and no content is present
......
......@@ -17,13 +17,13 @@
<span class="cb"></span>
</div>{/if}
<div id="blockinstance-content-{$id}" class="blockinstance-content{if $retractable && $retractedonload} js-hidden{/if}">
{if $content}
{$content|safe}
{else}
{if $loadbyajax}
<img src="{theme_image_url filename="loading"}" />
<script type="text/javascript">
jQuery("div#blockinstance-content-{$id}").load("{$WWWROOT}blocktype/blocktype.ajax.php?blockid={$id}");
</script>
{else}
{$content|safe}
{/if}
</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