Commit ef3a9547 authored by Alastair Pharo's avatar Alastair Pharo Committed by Alastair Pharo
Browse files

Some fixes for blog functionality. Blog posts can now render themselves

parent 705c8898
......@@ -154,7 +154,7 @@ class ArtefactTypeBlog extends ArtefactType {
}
/**
*
* This function adds the ability to render a blog as a list of posts
*/
public function render($format, $options) {
switch ($format) {
......@@ -181,6 +181,13 @@ class ArtefactTypeBlog extends ArtefactType {
}
public static function get_render_list() {
return array_merge(
array(
FORMAT_ARTEFACT_LISTCHILDREN,
FORMAT_ARTEFACT_RENDERFULL
),
parent::get_render_list()
);
}
public static function is_0_or_1() {
......@@ -332,6 +339,20 @@ class ArtefactTypeBlogPost extends ArtefactType {
}
public function render($format, $options) {
switch ($format) {
case FORMAT_ARTEFACT_LISTSELF:
$smarty = smarty();
$smarty->assign('arefact', $this);
return $smarty->fetch('artefact:blog:render/blogpost_listself.tpl');
case FORMAT_ARTEFACT_RENDERFULL:
$smarty = smarty();
$smarty->assign('arefact', $this);
return $smarty->fetch('artefact:blog:render/blogpost_renderfull.tpl');
default:
return parent::render($format, $options);
}
}
public function get_icon() {
......
......@@ -46,7 +46,11 @@ var bloglist = new TableRenderer(
A({'href':'{$wwwroot}artefact/blog/view/?id=' + r.id}, r.title)
);
},
'description'
function(r) {
var td = TD();
td.innerHTML = r.description;
return td;
}
]
);
......
{**
* This template displays a blog post.
*}
<div>
<span>{$artefact->get('title')|escape}</span>
<span>{$artefact->get('description')|escape}</span>
</div>
{**
* This template displays a blog post.
*}
<div>
<span>{$artefact->get('title')|escape}</span>
<span>{$artefact->get('description')|escape}</span>
</div>
......@@ -98,6 +98,9 @@ postlist.rowfunction = function(d, n, gd) {
{ 'type' : 'button' },
{$enc_delete}
);
var desctd = TD();
desctd.innerHTML = d.description;
var rows = [
TR(
......@@ -112,7 +115,7 @@ postlist.rowfunction = function(d, n, gd) {
del
)
),
TR(null, TD(null, d.description)),
TR(null, desctd),
TR(null, TD(null, d.ctime)),
];
......
......@@ -469,7 +469,6 @@ abstract class ArtefactType {
/**
* returns array of formats can render to (constants)
* @abstract
*/
public static function get_render_list() {
return array(
......
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