diff options
Diffstat (limited to 'views/default/river/elements/responses.php')
-rw-r--r-- | views/default/river/elements/responses.php | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/views/default/river/elements/responses.php b/views/default/river/elements/responses.php index 432296737..f6c32e142 100644 --- a/views/default/river/elements/responses.php +++ b/views/default/river/elements/responses.php @@ -1,25 +1,35 @@ <?php /** * River item footer + * + * @uses $vars['item'] ElggRiverItem + * @uses $vars['responses'] Alternate override for this item */ +// allow river views to override the response content +$responses = elgg_extract('responses', $vars, false); +if ($responses) { + echo $responses; + return true; +} + $item = $vars['item']; $object = $item->getObjectEntity(); // annotations do not have comments -if (!$object || $item->annotation_id) { +if ($item->annotation_id != 0 || !$object) { return true; } - $comment_count = $object->countComments(); -$comments = elgg_get_annotations(array( +$options = array( 'guid' => $object->getGUID(), 'annotation_name' => 'generic_comment', 'limit' => 3, 'order_by' => 'n_table.time_created desc' -)); +); +$comments = elgg_get_annotations($options); if ($comments) { // why is this reversing it? because we're asking for the 3 latest @@ -27,23 +37,27 @@ if ($comments) { // these comments with the latest at the bottom. $comments = array_reverse($comments); +?> + <span class="elgg-river-comments-tab"><?php echo elgg_echo('comments'); ?></span> + +<?php + + echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments')); + if ($comment_count > count($comments)) { - $link = elgg_view('output/url', array( - 'href' => $object->getURL(), - 'text' => elgg_echo('river:comments:all', array($comment_count)), - )); - - echo elgg_view_image_block(elgg_view_icon('speech-bubble-alt'), $link, array('class' => 'elgg-river-participation')); + $num_more_comments = $comment_count - count($comments); + $url = $object->getURL(); + $params = array( + 'href' => $url, + 'text' => elgg_echo('river:comments:more', array($num_more_comments)), + 'is_trusted' => true, + ); + $link = elgg_view('output/url', $params); + echo "<div class=\"elgg-river-more\">$link</div>"; } - - echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments', 'item_class' => 'elgg-river-participation')); - } -if ($object->canAnnotate(0, 'generic_comment')) { - // inline comment form - echo elgg_view_form('comments/add', array( - 'id' => "comments-add-{$object->getGUID()}", - 'class' => 'elgg-river-participation elgg-form-small', - ), array('entity' => $object, 'inline' => true)); -}
\ No newline at end of file +// inline comment form +$form_vars = array('id' => "comments-add-{$object->getGUID()}", 'class' => 'hidden'); +$body_vars = array('entity' => $object, 'inline' => true); +echo elgg_view_form('comments/add', $form_vars, $body_vars); |