Commit 7d4b0b89 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix empty folder display for folder renderfull and listchildren

parent 0238d622
......@@ -514,22 +514,23 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
}
public function folder_contents() {
if ($children = get_records_array('artefact', 'parent', $this->get('id'))) {
return $children;
}
return array();
return get_records_array('artefact', 'parent', $this->get('id'));
}
public function render_full($options) {
$smarty = smarty();
$smarty->assign('artefact', $this);
$smarty->assign('children', $this->folder_contents());
if ($children = $this->folder_contents()) {
$smarty->assign('children', $children);
}
return $smarty->fetch('artefact:file:folder_renderfull.tpl');
}
public function listchildren($options) {
$smarty = smarty();
$smarty->assign('children', $this->folder_contents());
if ($children = $this->folder_contents()) {
$smarty->assign('children', $children);
}
return $smarty->fetch('artefact:file:folder_listchildren.tpl');
}
......
<div>
{if empty($children)}
{str tag=emptyfolder section=artefact.file}
{else}
{if isset($children)}
<table>
<tbody>
{foreach from=$children item=child}
<tr class="{cycle values=r1,r0}"><td>{$child->title}</td><td>{$child->description}</td></tr>
{/foreach}
</tbody></table>
{else}
{str tag=emptyfolder section=artefact.file}
{/if}
</div>
......@@ -10,6 +10,8 @@
<tr class="{cycle values=r1,r0}"><td>{$child->title}</td><td>{$child->description}</td></tr>
{/foreach}
</tbody></table>
{else}
{str tag=emptyfolder section=artefact.file}
{/if}
</div>
</div>
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