]> git.mxchange.org Git - friendica.git/commitdiff
rework show/hide comments
authorfriendica <info@friendica.com>
Wed, 23 Nov 2011 00:00:05 +0000 (16:00 -0800)
committerfriendica <info@friendica.com>
Wed, 23 Nov 2011 00:00:05 +0000 (16:00 -0800)
boot.php
include/conversation.php
view/head.tpl
view/hide_comments.tpl [new file with mode: 0644]
view/theme/duepuntozero/style.css

index 6050e6b05612c6a4cb6e3c72e080b5e6916d91cf..4ccdff7acd0a4c6e8e2cd68af26a5b124e843535 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDIKA_PLATFORM',     'Friendica');
-define ( 'FRIENDIKA_VERSION',      '2.3.1172' );
+define ( 'FRIENDIKA_VERSION',      '2.3.1173' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
 define ( 'DB_UPDATE_VERSION',      1105      );
 
@@ -417,7 +417,9 @@ class App {
                        '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
                        '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION,
                        '$delitem' => t('Delete this item?'),
-                       '$comment' => t('Comment')
+                       '$comment' => t('Comment'),
+                       '$showmore' => t('show more'),
+                       '$showfewer' => t('show fewer')
                ));
        }
 
index 9ac251e4607385d9030fe993d39926e155f98d87..d8adb27c3c37107512a7fc7b815a2dc0dd0ddd78 100644 (file)
@@ -172,6 +172,7 @@ function conversation(&$a, $items, $mode, $update) {
        $cmnt_tpl    = get_markup_template('comment_item.tpl');
        $tpl         = get_markup_template('wall_item.tpl');
        $wallwall    = get_markup_template('wallwall_item.tpl');
+       $hide_comments_tpl = get_markup_template('hide_comments.tpl');
 
        $alike = array();
        $dlike = array();
@@ -385,12 +386,20 @@ function conversation(&$a, $items, $mode, $update) {
                                $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
                                $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
 
+
                                if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
                                        if(! $comments_collapsed) {
-                                               $threads[$threadsid] .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent'] 
-                                                       . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\'); $(\'#ccollapse-wrapper-' . $item['parent'] . '\').hide();" >' 
-                                                       . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'
-                                                       . '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
+
+                                               // IMPORTANT: the closing </div> in the hide_comments template
+                                               // is supplied below in code. 
+
+                                               $threads[$threadsid] .= replace_macros($hide_comments_tpl,array(
+                                                       '$id' => $item['parent'],
+                                                       '$num_comments' => sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),
+                                                               $comments[$item['parent']]),
+                                                       '$display' => 'none',
+                                                       '$hide_text' => t('show more')
+                                               ));
                                                $comments_collapsed = true;
                                        }
                                }
index 752915b14620c92f844f5704e924dfa7d2689725..055c3cef58e325be076cb6b936dc5f58e1b1a9b3 100644 (file)
                }
        }
 
+       function showHideComments(id) {
+               if( $('#collapsed-comments-' + id).is(':visible')) {
+                       $('#collapsed-comments-' + id).hide();
+                       $('#hide-comments-' + id).html('$showmore');
+               }
+               else {
+                       $('#collapsed-comments-' + id).show();
+                       $('#hide-comments-' + id).html('$showfewer');
+               }
+       }
+
+
 </script>
 
 
diff --git a/view/hide_comments.tpl b/view/hide_comments.tpl
new file mode 100644 (file)
index 0000000..123546b
--- /dev/null
@@ -0,0 +1,4 @@
+<div class="hide-comments-outer">
+$num_comments <span id="hide-comments-$id" class="hide-comments fakelink" onclick="showHideComments($id);">$hide_text</span>
+</div>
+<div id="collapsed-comments-$id" class="collapsed-comments" style="display: $display;">
index 662518d430d2ddeaa647d638a8457def4f26c719..d678876dcf59d0076287b970b1d02c568d19e4c8 100644 (file)
@@ -61,6 +61,10 @@ blockquote {
        padding: 5px;
 }
 
+.hide-comments {
+       margin-left: 15px;
+}
+
 #panel {
        background-color: ivory;
        position: absolute;