Commit 8266dbe2 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Let blog block attachments expander work again (Bug #1424512)"

parents 6d1bb3d8 150aa10b
......@@ -49,6 +49,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
$configdata['hidetitle'] = true;
$configdata['countcomments'] = true;
$configdata['viewid'] = $instance->get('view');
$configdata['blockid'] = $instance->get('id');
$result = $artefact->render_self($configdata);
$result = $result['html'];
require_once(get_config('docroot') . 'artefact/comment/lib.php');
......
......@@ -233,7 +233,7 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
$result->taglist[] = $t->tag;
}
if ($full) {
$rendered = $artefact->render_self(array('viewid' => $view, 'details' => true));
$rendered = $artefact->render_self(array('viewid' => $view, 'details' => true, 'blockid' => $instance->get('id')));
$result->html = $rendered['html'];
if (!empty($rendered['javascript'])) {
$result->html .= '<script type="application/javascript">' . $rendered['javascript'] . '</script>';
......
......@@ -686,6 +686,10 @@ class ArtefactTypeBlogPost extends ArtefactType {
}
}
$smarty->assign('attachments', $attachments);
if (isset($options['blockid'])) {
$smarty->assign('blockid', $options['blockid']);
}
$smarty->assign('postid', $this->get('id'));
}
$smarty->assign('postedbyon', get_string('postedbyon', 'artefact.blog',
display_name($this->owner),
......
......@@ -8,7 +8,7 @@
{$artefactdescription|clean_html|safe}
{if isset($attachments)}
{if $artefacttags}<div class="tags">{str tag=tags}: {list_tags owner=$artefactowner tags=$artefacttags}</div>{/if}
<table class="cb attachments fullwidth">
<table class="cb attachments fullwidth" id="blockinstance-attachments-{$postid}{if $blockid}-{$blockid}{/if}">
<thead class="expandable-head">
<tr>
<td colspan="2">
......@@ -39,6 +39,9 @@
</div>
{/if}
</div>
<script type="application/javascript">
setupExpanders($j('#blockinstance-attachments-{$postid}-{$blockid}'));
</script>
{else}
<div>
{$notpublishedblogpost|safe}
......
......@@ -7,7 +7,7 @@
<div class="tags">{str tag=tags}: {list_tags owner=$post->owner tags=$post->tags}</div>
{/if}</div>
{if $post->files}
<table class="cb attachments fullwidth">
<table class="cb attachments fullwidth" id="blockinstance-attachments-{$post->id}-{$options.blockid}">
<thead class="expandable-head">
<tr>
<td colspan="2">
......@@ -57,4 +57,7 @@
</div>
{/if}
</div>
<script type="application/javascript">
setupExpanders($j('#blockinstance-attachments-{$post->id}-{$options.blockid}'));
</script>
{/foreach}
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