Commit 69b4e7f0 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Commentlist fullwidth WIP (Bug #1465107)"

parents f62b040e 1801a17e
......@@ -72,6 +72,7 @@ class PluginBlocktypeComment extends SystemBlocktype {
$commentoptions->offset = $offset;
$commentoptions->showcomment = $showcomment;
$commentoptions->view = $instance->get_view();
$commentoptions->artefactview = true;
$feedback = ArtefactTypeComment::get_comments($commentoptions);
$smarty = smarty_core();
$smarty->assign('feedback', $feedback);
......
......@@ -341,6 +341,7 @@ class ArtefactTypeComment extends ArtefactType {
$options->artefact = null;
$options->export = false;
$options->onview = false;
$options->artefactview = false;
$sortorder = get_user_institution_comment_sort_order();
$options->sort = (!empty($sortorder)) ? $sortorder : 'earliest';
return $options;
......@@ -456,13 +457,14 @@ class ArtefactTypeComment extends ArtefactType {
// check to see if the feedback is to be displayed in a block instance
// or the base of the page
$result->position = 'base';
$blocks = get_records_array('block_instance', 'view', $viewid);
if (!empty($blocks)) {
if (is_array($blocks)) {
foreach ($blocks as $block) {
if ($block->blocktype == 'comment') {
if ($options->artefactview === true) {
$result->position = 'blockinstance';
break;
}
else {
$result->position = 'base';
}
}
}
......@@ -534,6 +536,7 @@ class ArtefactTypeComment extends ArtefactType {
$commentoptions->view = $view;
$commentoptions->artefact = $artefact;
$commentoptions->onview = true;
$commentoptions->artefactview = true;
$comments = ArtefactTypeComment::get_comments($commentoptions);
$commentcount = isset($comments->count) ? $comments->count : 0;
......@@ -701,10 +704,12 @@ class ArtefactTypeComment extends ArtefactType {
$smarty = smarty_core();
$smarty->assign_by_ref('data', $data->data);
$smarty->assign('canedit', $data->canedit);
$smarty->assign('viewid', $data->view);
$smarty->assign('position', $data->position);
$smarty->assign('viewid', $data->view);
$smarty->assign('baseurl', $data->baseurl);
$smarty->assign('onview', $onview);
$data->tablerows = $smarty->fetch('artefact:comment:commentlist.tpl');
$pagination = build_pagination(array(
'id' => 'feedback_pagination',
......
<div class="list-group list-group-lite">
{foreach from=$data item=item}
<div class="list-group-item {if $item->pubmessage}list-group-item-warning{elseif $item->deletedmessage}deleted {/if} {cycle name=rows values='r0,r1'}">
<div class="clearfix list-group-item {if $item->pubmessage}list-group-item-warning{elseif $item->deletedmessage}deleted {/if} {cycle name=rows values='r0,r1'}">
{if $position == 'base'}<div class="pull-left" style="width: 70%;">{/if}
<div class="comment-heading clearfix">
<span class="user-icon small-icon pull-left mls mts mrm">
{if $item->author}
......@@ -85,20 +85,30 @@
{/if}
</div>
{/if}
{if $position == 'base'}</div>{/if}
{if !$item->deletedmessage && $item->attachments}
<div class="has-attachment panel panel-default collapsible">
{if $item->attachmessage}
<em class="attachmessage metadata"> - {$item->attachmessage}</em>
{/if}
<div class="panel panel-default {if $position == 'base'}pull-right{elseif $position == 'blockinstance'}has-attachment collapsible{/if}">
<h4 class="panel-heading">
<a class="collapsible collapsed" aria-expanded="false" href="#attachments_{$item->id}" data-toggle="collapse">
{if $position == 'base'}
<span class="icon prm icon-paperclip"></span>
<span class="text-small">{str tag=Attachments section=artefact.comment}</span>
<span class="icon icon-chevron-down pull-right collapse-indicator"></span>
{if $item->attachmessage}
<em class="attachmessage metadata"> - {$item->attachmessage}</em>
{/if}
</a>
{elseif $position == 'blockinstance'}
<a class="collapsible collapsed" aria-expanded="false" href="#attachments_{$item->id}" data-toggle="collapse">
<span class="icon prm icon-paperclip"></span>
<span class="text-small">{str tag=Attachments section=artefact.comment}</span>
<span class="icon icon-chevron-down pull-right collapse-indicator"></span>
</a>
{/if}
</h4>
<div id="attachments_{$item->id}" class="collapse" aria-expanded="false">
{if $position == 'base'}
<div id="attachments_{$item->id}" class="panel-body">
{elseif $position == 'blockinstance'}
<div id="attachments_{$item->id}" class="collapse" aria-expanded="false">
{/if}
<ul class=" list-group list-group-unbordered mb0">
{strip}
{foreach $item->attachments item=a name=attachments}
......
{include file="header.tpl"}
<p>{$strdescription}</p>
<p clas="lead">{$strdescription}</p>
{$form|safe}
{include file="footer.tpl"}
Supports Markdown
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