Commit dfee04b0 authored by Robert Lyon's avatar Robert Lyon

Bug 1732848: Allow the taggedpost image url to include the view id

Because we are not using the normal generated html for rendering a
blog post we need to filter the description text so that any embedded
images include the view id

We also need to add the attachments html directly as well so need to
move that to it's own template

behatnotneeded

Change-Id: If6df01ec217610849108b599adfc04b81fd10b66
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 5baa9b69
......@@ -244,6 +244,15 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype {
if (!empty($rendered['javascript'])) {
$result->html .= '<script type="application/javascript">' . $rendered['javascript'] . '</script>';
}
$attachments = $rendered['attachments'];
if (!empty($attachments)) {
$smarty->assign('attachments', $attachments);
$smarty->assign('postid', $result->id);
$result->attachments = $smarty->fetch('artefact:blog:render/blogpost_renderattachments.tpl');
}
safe_require('artefact', 'file');
$result->description = ArtefactTypeFolder::append_view_url($result->description, $view);
}
}
......
......@@ -917,7 +917,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
$smarty->assign('updatedon', get_string('updatedon', 'artefact.blog') . ' ' . format_date($this->mtime));
}
return array('html' => $smarty->fetch('artefact:blog:render/blogpost_renderfull.tpl'),
'javascript' => '');
'javascript' => '',
'attachments' => $attachments);
}
......
......@@ -64,6 +64,10 @@
{$post->description|clean_html|safe}
</div>
{if $post->attachments}
{$post->attachments|safe}
{/if}
{if !$editing}
{if $post->commentcount != null}
<div class="comments clearfix">
......
<div class="has-attachment panel panel-default collapsible">
<h3 class="panel-heading">
<a class="text-left collapsed" aria-expanded="false" href="#blog-attach-{$postid}" data-toggle="collapse">
<span class="icon left icon-paperclip" role="presentation" aria-hidden="true"></span>
<span class="text-small">{str tag=attachedfiles section=artefact.blog}</span>
<span class="metadata">({$attachments|count})</span>
<span class="icon icon-chevron-down pull-right collapse-indicator" role="presentation" aria-hidden="true"></span>
</a>
</h3>
<!-- Attachment list with view and download link -->
<div id="blog-attach-{$postid}" class="collapse">
<ul class="list-unstyled list-group">
{foreach from=$attachments item=item}
<li class="list-group-item">
<a href="{$item->downloadpath}" class="outer-link icon-on-hover" {if $item->description} title="{$item->description}" data-toggle="tooltip"{/if}>
<span class="sr-only">
{str tag=Download section=artefact.file} {$item->title}
</span>
</a>
{if $item->iconpath}
<img class="file-icon" src="{$item->iconpath}" alt="">
{else}
<span class="icon icon-{$item->artefacttype} icon-lg text-default left" role="presentation" aria-hidden="true"></span>
{/if}
<span class="title list-group-item-heading inline">
<a href="{$item->viewpath}" class="inner-link">
{$item->title}
</a>
<span class="metadata"> -
[{$item->size|display_size}]
</span>
</span>
<span class="icon icon-download icon-lg pull-right text-watermark icon-action" role="presentation" aria-hidden="true"></span>
</li>
{/foreach}
</ul>
</div>
</div>
......@@ -39,48 +39,7 @@
{/if}
{if isset($attachments)}
<div class="has-attachment panel panel-default collapsible">
<h3 class="panel-heading">
<a class="text-left collapsed" aria-expanded="false" href="#blog-attach-{$postid}" data-toggle="collapse">
<span class="icon left icon-paperclip" role="presentation" aria-hidden="true"></span>
<span class="text-small">{str tag=attachedfiles section=artefact.blog}</span>
<span class="metadata">({$attachments|count})</span>
<span class="icon icon-chevron-down pull-right collapse-indicator" role="presentation" aria-hidden="true"></span>
</a>
</h3>
<!-- Attachment list with view and download link -->
<div id="blog-attach-{$postid}" class="collapse">
<ul class="list-unstyled list-group">
{foreach from=$attachments item=item}
<li class="list-group-item">
<a href="{$item->downloadpath}" class="outer-link icon-on-hover" {if $item->description} title="{$item->description}" data-toggle="tooltip"{/if}>
<span class="sr-only">
{str tag=Download section=artefact.file} {$item->title}
</span>
</a>
{if $item->iconpath}
<img class="file-icon" src="{$item->iconpath}" alt="">
{else}
<span class="icon icon-{$item->artefacttype} icon-lg text-default left" role="presentation" aria-hidden="true"></span>
{/if}
<span class="title list-group-item-heading inline">
<a href="{$item->viewpath}" class="inner-link">
{$item->title}
</a>
<span class="metadata"> -
[{$item->size|display_size}]
</span>
</span>
<span class="icon icon-download icon-lg pull-right text-watermark icon-action" role="presentation" aria-hidden="true"></span>
</li>
{/foreach}
</ul>
</div>
</div>
{include file="artefact:blog:render/blogpost_renderattachments.tpl" attachments=$attachments postid=$postid}
{/if}
</div>
{else}
......
<div class="has-attachment panel panel-default collapsible">
<h3 class="panel-heading">
<a class="text-left collapsed" aria-expanded="false" href="#blog-attach-{$postid}" data-toggle="collapse">
<span class="icon left icon-paperclip" role="presentation" aria-hidden="true"></span>
<span class="text-small">{str tag=attachedfiles section=artefact.blog}</span>
<span class="metadata">({$attachments|count})</span>
<span class="icon icon-chevron-down pull-right collapse-indicator" role="presentation" aria-hidden="true"></span>
</a>
</h3>
<!-- Attachment list with view and download link -->
<div id="blog-attach-{$postid}" class="collapse">
<ul class="list-unstyled list-group">
{foreach from=$attachments item=item}
<li class="list-group-item">
<a href="{$item->downloadpath}" class="outer-link icon-on-hover" {if $item->description} title="{$item->description}" data-toggle="tooltip"{/if}>
<span class="sr-only">
{str tag=Download section=artefact.file} {$item->title}
</span>
</a>
{if $item->iconpath}
<img class="file-icon" src="{$item->iconpath}" alt="">
{else}
<span class="icon icon-{$item->artefacttype} icon-lg text-default left" role="presentation" aria-hidden="true"></span>
{/if}
<span class="title list-group-item-heading inline">
<a href="{$item->viewpath}" class="inner-link">
{$item->title}
</a>
<span class="metadata"> -
[{$item->size|display_size}]
</span>
</span>
<span class="icon icon-download icon-lg pull-right text-watermark icon-action" role="presentation" aria-hidden="true"></span>
</li>
{/foreach}
</ul>
</div>
</div>
......@@ -39,48 +39,7 @@
{/if}
{if isset($attachments)}
<div class="has-attachment panel panel-default collapsible">
<h3 class="panel-heading">
<a class="text-left collapsed" aria-expanded="false" href="#blog-attach-{$postid}" data-toggle="collapse">
<span class="icon left icon-paperclip" role="presentation" aria-hidden="true"></span>
<span class="text-small">{str tag=attachedfiles section=artefact.blog}</span>
<span class="metadata">({$attachments|count})</span>
<span class="icon icon-chevron-down pull-right collapse-indicator" role="presentation" aria-hidden="true"></span>
</a>
</h3>
<!-- Attachment list with view and download link -->
<div id="blog-attach-{$postid}" class="collapse">
<ul class="list-unstyled list-group">
{foreach from=$attachments item=item}
<li class="list-group-item">
<a href="{$item->downloadpath}" class="outer-link icon-on-hover" {if $item->description} title="{$item->description}" data-toggle="tooltip"{/if}>
<span class="sr-only">
{str tag=Download section=artefact.file} {$item->title}
</span>
</a>
{if $item->iconpath}
<img class="file-icon" src="{$item->iconpath}" alt="">
{else}
<span class="icon icon-{$item->artefacttype} icon-lg text-default left" role="presentation" aria-hidden="true"></span>
{/if}
<span class="title list-group-item-heading inline">
<a href="{$item->viewpath}" class="inner-link">
{$item->title}
</a>
<span class="metadata"> -
[{$item->size|display_size}]
</span>
</span>
<span class="icon icon-download icon-lg pull-right text-watermark icon-action" role="presentation" aria-hidden="true"></span>
</li>
{/foreach}
</ul>
</div>
</div>
{include file="artefact:blog:render/blogpost_renderattachments.tpl" attachments=$attachments postid=$postid}
{/if}
</div>
{else}
......
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