Commit f257176e authored by Evan Goldenberg's avatar Evan Goldenberg Committed by Francois Marier

usability: always show list of blogs, even if there is only one

Also, remove the "Add Blog" button from the view blog page, where it is
out of context. This simplifies the navigation of the blogging features
for user. Even when they only have one blog, being presented with a list
makes the ability to have more than one blog immediately apparent.
Signed-off-by: default avatarEvan Goldenberg <evang@catalyst.net.nz>
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent c352a1b8
...@@ -49,31 +49,6 @@ $blogs = (object) array( ...@@ -49,31 +49,6 @@ $blogs = (object) array(
list($blogs->count, $blogs->data) = ArtefactTypeBlog::get_blog_list($blogs->limit, $blogs->offset); list($blogs->count, $blogs->data) = ArtefactTypeBlog::get_blog_list($blogs->limit, $blogs->offset);
// If the user has exactly one blog, skip the blog listing and display it
if (!$delete && $blogs->offset == 0 && !empty($blogs->data) && count($blogs->data) == 1) {
define('TITLE', get_string('viewblog','artefact.blog'));
define('SECTION_PAGE', 'view');
$record = end($blogs->data);
$id = $record->id;
$blog = new ArtefactTypeBlog($id, $record);
// This javascript is used to generate a list of blog posts.
$js = '';
if ($blog->count_children()) {
$js = require(get_config('docroot') . 'artefact/blog/view/index.js.php');
}
$smarty = smarty(array('tablerenderer'));
$smarty->assign_by_ref('blog', $blog);
$smarty->assign_by_ref('INLINEJAVASCRIPT', $js);
$smarty->assign('PAGEHEADING', hsc($blog->get('title')));
$smarty->assign('strnopostsaddone',
get_string('nopostsaddone', 'artefact.blog',
'<a href="' . get_config('wwwroot') . 'artefact/blog/post.php?blog=' . $blog->get('id') . '">', '</a>'));
$smarty->display('artefact:blog:view.tpl');
exit;
}
define('TITLE', get_string('myblogs','artefact.blog')); define('TITLE', get_string('myblogs','artefact.blog'));
define('SECTION_PAGE', 'index'); define('SECTION_PAGE', 'index');
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<div class="rbuttons"> <div class="rbuttons">
<a class="btn btn-settings" href="{$WWWROOT}artefact/blog/settings/?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a> <a class="btn btn-settings" href="{$WWWROOT}artefact/blog/settings/?id={$blog->get('id')}">{str section="artefact.blog" tag="settings"}</a>
<a class="btn btn-new" href="{$WWWROOT}artefact/blog/new">{str tag=addblog section=artefact.blog}</a>
<a class="btn btn-add" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a> <a class="btn btn-add" href="{$WWWROOT}artefact/blog/post.php?blog={$blog->get('id')}">{str section="artefact.blog" tag="addpost"}</a>
</div> </div>
......
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