Merge pull request #491 from fermionic/separate-number-text-in-hidden-comments-text

allow hidden comments phrase to be accessed separately as number and text
This commit is contained in:
friendica 2012-09-19 20:56:26 -07:00
commit ee6044a6e4
3 changed files with 6 additions and 0 deletions

View file

@ -685,6 +685,8 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
$item_result = $arr['output']; $item_result = $arr['output'];
if($firstcollapsed) { if($firstcollapsed) {
$item_result['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children ); $item_result['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$item_result['hidden_comments_num'] = $total_children;
$item_result['hidden_comments_text'] = tt('comment', 'comments', $total_children);
$item_result['hide_text'] = t('show more'); $item_result['hide_text'] = t('show more');
} }

View file

@ -584,6 +584,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
if (!$comments_collapsed){ if (!$comments_collapsed){
$threads[$threadsid]['num_comments'] = sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),$comments[$item['parent']] ); $threads[$threadsid]['num_comments'] = sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),$comments[$item['parent']] );
$threads[$threadsid]['hidden_comments_num'] = $comments[$item['parent']];
$threads[$threadsid]['hidden_comments_text'] = tt('comment', 'comments', $comments[$item['parent']]);
$threads[$threadsid]['hide_text'] = t('show more'); $threads[$threadsid]['hide_text'] = t('show more');
$comments_collapsed = true; $comments_collapsed = true;
$comment_firstcollapsed = true; $comment_firstcollapsed = true;

View file

@ -254,6 +254,8 @@ class Item extends BaseObject {
if(($nb_children > 2) || ($thread_level > 1)) { if(($nb_children > 2) || ($thread_level > 1)) {
$result['children'][0]['comment_firstcollapsed'] = true; $result['children'][0]['comment_firstcollapsed'] = true;
$result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children ); $result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$result['children'][0]['hidden_comments_num'] = $total_children;
$result['children'][0]['hidden_comments_text'] = tt('comment', 'comments', $total_children);
$result['children'][0]['hide_text'] = t('show more'); $result['children'][0]['hide_text'] = t('show more');
if($thread_level > 1) { if($thread_level > 1) {
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true; $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;