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