Commit 36cb264f authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review

Merge "Explicitly tell the template to use the AJAX block loader"

parents c8ed0816 29053d1b
......@@ -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