Commit f7431a3a authored by Lisa Seeto's avatar Lisa Seeto

Bug 1827811: Journal changes

Journal changes:
Change the modal contents to not show post contents or attached files.
Recent posts and Tagged posts (if not in full display) now expandable with post contents and comment links.
Attached files on page block now links only to download and not to display further metadata.
Cleaned up artefact.php links.
remove metada that will show on entry on page from also showing in modal
stop background page scrolling when the modal is opened and "Advanced licensing" is selected.
add the blogpost_render_in_modal.tpl file
get rid of scrolling for data-toggle collapse
add block-header to journal, journal entry
add titles as modal links for recent posts and tagged journal entries
add comments and details icons for recent posts and tagged journal entries
fix things from code review

behatnotneeded

Change-Id: Ic63ebf9fe42e7848559b5e009584fdff0a40770f
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent be7af61f
...@@ -54,7 +54,7 @@ if (!empty($ancestors)) { ...@@ -54,7 +54,7 @@ if (!empty($ancestors)) {
$pathitem = artefact_instance_from_id($ancestor); $pathitem = artefact_instance_from_id($ancestor);
if (artefact_in_view($pathitem, $viewid)) { if (artefact_in_view($pathitem, $viewid)) {
$artefactpath[] = array( $artefactpath[] = array(
'url' => get_config('wwwroot') . 'view/view.php?id=' . $viewid, 'url' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $pathitem->get('id') ,
'title' => $pathitem->display_title(), 'title' => $pathitem->display_title(),
); );
$artefactok = true; $artefactok = true;
......
...@@ -98,8 +98,7 @@ else { ...@@ -98,8 +98,7 @@ else {
'name' => implode(' ', array($owner[0]->firstname, $owner[0]->lastname)), 'name' => implode(' ', array($owner[0]->firstname, $owner[0]->lastname)),
'uri' => sanitize_url($personal_site), 'uri' => sanitize_url($personal_site),
); );
$link = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $link = get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $artefactid;
$artefactid . '&view=' . $viewid;
$selflink = get_config('wwwroot') . 'artefact/blog/atom.php?artefact=' . $selflink = get_config('wwwroot') . 'artefact/blog/atom.php?artefact=' .
$artefactid . '&view=' . $viewid; $artefactid . '&view=' . $viewid;
...@@ -176,8 +175,7 @@ else { ...@@ -176,8 +175,7 @@ else {
} }
$posts[] = array( $posts[] = array(
'title' => $post->get('title'), 'title' => $post->get('title'),
'link' => get_config('wwwroot') . 'artefact/artefact.php?artefact=' . 'link' => get_config('wwwroot') . 'view/view.php?id=' . $viewid . '&modal=1&artefact=' . $post->get('id'),
$post->get('id') . '&view=' . $viewid,
'id' => implode(',', array(get_config('wwwroot'), $post->get('id'), $viewid)), 'id' => implode(',', array(get_config('wwwroot'), $post->get('id'), $viewid)),
'description' => $post->get('description'), 'description' => $post->get('description'),
'mtime' => atom_date($postid->mtime), 'mtime' => atom_date($postid->mtime),
......
...@@ -88,8 +88,7 @@ class PluginBlocktypeBlog extends MaharaCoreBlocktype { ...@@ -88,8 +88,7 @@ class PluginBlocktypeBlog extends MaharaCoreBlocktype {
$smarty = smarty_core(); $smarty = smarty_core();
if (isset($configdata['viewid'])) { if (isset($configdata['viewid'])) {
$artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $blog->get('id') . '&view=' $artefacturl = get_config('wwwroot') . 'view/view.php?id=' . $configdata['viewid'] . '&modal=1&artefact= ' . $blog->get('id');
. $configdata['viewid'];
$smarty->assign('artefacttitle', '<a href="' . $artefacturl . '">' . hsc($blog->get('title')) . '</a>'); $smarty->assign('artefacttitle', '<a href="' . $artefacturl . '">' . hsc($blog->get('title')) . '</a>');
if ($exporter && $posts['count'] > $limit) { if ($exporter && $posts['count'] > $limit) {
$posts['pagination'] = '<a href="' . $artefacturl . '">' $posts['pagination'] = '<a href="' . $artefacturl . '">'
......
...@@ -43,26 +43,28 @@ class PluginBlocktypeBlogpost extends MaharaCoreBlocktype { ...@@ -43,26 +43,28 @@ class PluginBlocktypeBlogpost extends MaharaCoreBlocktype {
$result = ''; $result = '';
$artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null; $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
$smarty = smarty_core();
if ($artefactid) { if ($artefactid) {
require_once(get_config('docroot') . 'artefact/lib.php'); require_once(get_config('docroot') . 'artefact/lib.php');
$artefact = $instance->get_artefact_instance($artefactid); $artefact = $instance->get_artefact_instance($artefactid);
$smarty->assign('artefactid', $artefactid);
$configdata['hidetitle'] = true; $configdata['hidetitle'] = true;
$configdata['countcomments'] = true; $configdata['countcomments'] = true;
$configdata['viewid'] = $instance->get('view'); $configdata['viewid'] = $instance->get('view');
$configdata['blockid'] = $instance->get('id'); $configdata['blockid'] = $instance->get('id');
$configdata['editing'] = $editing;
$result = $artefact->render_self($configdata); $result = $artefact->render_self($configdata);
$result = $result['html']; $result = $result['html'];
require_once(get_config('docroot') . 'artefact/comment/lib.php'); require_once(get_config('docroot') . 'artefact/comment/lib.php');
require_once(get_config('docroot') . 'lib/view.php'); require_once(get_config('docroot') . 'lib/view.php');
$view = new View($configdata['viewid']); $view = new View($configdata['viewid']);
list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing, $versioning); list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing, $versioning);
}
$smarty = smarty_core();
if ($artefactid) {
$smarty->assign('commentcount', $commentcount); $smarty->assign('commentcount', $commentcount);
$smarty->assign('comments', $comments); $smarty->assign('allowcomments', $artefact->get('allowcomments'));
} }
$smarty->assign('editing', $editing);
$smarty->assign('blockid', $instance->get('id'));
$smarty->assign('html', $result); $smarty->assign('html', $result);
return $smarty->fetch('blocktype:blogpost:blogpost.tpl'); return $smarty->fetch('blocktype:blogpost:blogpost.tpl');
} }
......
...@@ -90,7 +90,7 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype { ...@@ -90,7 +90,7 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
$blogids = $configdata['artefactids']; $blogids = $configdata['artefactids'];
$artefactids = implode(', ', array_map('db_quote', $blogids)); $artefactids = implode(', ', array_map('db_quote', $blogids));
$mostrecent = get_records_sql_array( $mostrecent = get_records_sql_array(
'SELECT a.title, ' . db_format_tsfield('a.ctime', 'ctime') . ', p.title AS parenttitle, a.id, a.parent, ' . db_format_tsfield('a.mtime', 'mtime') . ' 'SELECT a.title, a.description, a.allowcomments, ' . db_format_tsfield('a.ctime', 'ctime') . ', p.title AS parenttitle, a.id, a.parent, ' . db_format_tsfield('a.mtime', 'mtime') . '
FROM {artefact} a FROM {artefact} a
JOIN {artefact} p ON a.parent = p.id JOIN {artefact} p ON a.parent = p.id
JOIN {artefact_blog_blogpost} ab ON (ab.blogpost = a.id AND ab.published = 1) JOIN {artefact_blog_blogpost} ab ON (ab.blogpost = a.id AND ab.published = 1)
...@@ -122,6 +122,11 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype { ...@@ -122,6 +122,11 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
} }
$blog = new ArtefactTypeBlog($data->parent); $blog = new ArtefactTypeBlog($data->parent);
$data->parenttitle = $blog->display_title(); $data->parenttitle = $blog->display_title();
$data->commentcount = count_records_select('artefact_comment_comment', "onartefact = ? AND private = ? AND deletedby IS NULL AND hidden= ?", array($data->id, 0, 0));
if ($tags = ArtefactType::artefact_get_tags($data->id)) {
$data->tags = $tags;
}
$data->owner = $blog->get('owner');
} }
$smarty = smarty_core(); $smarty = smarty_core();
...@@ -129,6 +134,9 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype { ...@@ -129,6 +134,9 @@ class PluginBlocktypeRecentposts extends MaharaCoreBlocktype {
$smarty->assign('view', $instance->get('view')); $smarty->assign('view', $instance->get('view'));
$smarty->assign('blockid', $instance->get('id')); $smarty->assign('blockid', $instance->get('id'));
$smarty->assign('editing', $editing); $smarty->assign('editing', $editing);
$smarty->assign('licensemetadata', get_config('licensemetadata') ? true : false);
$smarty->assign('canviewblog', $data->owner == $USER->get('id'));
if ($editing) { if ($editing) {
// Get id and title of configued blogs // Get id and title of configued blogs
$recentpostconfigdata = $instance->get('configdata'); $recentpostconfigdata = $instance->get('configdata');
......
...@@ -184,6 +184,7 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype { ...@@ -184,6 +184,7 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype {
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('view', $view); $smarty->assign('view', $view);
$smarty->assign('licensemetadata', get_config('licensemetadata') ? true : false);
$viewownerdisplay = null; $viewownerdisplay = null;
// Display all posts, from all blogs, owned by this user // Display all posts, from all blogs, owned by this user
$tagsin = $tagsout = array(); $tagsin = $tagsout = array();
...@@ -234,6 +235,7 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype { ...@@ -234,6 +235,7 @@ class PluginBlocktypeTaggedposts extends MaharaCoreBlocktype {
// get comments for this post // get comments for this post
$result->commentcount = count_records_select('artefact_comment_comment', "onartefact = {$result->id} AND private = 0 AND deletedby IS NULL AND hidden=0"); $result->commentcount = count_records_select('artefact_comment_comment', "onartefact = {$result->id} AND private = 0 AND deletedby IS NULL AND hidden=0");
$allowcomments = $artefact->get('allowcomments'); $allowcomments = $artefact->get('allowcomments');
$smarty->assign('allowcomments', $allowcomments);
if (empty($result->commentcount) && empty($allowcomments)) { if (empty($result->commentcount) && empty($allowcomments)) {
$result->commentcount = null; $result->commentcount = null;
} }
......
...@@ -101,7 +101,9 @@ $string['postbodydesc'] = ' '; ...@@ -101,7 +101,9 @@ $string['postbodydesc'] = ' ';
$string['postedon'] = 'Posted on'; $string['postedon'] = 'Posted on';
$string['updatedon'] = 'Last updated'; $string['updatedon'] = 'Last updated';
$string['postedbyon'] = 'Posted by %s on %s'; $string['postedbyon'] = 'Posted by %s on %s';
$string['postedby'] = 'Posted by';
$string['posttitle'] = 'Title'; $string['posttitle'] = 'Title';
$string['createdin'] = 'Created in';
$string['posts'] = 'entries'; $string['posts'] = 'entries';
$string['nposts'] = array( $string['nposts'] = array(
'1 entry', '1 entry',
......
...@@ -343,28 +343,20 @@ class ArtefactTypeBlog extends ArtefactType { ...@@ -343,28 +343,20 @@ class ArtefactTypeBlog extends ArtefactType {
$template = 'artefact:blog:viewposts.tpl'; $template = 'artefact:blog:viewposts.tpl';
$baseurl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $this->id;
if (!empty($options['viewid'])) {
$baseurl .= '&view=' . $options['viewid'];
}
$pagination = array( $pagination = array(
'baseurl' => $baseurl, //baseurl will be set in the jsonscript
'baseurl' => '',
'id' => 'blogpost_pagination', 'id' => 'blogpost_pagination',
'datatable' => 'postlist', 'datatable' => 'postlist',
'jsonscript' => 'artefact/blog/posts.json.php', 'jsonscript' => 'artefact/blog/posts.json.php',
); );
ArtefactTypeBlogpost::render_posts($posts, $template, $options, $pagination); ArtefactTypeBlogpost::render_posts($posts, $template, $options, $pagination);
$smarty = smarty_core(); $smarty = smarty_core();
if (isset($options['viewid'])) { if (isset($options['viewid'])) {
$smarty->assign('artefacttitle', '<a href="' . get_config('wwwroot') . 'artefact/artefact.php?artefact='
. $this->get('id') . '&view=' . $options['viewid']
. '">' . hsc($this->get('title')) . '</a>');
$smarty->assign('view', $options['viewid']); $smarty->assign('view', $options['viewid']);
} }
else { else {
$smarty->assign('artefacttitle', hsc($this->get('title')));
$smarty->assign('view', null); $smarty->assign('view', null);
} }
...@@ -873,19 +865,8 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -873,19 +865,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
} }
$smarty->assign('notpublishedblogpost', $notpublishedblogpoststr); $smarty->assign('notpublishedblogpost', $notpublishedblogpoststr);
} }
$artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $this->get('id'); $smarty->assign('artefacttitle', hsc($this->get('title')));
if (isset($options['viewid'])) {
$artefacturl .= '&view=' . $options['viewid'];
}
$smarty->assign('artefacturl', $artefacturl);
if (empty($options['hidetitle'])) {
if (isset($options['viewid'])) {
$smarty->assign('artefacttitle', '<a href="' . $artefacturl . '">' . hsc($this->get('title')) . '</a>');
}
else {
$smarty->assign('artefacttitle', hsc($this->get('title')));
}
}
// We need to make sure that the images in the post have the right viewid associated with them // We need to make sure that the images in the post have the right viewid associated with them
$postcontent = $this->get('description'); $postcontent = $this->get('description');
...@@ -903,6 +884,9 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -903,6 +884,9 @@ class ArtefactTypeBlogPost extends ArtefactType {
else { else {
$smarty->assign('license', false); $smarty->assign('license', false);
} }
$smarty->assign('commentsallowed', $this->get('allowcomments'));
$smarty->assign('licensemetadata', get_config('licensemetadata') ? true : false);
$smarty->assign('editing', isset($options['editing']) ? $options['editing'] : false);
$attachments = $this->get_attachments(); $attachments = $this->get_attachments();
if ($attachments) { if ($attachments) {
...@@ -911,7 +895,6 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -911,7 +895,6 @@ class ArtefactTypeBlogPost extends ArtefactType {
$f = artefact_instance_from_id($attachment->id); $f = artefact_instance_from_id($attachment->id);
$attachment->size = $f->describe_size(); $attachment->size = $f->describe_size();
$attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0)); $attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0));
$attachment->viewpath = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $attachment->id . '&view=' . (isset($options['viewid']) ? $options['viewid'] : 0);
$attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id; $attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id;
if (isset($options['viewid'])) { if (isset($options['viewid'])) {
$attachment->downloadpath .= '&view=' . $options['viewid']; $attachment->downloadpath .= '&view=' . $options['viewid'];
...@@ -928,7 +911,25 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -928,7 +911,25 @@ class ArtefactTypeBlogPost extends ArtefactType {
if ($this->ctime != $this->mtime) { if ($this->ctime != $this->mtime) {
$smarty->assign('updatedon', get_string('updatedon', 'artefact.blog') . ' ' . format_date($this->mtime)); $smarty->assign('updatedon', get_string('updatedon', 'artefact.blog') . ' ' . format_date($this->mtime));
} }
return array('html' => $smarty->fetch('artefact:blog:render/blogpost_renderfull.tpl'),
if (!empty($options['modal'])) {
if ($parent = artefact_instance_from_id($this->get('parent'))) {
$smarty->assign('parentblogtitle', $parent->get('title'));
}
if ($this->get('owner') != $USER->get('id')) {
$smarty->assign('postedby', $by);
}
$smarty->assign('postedon', format_date($this->ctime));
if ($this->ctime != $this->mtime) {
$smarty->assign('lastmodifieddate', format_date($this->mtime));
}
if (isset($options['viewid'])) {
$smarty->assign('view', $options['viewid']);
}
}
$template = empty($options['modal']) ? 'artefact:blog:render/blogpost_renderfull.tpl' : 'artefact:blog:render/blogpost_render_in_modal.tpl';
return array('html' => $smarty->fetch($template),
'javascript' => '', 'javascript' => '',
'attachments' => $attachments); 'attachments' => $attachments);
} }
...@@ -1083,6 +1084,7 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -1083,6 +1084,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
require_once(get_config('docroot') . 'lib/view.php'); require_once(get_config('docroot') . 'lib/view.php');
$view = new View($viewoptions['viewid']); $view = new View($viewoptions['viewid']);
$artefact = artefact_instance_from_id($post->id); $artefact = artefact_instance_from_id($post->id);
if (!isset ($viewoptions['versioning'])) { if (!isset ($viewoptions['versioning'])) {
$viewoptions['versioning'] = false; $viewoptions['versioning'] = false;
} }
...@@ -1129,6 +1131,8 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -1129,6 +1131,8 @@ class ArtefactTypeBlogPost extends ArtefactType {
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('options', $options); $smarty->assign('options', $options);
$smarty->assign('posts', $posts['data']); $smarty->assign('posts', $posts['data']);
$smarty->assign('modal', (isset($options['modal']) ? $options['modal'] : false));
$smarty->assign('license', get_config('licensemetadata') ? true : false);
$posts['tablerows'] = $smarty->fetch($template); $posts['tablerows'] = $smarty->fetch($template);
......
...@@ -43,31 +43,5 @@ if ($blockid = param_integer('block', null)) { ...@@ -43,31 +43,5 @@ if ($blockid = param_integer('block', null)) {
); );
ArtefactTypeBlogpost::render_posts($posts, $template, $configdata, $pagination); ArtefactTypeBlogpost::render_posts($posts, $template, $configdata, $pagination);
} }
else {
// No block, we're just rendering the blog by itself.
$limit = param_integer('limit', ArtefactTypeBlog::pagination);
$blogid = param_integer('artefact');
$viewid = param_integer('view');
if (!can_view_view($viewid)) {
json_reply(true, get_string('accessdenied', 'error'));
}
$options = array(
'viewid' => $viewid,
'countcomments' => true,
);
$posts = ArtefactTypeBlogpost::get_posts($blogid, $limit, $offset, $options);
$template = 'artefact:blog:viewposts.tpl';
$baseurl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $blogid . '&view=' . $viewid;
$pagination = array(
'baseurl' => $baseurl,
'id' => 'blogpost_pagination',
'datatable' => 'postlist',
'jsonscript' => 'artefact/blog/posts.json.php',
);
ArtefactTypeBlogpost::render_posts($posts, $template, $options, $pagination);
}
json_reply(false, array('data' => $posts)); json_reply(false, array('data' => $posts));
...@@ -1608,7 +1608,7 @@ function delete_comment_submit(Pieform $form, $values) { ...@@ -1608,7 +1608,7 @@ function delete_comment_submit(Pieform $form, $values) {
$commentoptions->artefact = $artefact; $commentoptions->artefact = $artefact;
$commentoptions->blockid = $blockid; $commentoptions->blockid = $blockid;
if (isset($values['threaded'])) { if (isset($values['threaded'])) {
$commentoptions->threaded = $values['threaded']; $commentoptions->threaded = $values['threaded'];
} }
$newlist = ArtefactTypeComment::get_comments($commentoptions); $newlist = ArtefactTypeComment::get_comments($commentoptions);
......
...@@ -1403,7 +1403,7 @@ class BlockInstance { ...@@ -1403,7 +1403,7 @@ class BlockInstance {
$artefact = $this->get_artefact_instance($configdata['artefactid']); $artefact = $this->get_artefact_instance($configdata['artefactid']);
$smarty->assign('allowcomments', $artefact->get('allowcomments')); $smarty->assign('allowcomments', $artefact->get('allowcomments'));
if (!$artefact->get('allowcomments')) { if (!$artefact->get('allowcomments')) {
$smarty->assign('allowdetails', (int)get_config('licensemetadata')); $smarty->assign('justdetails', (int)get_config('licensemetadata'));
} }
else { else {
$commentoptions = ArtefactTypeComment::get_comment_options(); $commentoptions = ArtefactTypeComment::get_comment_options();
......
...@@ -1227,7 +1227,9 @@ $(function() { ...@@ -1227,7 +1227,9 @@ $(function() {
jQuery(function($) { jQuery(function($) {
$(document).on('click', 'a', function(event) { $(document).on('click', 'a', function(event) {
if ($(this.hash).length && location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && if ($(this.hash).length && location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
!$(this).is('[class^="carousel"]')) { !$(this).is('[class^="carousel"]') &&
!$(this).is('[data-toggle="collapse"]') &&
!($('body').hasClass('modal-open'))) {
event.preventDefault(); event.preventDefault();
var target = $(this.hash); var target = $(this.hash);
var headerheight = 0; var headerheight = 0;
......
...@@ -84,6 +84,9 @@ function addFeedbackSuccess(form, data) { ...@@ -84,6 +84,9 @@ function addFeedbackSuccess(form, data) {
var commentlink = ' ' + get_string('commentsanddetails', 'artefact.comment', data.data.count); var commentlink = ' ' + get_string('commentsanddetails', 'artefact.comment', data.data.count);
$('.commentlink').filter('[data-artefactid=' + data.data.artefact + ']').html('<span class="icon icon-comments" role="presentation" aria-hidden="true"></span>' + commentlink); $('.commentlink').filter('[data-artefactid=' + data.data.artefact + ']').html('<span class="icon icon-comments" role="presentation" aria-hidden="true"></span>' + commentlink);
//For brief comments and details previews when there is no block comments and details header
$('.comment-count-preview').filter('[data-artefactid=' + data.data.artefact + ']').html('<span class="icon icon-comments" role="presentation" aria-hidden="true"></span> (' + data.data.count + ')');
resetFeedbackReplyto(); resetFeedbackReplyto();
formSuccess(form, data); formSuccess(form, data);
...@@ -240,11 +243,18 @@ function delete_comment_from_modal_submit(form, data) { ...@@ -240,11 +243,18 @@ function delete_comment_from_modal_submit(form, data) {
newlink += '<span class="bh-margin-left icon icon-link" role="presentation" aria-hidden="true"></span>'; newlink += '<span class="bh-margin-left icon icon-link" role="presentation" aria-hidden="true"></span>';
newlink += ' ' + get_string('Details', 'artefact.comment'); newlink += ' ' + get_string('Details', 'artefact.comment');
$('.commentlink').filter('[data-artefactid=' + data.data.artefact + ']').html(newlink); $('.commentlink').filter('[data-artefactid=' + data.data.artefact + ']').html(newlink);
//For brief comments and details previews when there is no block comments and details header
$('.comment-count-preview').filter('[data-artefactid=' + data.data.artefact + ']').html('');
} }
else { else {
var commentlink = ' ' + get_string('commentsanddetails', 'artefact.comment', data.data.count); var commentlink = ' ' + get_string('commentsanddetails', 'artefact.comment', data.data.count);
$('.commentlink').filter('[data-artefactid=' + data.data.artefact + ']').html('<span class="icon icon-comments" role="presentation" aria-hidden="true"></span>' + commentlink); $('.commentlink').filter('[data-artefactid=' + data.data.artefact + ']').html('<span class="icon icon-comments" role="presentation" aria-hidden="true"></span>' + commentlink);
//For brief comments and details previews when there is no block comments and details header
$('.comment-count-preview').filter('[data-artefactid=' + data.data.artefact + ']').html('<span class="icon icon-comments" role="presentation" aria-hidden="true"></span> (' + data.data.count + ')');
} }
if ($('#configureblock').hasClass('closed')) { if ($('#configureblock').hasClass('closed')) {
formSuccess(form, data); formSuccess(form, data);
} }
...@@ -314,10 +324,12 @@ jQuery(function($) { ...@@ -314,10 +324,12 @@ jQuery(function($) {
if (!$('#details-btn').hasClass('active')) { if (!$('#details-btn').hasClass('active')) {
$('#details-btn').addClass('active'); $('#details-btn').addClass('active');
headers.removeClass('d-none'); headers.removeClass('d-none');
$('.comments-details').removeClass('d-none');
} }
else { else {
$('#details-btn').removeClass('active'); $('#details-btn').removeClass('active');
headers.addClass('d-none'); headers.addClass('d-none');
$('.comments-details').addClass('d-none');
} }
}); });
......
...@@ -881,6 +881,7 @@ $string['more...'] = 'More...'; ...@@ -881,6 +881,7 @@ $string['more...'] = 'More...';
$string['moreoptions'] = 'More options'; $string['moreoptions'] = 'More options';
$string['moreoptionsfor'] = 'More options for "%s"'; $string['moreoptionsfor'] = 'More options for "%s"';
$string['details'] = 'details'; $string['details'] = 'details';
$string['Details'] = 'Details';
$string['nohelpfound'] = 'There was no help found for this item.'; $string['nohelpfound'] = 'There was no help found for this item.';
$string['nohelpfoundpage'] = 'There was no help found for this page.'; $string['nohelpfoundpage'] = 'There was no help found for this page.';
$string['couldnotgethelp'] = 'An error occurred trying to retrieve the help page.'; $string['couldnotgethelp'] = 'An error occurred trying to retrieve the help page.';
......
{if !$editing}
{if !$allowcomments}
{assign var="justdetails" value=true}
{/if}
{include
file='header/block-comments-details-header.tpl'
artefactid=$artefactid
blockid=$blockid
commentcount=$commentcount
allowcomments=$allowcomments
justdetails=$justdetails}
{/if}
{$html|safe} {$html|safe}
{$comments|safe}
\ No newline at end of file
...@@ -26,27 +26,58 @@ ...@@ -26,27 +26,58 @@
<div class="recentblogpost list-group"> <div class="recentblogpost list-group">
{foreach from=$mostrecent item=post} {foreach from=$mostrecent item=post}
<div class="list-group-item"> <div class="list-group-item">
<a class="modal_link outer-link" data-toggle="modal-docked" data-target="#configureblock" href="#" data-blockid="{$blockid}" data-artefactid="{$post->id}"> <a class="outer-link collapsed" data-toggle="collapse" href="#recent_post_{$post->id}" aria-expanded="false">
<span class="sr-only">{$post->title}</span> <span class="sr-only">{$post->title}</span>
</a> </a>
<h4 class="list-group-item-heading text-inline"> <h4 class={if !($editing)}"list-group-item-heading text-inline"{else}"title"{/if}>
{$post->title} {if !($editing)}
<a class="modal_link inner-link" data-toggle="modal-docked" data-target="#configureblock" href="#" data-blockid="{$blockid}" data-artefactid="{$post->id}">
{$post->title}
</a>
{else}
{$post->title}
{/if}
</h4> </h4>
<span class="text-small"> <span class="comments-details d-none comments-details-mg-left comment-count-preview" data-artefactid="{$post->id}">
{str tag='postedin' section='blocktype.blog/recentposts'} {if $post->commentcount > 0}
<a href="{$WWWROOT}artefact/artefact.php?artefact={$post->parent}&amp;view={$view}" class="inner-link"> <span class="comment_count" role="presentation" aria-hidden="true"></span>
{$post->parenttitle} <span class="icon icon-comments" role="presentation" aria-hidden="true"></span>
</a> ({$post->commentcount})
</span>
<span class="metadata">
{str tag='postedon' section='blocktype.blog/recentposts'}
{$post->displaydate}
<br>
{if $post->updateddate}
{str tag='updatedon' section='blocktype.blog/recentposts'}
{$post->updateddate}
{/if} {/if}
</span> </span>
<span class="comments-details d-none icon icon-search-plus bh-margin-left" role="presentation" aria-hidden="true"></span>
<div>
<span class="text-small">
{str tag='postedin' section='blocktype.blog/recentposts'}
{if $canviewblog}
<a href="{$WWWROOT}artefact/blog/view/index.php?id={$post->parent}" class="inner-link">
{$post->parenttitle}
</a>
{else}
{$post->parenttitle}
{/if}
</span>
<span class="metadata">
{str tag='postedon' section='blocktype.blog/recentposts'}
{$post->displaydate}
<br>
{if $post->updateddate}
{str tag='updatedon' section='blocktype.blog/recentposts'}
{$post->updateddate}
{/if}
</span>
</div>
<span class="icon icon-chevron-down collapse-indicator float-right" role="presentation" aria-hidden="true"></span>
</div>
<div id="recent_post_{$post->id}" class="collapse content-text">
{if $post->tags}
<div class="tags metadata">
<span class="icon icon-tags left" role="presentation" aria-hidden="true"></span>
<strong>{str tag=tags}:</strong>
{list_tags owner=$post->owner tags=$post->tags}
</div>
{/if}
<span>{$post->description|safe}</span>
</div> </div>
{/foreach} {/foreach}
</div> </div>
...@@ -40,9 +40,7 @@ ...@@ -40,9 +40,7 @@
{foreach from=$results item=post} {foreach from=$results item=post}
<div class="post list-group-item"> <div class="post list-group-item">
<h4 class="list-group-heading"> <h4 class="list-group-heading">
<a class="modal_link list-group-heading" data-toggle="modal-docked" data-target="#configureblock" href="#" data-blockid="{$blockid}" data-artefactid="{$post->id}"> {$post->title}
{$post->title}
</a>
</h4> </h4>
<div class="postdetails metadata"> <div class="postdetails metadata">
<span class="icon icon-regular icon-calendar-alt left" role="presentation" aria-hidden="true"></span> <span class="icon icon-regular icon-calendar-alt left" role="presentation" aria-hidden="true"></span>
...@@ -57,21 +55,9 @@ ...@@ -57,21 +55,9 @@
<div class="detail list-group-item-detail"> <div class="detail list-group-item-detail">
{$post->description|clean_html|safe} {$post->description|clean_html|safe}
</div> </div>
{if $post->attachments} {if $post->attachments}
{$post->attachments|safe} {$post->attachments|safe}
{/if} {/if}
{if !$editing}
{if $post->commentcount != null}
<div class="comments clearfix">
<a id="comment_link_{$post->id}" class="commentlink link-blocktype" data-toggle="modal-docked" data-target="#configureblock" href="#" data-blockid="{$blockid}" data-artefactid="{$post->id}">
<span class="icon icon-comments" role="presentation" aria-hidden="true"></span>
{str tag=commentsanddetails section=artefact.comment arg1=$post->commentcount}
</a>
</div>
{/if}
{/if}